restore archivelog的各种用法
restore archivelog的各种用法
1.备份所有归档日志文件
RMAN> backup archivelog all delete input; Starting backup at 02-JUN-08 current log archived using channel ORA_DISK_1 skipping archive log file D:\ARCHPAUL\ARC00001.001; already backed up 1 time(s) skipping archive log file D:\ARCHPAUL\PUBTEST_1_2.DBF; already backed up 1 time(s) skipping archive log file D:\ARCHPAUL\PUBTEST_1_3.DBF; already backed up 1 time(s) skipping archive log file D:\ARCHPAUL\PUBTEST_1_4.DBF; already backed up 1 time(s) skipping archive log file D:\ARCHPAUL\PUBTEST_1_5.DBF; already backed up 1 time(s) skipping archive log file D:\ARCHPAUL\PUBTEST_1_6.DBF; already backed up 1 time(s) skipping archive log file D:\ARCHPAUL\PUBTEST_1_7.DBF; already backed up 1 time(s) skipping archive log file D:\ARCHPAUL\PUBTEST_1_8.DBF; already backed up 1 time(s) skipping archive log file D:\ARCHPAUL\PUBTEST_1_9.DBF; already backed up 1 time(s) skipping archive log file D:\ARCHPAUL\PUBTEST_1_10.DBF; already backed up 1 time(s) skipping archive log file D:\ARCHPAUL\PUBTEST_1_11.DBF; already backed up 1 time(s) skipping archive log file D:\ARCHPAUL\PUBTEST_1_12.DBF; already backed up 1 time(s) channel ORA_DISK_1: starting archive log backupset channel ORA_DISK_1: specifying archive log(s) in backup set input archive log thread=1 sequence=13 recid=128 stamp=656353510 channel ORA_DISK_1: starting piece 1 at 02-JUN-08 channel ORA_DISK_1: finished piece 1 at 02-JUN-08 piece handle=D:\BACKUP\2QJHUA76_1_1 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02 channel ORA_DISK_1: deleting archive log(s) archive log filename=D:\ARCHPAUL\PUBTEST_1_13.DBF recid=128 stamp=656353510 channel ORA_DISK_1: deleting archive log(s) archive log filename=D:\ARCHPAUL\ARC00001.001 recid=116 stamp=656352824 archive log filename=D:\ARCHPAUL\PUBTEST_1_2.DBF recid=117 stamp=656353339 archive log filename=D:\ARCHPAUL\PUBTEST_1_3.DBF recid=118 stamp=656353340 archive log filename=D:\ARCHPAUL\PUBTEST_1_4.DBF recid=119 stamp=656353340 archive log filename=D:\ARCHPAUL\PUBTEST_1_5.DBF recid=120 stamp=656353369 archive log filename=D:\ARCHPAUL\PUBTEST_1_6.DBF recid=121 stamp=656353370 archive log filename=D:\ARCHPAUL\PUBTEST_1_7.DBF recid=122 stamp=656353375 archive log filename=D:\ARCHPAUL\PUBTEST_1_8.DBF recid=123 stamp=656353376 archive log filename=D:\ARCHPAUL\PUBTEST_1_9.DBF recid=124 stamp=656353382 archive log filename=D:\ARCHPAUL\PUBTEST_1_10.DBF recid=125 stamp=656353384 archive log filename=D:\ARCHPAUL\PUBTEST_1_11.DBF recid=126 stamp=656353386 archive log filename=D:\ARCHPAUL\PUBTEST_1_12.DBF recid=127 stamp=656353465 Finished backup at 02-JUN-08 Starting Control File and SPFILE Autobackup at 02-JUN-08 piece handle=D:\BACKUP\C-799229701-20080602-0C comment=NONE Finished Control File and SPFILE Autobackup at 02-JUN-08
第二: restore archivelog 的各种选项
1.restore archivelog all 恢复全部归档日志文件
RMAN> restore archivelog all; Starting restore at 02-JUN-08 using channel ORA_DISK_1 channel ORA_DISK_1: starting archive log restore to default destination channel ORA_DISK_1: restoring archive log archive log thread=1 sequence=1 channel ORA_DISK_1: restoring archive log archive log thread=1 sequence=2 channel ORA_DISK_1: restoring archive log archive log thread=1 sequence=3 channel ORA_DISK_1: restoring archive log archive log thread=1 sequence=4 channel ORA_DISK_1: restoring archive log archive log thread=1 sequence=5 channel ORA_DISK_1: restoring archive log archive log thread=1 sequence=6 channel ORA_DISK_1: restoring archive log archive log thread=1 sequence=7 channel ORA_DISK_1: restoring archive log archive log thread=1 sequence=8 channel ORA_DISK_1: restoring archive log archive log thread=1 sequence=9 channel ORA_DISK_1: restoring archive log archive log thread=1 sequence=10 channel ORA_DISK_1: restoring archive log archive log thread=1 sequence=11 channel ORA_DISK_1: restoring archive log archive log thread=1 sequence=12 channel ORA_DISK_1: restored backup piece 1 piece handle=D:\BACKUP\2OJHUA5Q_1_1 tag=TAG20080602T162426 params=NULL channel ORA_DISK_1: restore complete channel ORA_DISK_1: starting archive log restore to default destination channel ORA_DISK_1: restoring archive log archive log thread=1 sequence=13 channel ORA_DISK_1: restored backup piece 1 piece handle=D:\BACKUP\2QJHUA76_1_1 tag=TAG20080602T162510 params=NULL channel ORA_DISK_1: restore complete Finished restore at 02-JUN-08 RMAN>
2.只恢复 5到8这四个归档日志文件
RMAN> restore archivelog from logseq 5 until logseq 8; Starting restore at 02-JUN-08 using channel ORA_DISK_1 channel ORA_DISK_1: starting archive log restore to default destination channel ORA_DISK_1: restoring archive log archive log thread=1 sequence=5 channel ORA_DISK_1: restoring archive log archive log thread=1 sequence=6 channel ORA_DISK_1: restoring archive log archive log thread=1 sequence=7 channel ORA_DISK_1: restoring archive log archive log thread=1 sequence=8 channel ORA_DISK_1: restored backup piece 1 piece handle=D:\BACKUP\2OJHUA5Q_1_1 tag=TAG20080602T162426 params=NULL channel ORA_DISK_1: restore complete Finished restore at 02-JUN-08
3.恢复从第5个归档日志起
RMAN> restore archivelog from logseq 5; Starting restore at 02-JUN-08 using channel ORA_DISK_1 channel ORA_DISK_1: starting archive log restore to default destination channel ORA_DISK_1: restoring archive log archive log thread=1 sequence=5 channel ORA_DISK_1: restoring archive log archive log thread=1 sequence=6 channel ORA_DISK_1: restoring archive log archive log thread=1 sequence=7 channel ORA_DISK_1: restoring archive log archive log thread=1 sequence=8 channel ORA_DISK_1: restoring archive log archive log thread=1 sequence=9 channel ORA_DISK_1: restoring archive log archive log thread=1 sequence=10 channel ORA_DISK_1: restoring archive log archive log thread=1 sequence=11 channel ORA_DISK_1: restoring archive log archive log thread=1 sequence=12 channel ORA_DISK_1: restored backup piece 1 piece handle=D:\BACKUP\2OJHUA5Q_1_1 tag=TAG20080602T162426 params=NULL channel ORA_DISK_1: restore complete channel ORA_DISK_1: starting archive log restore to default destination channel ORA_DISK_1: restoring archive log archive log thread=1 sequence=13 channel ORA_DISK_1: restored backup piece 1 piece handle=D:\BACKUP\2QJHUA76_1_1 tag=TAG20080602T162510 params=NULL channel ORA_DISK_1: restore complete Finished restore at 02-JUN-08 RMAN>
4.恢复7天内的归档日志
RMAN> restore archivelog from time 'sysdate-7'; Starting restore at 02-JUN-08 using channel ORA_DISK_1 channel ORA_DISK_1: starting archive log restore to default destination channel ORA_DISK_1: restoring archive log archive log thread=1 sequence=1 channel ORA_DISK_1: restoring archive log archive log thread=1 sequence=2 channel ORA_DISK_1: restoring archive log archive log thread=1 sequence=3 channel ORA_DISK_1: restoring archive log archive log thread=1 sequence=4 channel ORA_DISK_1: restoring archive log archive log thread=1 sequence=5 channel ORA_DISK_1: restoring archive log archive log thread=1 sequence=6 channel ORA_DISK_1: restoring archive log archive log thread=1 sequence=7 channel ORA_DISK_1: restoring archive log archive log thread=1 sequence=8 channel ORA_DISK_1: restoring archive log archive log thread=1 sequence=9 channel ORA_DISK_1: restoring archive log archive log thread=1 sequence=10 channel ORA_DISK_1: restoring archive log archive log thread=1 sequence=11 channel ORA_DISK_1: restoring a