注册备份集中,如果备份集中放在和原库相同目录可以省略这一步:
RMAN> catalog start with '/home/Oracle/target_bk/';
Starting implicit crosscheck backup at 30-DEC-12
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=155 devtype=DISK
Crosschecked 7 objects
Finished implicit crosscheck backup at 30-DEC-12
Starting implicit crosscheck copy at 30-DEC-12
using channel ORA_DISK_1
Crosschecked 6 objects
Finished implicit crosscheck copy at 30-DEC-12
searching for all files in the recovery area
cataloging files...
no files cataloged
searching for all files that match the pattern /home/oracle/target_bk/
List of Files Unknown to the Database
=====================================
File Name: /home/oracle/target_bk/archivelog_0snu4jbf_1_1
File Name: /home/oracle/target_bk/full_database0pnu4jb4_1_1
File Name: /home/oracle/target_bk/full_database0nnu4ja0_1_1
File Name: /home/oracle/target_bk/full_database0onu4ja0_1_1
File Name: /home/oracle/target_bk/full_database0qnu4jb5_1_1
File Name: /home/oracle/target_bk/archivelog_0rnu4jbf_1_1
Do you really want to catalog the above files (enter YES or NO)? yes
cataloging files...
cataloging done
List of Cataloged Files
=======================
File Name: /home/oracle/target_bk/archivelog_0snu4jbf_1_1
File Name: /home/oracle/target_bk/full_database0pnu4jb4_1_1
File Name: /home/oracle/target_bk/full_database0nnu4ja0_1_1
File Name: /home/oracle/target_bk/full_database0onu4ja0_1_1
File Name: /home/oracle/target_bk/full_database0qnu4jb5_1_1
File Name: /home/oracle/target_bk/archivelog_0rnu4jbf_1_1
恢复数据文件:
run {
allocate channel c1 device type disk;
allocate channel c2 device type disk;
set newname for datafile '+DG1/sourcedb/datafile/system01.dbf' to '/u01/oracle/oradata/sourcedb/system01.dbf';
set newname for datafile '+DG1/sourcedb/datafile/undotbs301.dbf' to '/u01/oracle/oradata/sourcedb/undotbs301.dbf';
set newname for datafile '+DG1/sourcedb/datafile/users01.dbf' to '/u01/oracle/oradata/sourcedb/users01.dbf';
set newname for datafile '+DG1/sourcedb/datafile/sysaux01.dbf' to '/u01/oracle/oradata/sourcedb/sysaux01.dbf';
set newname for datafile '+DG1/sourcedb/datafile/example01.dbf' to '/u01/oracle/oradata/sourcedb/example01.dbf';
set newname for datafile '+DG1/sourcedb/datafile/gguser.dbf' to '/u01/oracle/oradata/sourcedb/gguser.dbf';
restore database;
switch datafile all;
release channel c1;
release channel c2;
}
allocated channel: c1
channel c1: sid=155 devtype=DISK
allocated channel: c2
channel c2: sid=153 devtype=DISK
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
Starting restore at 30-DEC-12
channel c1: starting datafile backupset restore
channel c1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to /u01/oracle/oradata/sourcedb/system01.dbf
restoring datafile 00002 to /u01/oracle/oradata/sourcedb/undotbs301.dbf
restoring datafile 00004 to /u01/oracle/oradata/sourcedb/users01.dbf
channel c1: reading from backup piece /home/oracle/target_bk/full_database0nnu4ja0_1_1
channel c2: starting datafile backupset restore
channel c2: specifying datafile(s) to restore from backup set
restoring datafile 00003 to /u01/oracle/oradata/sourcedb/sysaux01.dbf
restoring datafile 00005 to /u01/oracle/oradata/sourcedb/example01.dbf
restoring datafile 00006 to /u01/oracle/oradata/sourcedb/gguser.dbf
channel c2: reading from backup piece /home/oracle/target_bk/full_database0onu4ja0_1_1
channel c1: restored backup piece 1
piece handle=/home/oracle/target_bk/full_database0nnu4ja0_1_1 tag=TAG20121230T033424
channel c1: restore complete, elapsed time: 00:00:47
channel c2: restored backup piece 1
piece handle=/home/oracle/target_bk/full_database0onu4ja0_1_1 tag=TAG20121230T033424
channel c2: restore complete, elapsed time: 00:00:46
Finished restore at 30-DEC-12
datafile 1 switched to datafile copy
input datafile copy recid=32 stamp=803367018 filename=/u01/oracle/oradata/sourcedb/system01.dbf
datafile 2 switched to datafile copy
input datafile copy recid=33 stamp=803367018 filename=/u01/oracle/oradata/sourcedb/undotbs301.dbf
datafile 4 switched to datafile copy
input datafile copy recid=34 stamp=803367018 filename=/u01/oracle/oradata/sourcedb/users01.dbf
datafile 3 switched to datafile copy
input datafile copy recid=35 stamp=803367018 filename=/u01/oracle/oradata/sourcedb/sysaux01.dbf
datafile 5 switched to datafile copy
input datafile copy recid=36 stamp=803367018 filename=/u01/oracle/oradata/sourcedb/example01.dbf
datafile 6 switched to datafile copy
input datafile copy recid=37 stamp=803367018 filename=/u01/oracle/oradata/sourcedb/gguser.dbf
released channel: c1
released channel: c2
RMAN> recover database;
Starting recover at 30-DEC-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=155 devtype=DISK
starting media recovery
channel ORA_DISK_1: starting archive log restore to default destination
channel ORA_DISK_1: restoring archive log
archive log thread=1 sequence=12
channel ORA_DISK_1: reading from backup piece /home/oracle/target_bk/archivelog_0snu4jbf_1_1
channel ORA_DISK_1: restored backup piece 1
piece handle=/home/oracle/target_bk/archivelog_0snu4jbf_1_1 tag=TAG20121230T033511
channel ORA_DISK_1: restore complete, elapsed time: 00:00:02
channel ORA_DISK_1: starting archive log restore to default destination
channel ORA_DISK_1: restoring archive log
archive log thread=1 sequence=11
channel ORA_DISK_1: reading from backup piece /home/oracle/target_bk/archivelog_0rnu4jbf_1_1
channel ORA_DISK_1: restored backup piece 1
piece handle=/home/oracle/target_bk/archivelog_0rnu4jbf_1_1 tag=TAG20121230T033511
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
archive log filename=/u01/oracle/oradata/sourcedb/arch/1_11_803260244.dbf thread=1 sequence=11
archive log filename=/u01/oracle/oradata/sourcedb/arch/1_12_803260244.dbf thread=1 sequence=12
unable to find archive log
archive log thread=1 sequence=13
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 12/30/2012 05:32:41
RMAN-06054: media recovery requesting unknown log: thread 1 seq 13 lowscn 743601
这里报找不到13号日志,因为在原库备份的时候13号日志还没归档,所以备份集中没有这个日志。
