Restore Archivelog


run {
allocate channel ch01 type 'SBT_TAPE';
send 'NB_ORA_CLIENT=mvnowrtdb1,NB_ORA_SERV=nbu-master';
set until time "to_date('05/08/2014 17:00:00','mm/dd/yyyy hh24:mi:ss')";
recover database;
release channel ch01;
}

run {
allocate channel ch01 type 'SBT_TAPE';
send 'NB_ORA_CLIENT=commdb1,NB_ORA_SERV=nbu-master';
restore controlfile from '/c-96354931-20140508-01';
release channel ch01;
}


 bplist -C mvnowrtdb1 -t 4 -R /
 
 
 run {
allocate channel ch01 type 'SBT_TAPE';
send 'NB_ORA_CLIENT=mvnowrtdb2,NB_ORA_SERV=nbu-master';
set until time "to_date('05/08/2014 17:00:00','mm/dd/yyyy hh24:mi:ss')";
recover database;
release channel ch01;
}


run {
allocate channel ch01 type 'SBT_TAPE';
send 'NB_ORA_CLIENT=ltewrtdb1,NB_ORA_SERV=nbu-master';
restore controlfile from '/c-118138165-20140510-00';
release channel ch01;
}

 

select 'alter  rollback segment '|| substr(SEGMENT_NAME, 2, 10)|| ' shrink;'
  from dba_undo_extents where STATUS='EXPIRED'  and rownum <90 order by bytes desc;
 
 
run {
allocate channel ch00 type 'sbt_tape' parms='ENV=(NB_ORA_CLIENT=commdb1,NB_ORA_SERV=nbu-master)';
allocate channel ch01 type 'sbt_tape' parms='ENV=(NB_ORA_CLIENT=commdb2,NB_ORA_SERV=nbu-master)';
restore controlfile from '/c-96354931-20140508-01';
release channel ch01;
}

rac 两个节点开辟通道:
allocate channel ch00 type 'sbt_tape' parms='ENV=(NB_ORA_CLIENT=commdb1,NB_ORA_SERV=nbu-master)';
allocate channel ch01 type 'sbt_tape' parms='ENV=(NB_ORA_CLIENT=commdb2,NB_ORA_SERV=nbu-master)';


将数据库改为mount状态
RMAN> sql 'alter database mount';
using target database control file instead of recovery catalog
sql statement: alter database mount

目录匹配:
run {
allocate channel ch01 type 'SBT_TAPE';
send 'NB_ORA_CLIENT=commdb1,NB_ORA_SERV=nbu-master';
set newname for database to '/data01/commdb/datafile/%U.dbf';
restore database;
switch datafile all;
release channel ch01;
}

目录分别指定:
run {
allocate channel ch01 type 'SBT_TAPE';
send 'NB_ORA_CLIENT=ossoipltedb11,NB_ORA_SERV=nbu-master';
set newname for datafile 1 to '/data01/prodb1/datafile/system.dbf';
set newname for datafile 2 to '/data01/prodb1/datafile/sysaux.dbf';
set newname for datafile 3 to '/data01/prodb1/datafile/undotbs1.dbf';
set newname for datafile 4 to '/data01/prodb1/datafile/user.dbf';
set newname for datafile 5 to '/data01/prodb1/datafile/example.dbf';
set newname for datafile 6 to '/data01/prodb1/datafile/undotbs2.dbf';
set newname for datafile 7 to '/data01/prodb1/datafile/tbs_tsaip01.dbf';
set newname for datafile 8 to '/data01/prodb1/datafile/tbs_jtoip01.dbf';
set newname for datafile 9 to '/data01/prodb1/datafile/itsm_data01.dbf';
set newname for datafile 10 to '/data01/prodb1/datafile/tbs_tsaip02.dbf';
set newname for datafile 11 to '/data01/prodb1/datafile/tbs_tsaip03.dbf';
restore database;
switch datafile all;
release channel ch01;
}

 

run {
allocate channel ch01 type 'SBT_TAPE';
send 'NB_ORA_CLIENT=ltewrtdb1,NB_ORA_SERV=nbu-master';
set newname for database to '/data01/ltefrdb/dbfile/%U.dbf';
restore database;
switch datafile all;
release channel ch01;
}


run {
allocate channel ch00 type 'sbt_tape' parms='ENV=(NB_ORA_CLIENT=commdb1,NB_ORA_SERV=nbu-master)';
allocate channel ch01 type 'sbt_tape' parms='ENV=(NB_ORA_CLIENT=commdb2,NB_ORA_SERV=nbu-master)';
send 'NB_ORA_CLIENT=ltewrtdb1,NB_ORA_SERV=nbu-master';
set until time "to_date('05/08/2014 17:00:00','mm/dd/yyyy hh24:mi:ss')";
recover database;
release channel ch01;
}


run {
allocate channel ch00 type 'sbt_tape' parms='ENV=(NB_ORA_CLIENT=ltewrtdb1,NB_ORA_SERV=nbu-master)';
allocate channel ch01 type 'sbt_tape' parms='ENV=(NB_ORA_CLIENT=ltewrtdb2,NB_ORA_SERV=nbu-master)';
set until time "to_date('05/08/2014 17:00:00','mm/dd/yyyy hh24:mi:ss')";
recover database;
release channel ch01;
}


 run {
set archivelog destination to '/u03/oracle/archivelog';    该路径根据归档日志实际路径设置
 allocate channel ch00 type 'SBT_TAPE';
 send 'NB_ORA_SERV=nbu-master,NB_ORA_CLIENT=commdb2';
 restore archivelog sequence between 222 and 223;
 release channel ch00;
}


startup mount exclusive restrict force;
drop database;


run {
allocate channel ch01 type 'sbt_tape' parms='ENV=(NB_ORA_CLIENT=MGM-DB1,NB_ORA_SERV=nbu-master)';
set archivelog destination to '/home/oracle';
restore archivelog sequence 73 from tag TAG20140514T010014;
release channel ch01;
}


run {
allocate channel ch00 type 'sbt_tape' parms='ENV=(NB_ORA_CLIENT=MGM-DB1,NB_ORA_SERV=nbu-master)';
allocate channel ch01 type 'sbt_tape' parms='ENV=(NB_ORA_CLIENT=MGM-DB2,NB_ORA_SERV=nbu-master)';
set archivelog destination to '/home/oracle';
restore archivelog sequence 73 from tag TAG20140514T010014;
release channel ch00;
release channel ch01;
}


run {
allocate channel ch00 type 'sbt_tape' parms='ENV=(NB_ORA_CLIENT=mgm-db1,NB_ORA_SERV=nbu-master)';
allocate channel ch01 type 'sbt_tape' parms='ENV=(NB_ORA_CLIENT=mgm-db2,NB_ORA_SERV=nbu-master)';
set archivelog destination to '/home/oracle';
restore archivelog from  logseq 70 until logseq 74  thread 2;
release channel ch00;
release channel ch01;
}

RMAN> run {
2> allocate channel ch00 type 'sbt_tape' parms='ENV=(NB_ORA_CLIENT=mgm-db1,NB_ORA_SERV=nbu-master)';
allocate channel ch01 type 'sbt_tape' parms='ENV=(NB_ORA_CLIENT=mgm-db2,NB_ORA_SERV=nbu-master)';
crosscheck archivelog sequence 73 thread 2;
3> 4> 5> release channel ch00;
6> release channel ch01;
7> }

released channel: ORA_DISK_1
allocated channel: ch00
channel ch00: SID=3059 instance=mgmdb1 device type=SBT_TAPE
channel ch00: Veritas NetBackup for Oracle - Release 7.5 (2013112320)

allocated channel: ch01
channel ch01: SID=4541 instance=mgmdb1 device type=SBT_TAPE
channel ch01: Veritas NetBackup for Oracle - Release 7.5 (2013112320)

specification does not match any archived log in the repository

released channel: ch00

released channel: ch01

RMAN>

RMAN> list backup of archivelog sequence 73 thread 2;


List of Backup Sets
===================


BS Key  Size       Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
70      337.25M    SBT_TAPE    00:01:55     14-MAY-14     
        BP Key: 70   Status: AVAILABLE  Compressed: NO  Tag: TAG20140514T010014
        Handle: al_77_1_847501214   Media: J03088

  List of Archived Logs in backup set 70
  Thrd Seq     Low SCN    Low Time  Next SCN   Next Time
  ---- ------- ---------- --------- ---------- ---------
  2    73      2788195815 13-MAY-14 2795106522 14-MAY-14


RMAN> run {
2> allocate channel ch00 type 'sbt_tape' parms='ENV=(NB_ORA_CLIENT=mgm-db1,NB_ORA_SERV=nbu-master)';
3> allocate channel ch01 type 'sbt_tape' parms='ENV=(NB_ORA_CLIENT=mgm-db2,NB_ORA_SERV=nbu-master)';
4> set archivelog destination to '/home/oracle';
5> restore archivelog from  logseq 70 until logseq 74  thread 2;
6> release channel ch00;
7> release channel ch01;
8> }

allocated channel: ch00
channel ch00: SID=63 instance=mgmdb1 device type=SBT_TAPE
channel ch00: Veritas NetBackup for Oracle - Release 7.5 (2013112320)

allocated channel: ch01
channel ch01: SID=13 instance=mgmdb1 device type=SBT_TAPE
channel ch01: Veritas NetBackup for Oracle - Release 7.5 (2013112320)

executing command: SET ARCHIVELOG DESTINATION

Starting restore at 14-MAY-14

channel ch00: starting archived log restore to user-specified destination
archived log destination=/home/oracle
channel ch00: restoring archived log
archived log thread=2 sequence=73
channel ch00: reading from backup piece al_77_1_847501214
channel ch01: starting archived log restore to user-specified destination
archived log destination=/home/oracle
channel ch01: restoring archived log
archived log thread=2 sequence=70
channel ch01: reading from backup piece al_74_1_847414815
channel ch00: ORA-19870: error while restoring backup piece al_77_1_847501214
ORA-19507: failed to retrieve sequential file, handle="al_77_1_847501214", parms=""
ORA-27029: skgfrtrv: sbtrestore returned error
ORA-19511: Error received from media manager layer, error text:
   Failed to open backup file for restore.

channel ch00: starting archived log restore to user-specified destination
archived log destination=/home/oracle
channel ch00: restoring archived log
archived log thread=2 sequence=74
channel ch00: reading from backup piece al_78_1_847501350
channel ch01: ORA-19870: error while restoring backup piece al_74_1_847414815
ORA-19507: failed to retrieve sequential file, handle="al_74_1_847414815", parms=""
ORA-27029: skgfrtrv: sbtrestore returned error
ORA-19511: Error received from media manager layer, error text:
   Failed to open backup file for restore.

channel ch01: starting archived log restore to user-specified destination
archived log destination=/home/oracle
channel ch01: restoring archived log
archived log thread=2 sequence=71
channel ch01: restoring archived log
archived log thread=2 sequence=72
channel ch01: reading from backup piece al_75_1_847414937
channel ch00: ORA-19870: error while restoring backup piece al_78_1_847501350
ORA-19507: failed to retrieve sequential file, handle="al_78_1_847501350", parms=""
ORA-27029: skgfrtrv: sbtrestore returned error
ORA-19511: Error received from media manager layer, error text:
   Failed to open backup file for restore.

channel ch01: ORA-19870: error while restoring backup piece al_75_1_847414937
ORA-19507: failed to retrieve sequential file, handle="al_75_1_847414937", parms=""
ORA-27029: skgfrtrv: sbtrestore returned error
ORA-19511: Error received from media manager layer, error text:
   Failed to open backup file for restore.

failover to previous backup

released channel: ch00
released channel: ch01
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 05/14/2014 11:02:26
RMAN-06026: some targets not found - aborting restore
RMAN-06025: no backup of archived log for thread 2 with sequence 74 and starting SCN of 2795106522 found to restore
RMAN-06025: no backup of archived log for thread 2 with sequence 73 and starting SCN of 2788195815 found to restore
RMAN-06025: no backup of archived log for thread 2 with sequence 72 and starting SCN of 2788146915 found to restore
RMAN-06025: no backup of archived log for thread 2 with sequence 71 and starting SCN of 2788143828 found to restore
RMAN-06025: no backup of archived log for thread 2 with sequence 70 and starting SCN of 2780540605 found to restore


RMAN> run {
2> allocate channel ch00 type 'sbt_tape' parms='ENV=(NB_ORA_CLIENT=ltewrtdb1,NB_ORA_SERV=nbu-master)';
3> allocate channel ch01 type 'sbt_tape' parms='ENV=(NB_ORA_CLIENT=ltewrtdb2,NB_ORA_SERV=nbu-master)';
4> set archivelog destination to '/home/oracle';
5> restore archivelog from  logseq 70 until logseq 74  thread 2;
6> release channel ch00;
7> release channel ch01;
8> }

allocated channel: ch00
channel ch00: SID=121 device type=SBT_TAPE
channel ch00: Veritas NetBackup for Oracle - Release 7.5 (2013112320)

allocated channel: ch01
channel ch01: SID=125 device type=SBT_TAPE
channel ch01: Veritas NetBackup for Oracle - Release 7.5 (2013112320)

executing command: SET ARCHIVELOG DESTINATION

Starting restore at 14-MAY-14

archived log for thread 2 with sequence 70 is already on disk as file /data01/mgmdb/arch/2_70_839452241.dbf
archived log for thread 2 with sequence 71 is already on disk as file /data01/mgmdb/arch/2_71_839452241.dbf
archived log for thread 2 with sequence 72 is already on disk as file /data01/mgmdb/arch/2_72_839452241.dbf
restore not done; all files read only, offline, or already restored
Finished restore at 14-MAY-14

released channel: ch00

released channel: ch01

================================================================================================
restore archivelog:
***********************************************************************************************
1 restore 70~74:
run {
allocate channel ch00 type 'sbt_tape' parms='ENV=(NB_ORA_CLIENT=ltewrtdb1,NB_ORA_SERV=nbu-master)';
allocate channel ch01 type 'sbt_tape' parms='ENV=(NB_ORA_CLIENT=ltewrtdb2,NB_ORA_SERV=nbu-master)';
set archivelog destination to '/home/oracle';
restore archivelog from  logseq 70 until logseq 74  thread 2;
release channel ch00;
release channel ch01;
}

run
{
allocate channel ch01 type 'SBT_TAPE';
send 'NB_ORA_CLIENT=MGM-DB1,NB_ORA_SERV=nbu-master';
set archivelog destination to '/home/oracle';
restore archivelog from logseq 181 until logseq 182 thread 1;
release channel ch01;
}

2 restore  one arch:
run
{
allocate channel ch01 type 'SBT_TAPE';
send 'NB_ORA_CLIENT=MGM-DB1,NB_ORA_SERV=nbu-master';
restore archivelog sequence 180 thread 1;
release channel ch01;
}

3 restore from tag:
run {
allocate channel ch01 type 'sbt_tape' parms='ENV=(NB_ORA_CLIENT=MGM-DB1,NB_ORA_SERV=nbu-master)';
set archivelog destination to '/home/oracle';
restore archivelog sequence 73 from tag ‘TAG20140514T010014’;--?
release channel ch01;
}

run {
allocate channel ch00 type 'sbt_tape' parms='ENV=(NB_ORA_CLIENT=MGM-DB1,NB_ORA_SERV=nbu-master)';
allocate channel ch01 type 'sbt_tape' parms='ENV=(NB_ORA_CLIENT=MGM-DB2,NB_ORA_SERV=nbu-master)';
set archivelog destination to '/home/oracle';
restore archivelog sequence 73 from tag TAG20140514T010014;
release channel ch00;
release channel ch01;
}


run {
allocate channel ch00 type 'sbt_tape' parms='ENV=(NB_ORA_CLIENT=mgm-db1,NB_ORA_SERV=nbu-master)';
allocate channel ch01 type 'sbt_tape' parms='ENV=(NB_ORA_CLIENT=mgm-db2,NB_ORA_SERV=nbu-master)';
set archivelog destination to '/home/oracle';
restore archivelog from  logseq 70 until logseq 74  thread 2;
release channel ch00;
release channel ch01;
}

4 restore archivelog between:
run {
allocate channel ch00 type 'sbt_tape' parms='ENV=(NB_ORA_CLIENT=MGM-DB1,NB_ORA_SERV=nbu-master)';
allocate channel ch01 type 'sbt_tape' parms='ENV=(NB_ORA_CLIENT=MGM-DB2,NB_ORA_SERV=nbu-master)';
set archivelog destination to '/home/oracle';
restore archivelog sequence sequence between 1 and 3 thread1;
release channel ch00;
release channel ch01;
}

5 restore archivelog until:
run {
allocate channel ch00 type 'sbt_tape' parms='ENV=(NB_ORA_CLIENT=MGM-DB1,NB_ORA_SERV=nbu-master)';
allocate channel ch01 type 'sbt_tape' parms='ENV=(NB_ORA_CLIENT=MGM-DB2,NB_ORA_SERV=nbu-master)';
set archivelog destination to '/home/oracle';
restore archivelog  until logseq 74  thread 2;
release channel ch00;
release channel ch01;
}

6 restore archivelog from:

run {
allocate channel ch00 type 'sbt_tape' parms='ENV=(NB_ORA_CLIENT=MGM-DB1,NB_ORA_SERV=nbu-master)';
allocate channel ch01 type 'sbt_tape' parms='ENV=(NB_ORA_CLIENT=MGM-DB2,NB_ORA_SERV=nbu-master)';
set archivelog destination to '/home/oracle';
restore archivelog from  logseq 74  thread 2;
release channel ch00;
release channel ch01;
}

7 restore archivelog from sysdate:
run {
allocate channel ch00 type 'sbt_tape' parms='ENV=(NB_ORA_CLIENT=MGM-DB1,NB_ORA_SERV=nbu-master)';
allocate channel ch01 type 'sbt_tape' parms='ENV=(NB_ORA_CLIENT=MGM-DB2,NB_ORA_SERV=nbu-master)';
set archivelog destination to '/home/oracle';
restore archivelog from time 'sysdate-7';
release channel ch00;
release channel ch01;
}

8 restore archivelog from one:
run {
allocate channel ch00 type 'sbt_tape' parms='ENV=(NB_ORA_CLIENT=MGM-DB1,NB_ORA_SERV=nbu-master)';
allocate channel ch01 type 'sbt_tape' parms='ENV=(NB_ORA_CLIENT=MGM-DB2,NB_ORA_SERV=nbu-master)';
set archivelog destination to '/home/oracle';
restore archivelog low logseq 80;
release channel ch00;
release channel ch01;
}

9 restore archivelog to one:
run {
allocate channel ch00 type 'sbt_tape' parms='ENV=(NB_ORA_CLIENT=MGM-DB1,NB_ORA_SERV=nbu-master)';
allocate channel ch01 type 'sbt_tape' parms='ENV=(NB_ORA_CLIENT=MGM-DB2,NB_ORA_SERV=nbu-master)';
set archivelog destination to '/home/oracle';
restore archivelog high  logseq 80;
release channel ch00;
release channel ch01;
}
http://docs.oracle.com/cd/B19306_01/backup.102/b14194/rcmsynta008.htm
***********************************************************************************
check archivelog
****************************************************************************************
 run {
2> allocate channel ch00 type 'sbt_tape' parms='ENV=(NB_ORA_CLIENT=mgm-db1,NB_ORA_SERV=nbu-master)';
allocate channel ch01 type 'sbt_tape' parms='ENV=(NB_ORA_CLIENT=mgm-db2,NB_ORA_SERV=nbu-master)';
crosscheck archivelog sequence 73 thread 2;
3> 4> 5> release channel ch00;
6> release channel ch01;
7> }

released channel: ORA_DISK_1
allocated channel: ch00
channel ch00: SID=3059 instance=mgmdb1 device type=SBT_TAPE
channel ch00: Veritas NetBackup for Oracle - Release 7.5 (2013112320)

allocated channel: ch01
channel ch01: SID=4541 instance=mgmdb1 device type=SBT_TAPE
channel ch01: Veritas NetBackup for Oracle - Release 7.5 (2013112320)

specification does not match any archived log in the repository

released channel: ch00

released channel: ch01

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/13750068/viewspace-1161063/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/13750068/viewspace-1161063/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值