rac环境下恢复部分归档日志。
恢复全部归档日志文件
restore archivelog all
恢复从第5个归档日志起
restore archivelog from logseq 5;
只恢复 5到10这四个归档日志文件
restore archivelog from logseq 5 until logseq 10;
恢复7天内的归档日志--默认恢复所有线程的日志。
restore archivelog from time 'sysdate-7';
根据rac线程
restore archivelog from logseq 6160 thread 2
查看归档日志备份信息:
list backup of archivelog all;
RMAN> list backup of archivelog all;
List of Backup Sets
===================
BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
3 49.09M DISK 00:00:00 21-AUG-18
BP Key: 3 Status: AVAILABLE Compressed: NO Tag: TAG20180821T161057
Piece Name: /soft/arc_04tb4eoh_1_1.bak
List of Archived Logs in backup set 3
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- --------- ---------- ---------
1 5 994927 21-AUG-18 1007213 21-AUG-18
1 6 1007213 21-AUG-18 1009252 21-AUG-18
1 7 1009252 21-AUG-18 1009257 21-AUG-18
1 8 1009257 21-AUG-18 1009261 21-AUG-18
1 9 1009261 21-AUG-18 1009264 21-AUG-18
1 10 1009264 21-AUG-18 1009267 21-AUG-18
1 11 1009267 21-AUG-18 1009490 21-AUG-18
1 12 1009490 21-AUG-18 1009502 21-AUG-18
1 13 1009502 21-AUG-18 1009511 21-AUG-18
1 14 1009511 21-AUG-18 1009514 21-AUG-18
1 15 1009514 21-AUG-18 1009747 21-AUG-18
1 16 1009747 21-AUG-18 1009771 21-AUG-18
2 1 1002940 21-AUG-18 1006920 21-AUG-18
2 2 1007214 21-AUG-18 1009271 21-AUG-18
2 3 1009271 21-AUG-18 1009476 21-AUG-18
2 4 1009476 21-AUG-18 1009480 21-AUG-18
2 5 1009480 21-AUG-18 1009483 21-AUG-18
2 6 1009483 21-AUG-18 1009486 21-AUG-18
2 7 1009486 21-AUG-18 1009493 21-AUG-18
2 8 1009493 21-AUG-18 1009496 21-AUG-18
2 9 1009496 21-AUG-18 1009499 21-AUG-18
2 10 1009499 21-AUG-18 1009505 21-AUG-18
2 11 1009505 21-AUG-18 1009508 21-AUG-18
2 12 1009508 21-AUG-18 1009751 21-AUG-18
2 13 1009751 21-AUG-18 1009774 21-AUG-18
设定归档日志恢复位置
run{
set archivelog destination to '/soft/arc';
}
RMAN> run{
set archivelog destination to '/soft/arc';
}2> 3>
executing command: SET ARCHIVELOG DESTINATION
恢复所有归档日志
默认恢复所有实例的归档日志。
run{
set archivelog destination to '/soft/arc';
restore archivelog all;
}
RMAN> run{
set archivelog destination to '/soft/arc';
restore archivelog all;
}2> 3> 4>
executing command: SET ARCHIVELOG DESTINATION
Starting restore at 21-AUG-18
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log restore to user-specified destination
archived log destination=/soft/arc
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=5
channel ORA_DISK_1: restoring archived log
archived log thread=2 sequence=1
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=6
channel ORA_DISK_1: restoring archived log
archived log thread=2 sequence=2
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=7
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=8
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=9
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=10
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=11
channel ORA_DISK_1: restoring archived log
archived log thread=2 sequence=3
channel ORA_DISK_1: restoring archived log
archived log thread=2 sequence=4
channel ORA_DISK_1: restoring archived log
archived log thread=2 sequence=5
channel ORA_DISK_1: restoring archived log
archived log thread=2 sequence=6
channel ORA_DISK_1: restoring archived log
archived log thread=2 sequence=7
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=12
channel ORA_DISK_1: restoring archived log
archived log thread=2 sequence=8
channel ORA_DISK_1: restoring archived log
archived log thread=2 sequence=9
channel ORA_DISK_1: restoring archived log
archived log thread=2 sequence=10
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=13
channel ORA_DISK_1: restoring archived log
archived log thread=2 sequence=11
channel ORA_DISK_1: restoring archived log
archived log thread=2 sequence=12
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=14
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=15
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=16
channel ORA_DISK_1: restoring archived log
archived log thread=2 sequence=13
channel ORA_DISK_1: reading from backup piece /soft/arc_04tb4eoh_1_1.bak
channel ORA_DISK_1: piece handle=/soft/arc_04tb4eoh_1_1.bak tag=TAG20180821T161057
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
Finished restore at 21-AUG-18
恢复部分归档日志
默认只恢复 默认线程的归档日志
RMAN> restore archivelog from logseq 5;
Starting restore at 21-AUG-18
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log restore to default destination
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=5
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=6
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=7
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=8
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=9
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=10
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=11
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=12
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=13
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=14
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=15
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=16
channel ORA_DISK_1: reading from backup piece /soft/arc_04tb4eoh_1_1.bak
channel ORA_DISK_1: piece handle=/soft/arc_04tb4eoh_1_1.bak tag=TAG20180821T161057
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
Finished restore at 21-AUG-18
如果要恢复特定线程日志需要明确指定
restore archivelog from logseq 5 thread 2;
RMAN> restore archivelog from logseq 5 thread 2;
Starting restore at 21-AUG-18
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log restore to default destination
channel ORA_DISK_1: restoring archived log
archived log thread=2 sequence=5
channel ORA_DISK_1: restoring archived log
archived log thread=2 sequence=6
channel ORA_DISK_1: restoring archived log
archived log thread=2 sequence=7
channel ORA_DISK_1: restoring archived log
archived log thread=2 sequence=8
channel ORA_DISK_1: restoring archived log
archived log thread=2 sequence=9
channel ORA_DISK_1: restoring archived log
archived log thread=2 sequence=10
channel ORA_DISK_1: restoring archived log
archived log thread=2 sequence=11
channel ORA_DISK_1: restoring archived log
archived log thread=2 sequence=12
channel ORA_DISK_1: restoring archived log
archived log thread=2 sequence=13
channel ORA_DISK_1: reading from backup piece /soft/arc_04tb4eoh_1_1.bak
channel ORA_DISK_1: piece handle=/soft/arc_04tb4eoh_1_1.bak tag=TAG20180821T161057
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
Finished restore at 21-AUG-18