Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1133915
  • 博文数量: 276
  • 博客积分: 10077
  • 博客等级: 上将
  • 技术积分: 2513
  • 用 户 组: 普通用户
  • 注册时间: 2007-08-24 20:31
文章分类

全部博文(276)

文章存档

2020年(1)

2015年(5)

2012年(2)

2011年(6)

2010年(7)

2009年(224)

2008年(31)

我的朋友

分类: Oracle

2010-11-23 14:03:20

linux_db:10.2.0.4

1)linux_db创建catalog用户
sqlplus /nolog << EOF
conn system/oracle@linux_db
create user RMAN identified by RMAN default tablespace users temporary tablespace TEMP;
grant connect,resource,recovery_catalog_owner to RMAN;
EOF

2)linux_db创建catalog
rman
connect catalog rman/rman@linux_db
create catalog;

3)wind_db注册到catalog库
C:\>rman target system/oracle@win_db catalog rman/rman@linux_db
Recovery Manager: Release 10.2.0.1.0 - Production on Tue Nov 23 12:45:43 2010

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

connected to target database: TEST01 (DBID=3524386065)
connected to recovery catalog database

RMAN> register database;

database registered in recovery catalog
starting full resync of recovery catalog
full resync complete


4)备份win_db
rman target system/oracle@win_db catalog rman/rman@linux_db
run
{
# Backup Database full

allocate channel ch1 type disk;                 
allocate channel ch2 type disk;
resync catalog;
set command id to 'bkrs';                       
set limit channel ch1 kbytes 2000000;           
set limit channel ch2 kbytes 2000000;
BACKUP                                          
     SKIP INACCESSIBLE                          
     TAG hot_db_bk_level                        
     FILESPERSET 5                              
     FORMAT 'C:\bak\bk_s%s_p%p_t%T'
    DATABASE                                    
    INCLUDE CURRENT CONTROLFILE;                
RELEASE CHANNEL ch1;                            
RELEASE CHANNEL ch2;                                                
                                                
# Backup Archived Logs                                                                        
                                               
sql 'alter system archive log current';        
change archivelog all crosscheck;              
ALLOCATE CHANNEL ch1 type disk;                
ALLOCATE CHANNEL ch2 type disk;
set command id to 'bkrs';                      
set limit channel ch1 kbytes 2000000;          
set limit channel ch2 kbytes 2000000;
BACKUP                                         
    filesperset 5                              
    FORMAT 'C:\bak\ar_s%s_p%p_t%T'
    ARCHIVELOG ALL DELETE ALL INPUT;               
RELEASE CHANNEL ch1;                           
RELEASE CHANNEL ch2;
          
# Control file backup                          
                                               
ALLOCATE CHANNEL ch1 type disk;                
BACKUP                                         
    FORMAT 'C:\bak\cf_s%s_p%p_t%T'
    CURRENT CONTROLFILE;                       
RELEASE CHANNEL ch1; 

# spfile backup         
ALLOCATE CHANNEL ch1 type disk; 
backup spfile format='C:\bak\spfile_s%s_p%p_t%T';
RELEASE CHANNEL ch1; 
}    
crosscheck backup;
 
delete noprompt expired backup;
 
report obsolete;
 
delete noprompt obsolete recovery window of 5 days;
 
list backup summary;

5)还原win_db
rman target system/oracle@win_db catalog rman/rman@linux_db
list incarnation;
startup nomount
restore controlfile;
alter database mount;
restore database;
alter database open resetlogs;


6)注销/删除catalog
rman target system/oracle@win_db catalog rman/rman@linux_db
unregister database;

rman
connect catalog rman/rman@linux_db
drop catalog;
阅读(1289) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~