declare
devtype varchar2(256);
done boolean;
begin
devtype:=sys.dbms_backup_restore.deviceAllocate(type=>'',ident=>'t1');
sys.dbms_backup_restore.restoreSetArchivedLog(destination=>'/data/oracle');
sys.dbms_backup_restore.restoreArchivedLog(thread=>1,sequence=>1859);
sys.dbms_backup_restore.restoreBackupPiece(done=>done,handle=>'/data/oracle/orcl/arc_ORCL_gus0emff_1_1_20170330_4638',params=>null);
sys.dbms_backup_restore.deviceDeallocate;
end;
意我们修改的地方是:destination=>'/archivelog02指定恢复出来归档日志的存放系统目录位置,thread表示rac的thread号,sequence为需要恢复的那个归档日志序列号,handle表示备份集的绝对路径。 修改完毕后,直接在sqlplus命令窗口执行即可。
--这是rman中还记录归档日志的信息
RMAN> run {
2> set archivelog destination to '/data/oracle';
3> restore archivelog sequence 1868;
4> }
executing command: SET ARCHIVELOG DESTINATION
Starting restore at 31-MAR-17
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
using channel ORA_DISK_4
archived log for thread 1 with sequence 1868 is already on disk as file /data/oracle/orcl/arch/1_1868_930687580.dbf
restore not done; all files read only, offline, or already restored
Finished restore at 31-MAR-17
RMAN> run {
2> set archivelog destination to '/data/oracle';
3> restore archivelog sequence 1868;
4> }
executing command: SET ARCHIVELOG DESTINATION
Starting restore at 31-MAR-17
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
using channel ORA_DISK_4
channel ORA_DISK_1: starting archived log restore to user-specified destination
archived log destination=/data/oracle
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=1868
channel ORA_DISK_1: reading from backup piece /data/oracle/orcl/arc_h6s0h0f3_1_1
channel ORA_DISK_1: piece handle=/data/oracle/orcl/arc_h6s0h0f3_1_1 tag=TAG20170331T134708
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
Finished restore at 31-MAR-17
RMAN>