码迷,mamicode.com
首页 > 数据库 > 详细

NBU 还原windows ORACLE数据库(BW)

时间:2017-08-06 10:36:44      阅读:387      评论:0      收藏:0      [点我收藏+]

标签:lines   size   文件   res   还原归档日志   to_date   str   归档   sequence   

将0.92数据库还原到1.92,还原时间7月13日

1.查询所需要的控制日志

bplist -C bw-prd01 -s 2017-7-2 -e 2017-7-15 -k oracle_bw-prd01_0_92_arch -t 4 -R -b -l  / |findstr "cnt"

技术分享

(第2、3步可并行)

2.开始还原控制文件

进入rman,数据库起到nomount利用备份文件进行控制文件还原

rman target /
startup nomount
run{
 allocate channel ch00 type SBT_TAPE;
 send nb_ora_serv=nbumaster01;
 send nb_ora_client= bw-prd01;
 restore controlfile from cntrl_1705_1_949284511;
 release channel ch00;
}

3.还原数据文件(开到mount状态)

alter database mount;

run{
 allocate channel ch00 type SBT_TAPE;
 allocate channel ch01 type SBT_TAPE;
 send nb_ora_serv=nbumaster01;
 send nb_ora_client=bw-prd01;
set newname for datafile 1 to E:\ERPORACLE\DATAFILE\SYSTEM.DATA1;
set newname for datafile 2 to E:\ERPORACLE\DATAFILE\SYSAUX.DATA1;
set newname for datafile 3 to E:\ERPORACLE\DATAFILE\UNDO.DATA1;
set newname for datafile 4 to E:\ERPORACLE\DATAFILE\SR3.DATA1;
set newname for datafile 5 to E:\ERPORACLE\DATAFILE\SR3.DATA2;
set newname for datafile 6 to E:\ERPORACLE\DATAFILE\SR3740.DATA1;
set newname for datafile 7 to E:\ERPORACLE\DATAFILE\SR3USR.DATA1;
set newname for datafile 8 to E:\ERPORACLE\DATAFILE\SR740.DATA1;
set newname for datafile 9 to E:\ERPORACLE\DATAFILE\SR3.DATA3;
set newname for datafile 10 to E:\ERPORACLE\DATAFILE\SR3.DATA4;
set newname for datafile 11 to E:\ERPORACLE\DATAFILE\SR3.DATA5;
set newname for datafile 12 to E:\ERPORACLE\DATAFILE\SR3.DATA6;
set newname for datafile 13 to E:\ERPORACLE\DATAFILE\SR3.DATA7;
set newname for datafile 14 to E:\ERPORACLE\DATAFILE\SR3740.DATA2;
set newname for datafile 15 to E:\ERPORACLE\DATAFILE\SR3740.DATA3;
set newname for datafile 16 to E:\ERPORACLE\DATAFILE\SR3740.DATA4;
set newname for datafile 17 to E:\ERPORACLE\DATAFILE\SR3740.DATA5;
set newname for datafile 18 to E:\ERPORACLE\DATAFILE\SR3740.DATA6;
set newname for datafile 19 to E:\ERPORACLE\DATAFILE\SR3.DATA8;
set newname for datafile 20 to E:\ERPORACLE\DATAFILE\SR3.DATA9;
set newname for datafile 21 to E:\ERPORACLE\DATAFILE\SR3.DATA10;
set newname for datafile 22 to E:\ERPORACLE\DATAFILE\SR3.DATA11;
set newname for datafile 23 to E:\ERPORACLE\DATAFILE\SR3.DATA12;
set newname for datafile 24 to E:\ERPORACLE\DATAFILE\SR3.DATA13;
set newname for datafile 25 to E:\ERPORACLE\DATAFILE\SR3.DATA14;
set newname for datafile 26 to E:\ERPORACLE\DATAFILE\SR3.DATA15;
set newname for datafile 27 to E:\ERPORACLE\DATAFILE\SR3.DATA16;
set newname for datafile 28 to E:\ERPORACLE\DATAFILE\SR3.DATA17;
set newname for datafile 29 to E:\ERPORACLE\DATAFILE\SR3.DATA18;
set newname for datafile 30 to E:\ERPORACLE\DATAFILE\SR3.DATA19;
set newname for datafile 31 to E:\ERPORACLE\DATAFILE\SR3.DATA20;
set newname for datafile 32 to E:\ERPORACLE\DATAFILE\SR3.DATA21;
set newname for datafile 33 to E:\ERPORACLE\DATAFILE\SR3.DATA22;
set newname for datafile 34 to E:\ERPORACLE\DATAFILE\SR3.DATA23;
set newname for datafile 35 to E:\ERPORACLE\DATAFILE\SR3.DATA24;
set newname for datafile 36 to E:\ERPORACLE\DATAFILE\SR3.DATA25;
set newname for datafile 37 to E:\ERPORACLE\DATAFILE\SR3.DATA26;
set newname for datafile 38 to E:\ERPORACLE\DATAFILE\SR3.DATA27;
set newname for datafile 39 to E:\ERPORACLE\DATAFILE\SR3.DATA28;
set newname for datafile 40 to E:\ERPORACLE\DATAFILE\SR3.DATA29;
set newname for datafile 41 to E:\ERPORACLE\DATAFILE\SR3.DATA30;
set newname for tempfile 1 to E:\ERPORACLE\DATAFILE\TEMP.DATA1;
set newname for tempfile 2 to E:\ERPORACLE\DATAFILE\TEMP.DATA2;
 restore  database
 until time "to_date(‘2017/07/13‘,‘yyyy/mm/dd‘)";
SWITCH DATAFILE ALL;
SWITCH TEMPFILE ALL;
 release channel ch00;
 release channel ch01;
}

技术分享技术分享

可直接运行第5步看缺少哪些归档日志

4.查询SEQUENCE号,还原归档日志

sqlplus / as sysdba

alter session set nls_date_format=YYYYMMDD HH24:MI:SS; 
set linesize 160;
set pagesize;

select THREAD#,SEQUENCE#,FIRST_TIME,COMPLETION_TIME from v$archived_log 
where --SEQUENCE# IN(63145);
COMPLETION_TIME>to_date(20170713 09:00:00,yyyymmdd hh24:mi:ss) 
and    COMPLETION_TIME<to_date(20170713 11:00:00,yyyymmdd hh24:mi:ss)
order by SEQUENCE#;

--还原归档日志 rman target
/ run{ allocate channel ch0 type SBT_TAPE; allocate channel ch1 type SBT_TAPE; send NB_ORA_CLIENT=bw-prd01; send nb_ora_serv=nbumaster01; restore archivelog sequence between 63430 and 65699; release channel ch0; release channel ch1; }

5.恢复数据库

run{
allocate channel ch0 type SBT_TAPE;
allocate channel ch1 type SBT_TAPE;
send NB_ORA_CLIENT=bw-prd01;
send nb_ora_serv=nbumaster01;
recover database;
release channel ch0;
release channel ch1;
}


sqlplus / as sysdba
alter database open resetlogs;

OR

sqlplus / as sysdba
alter session set nls_date_format=YYYY/MM/DD HH24:MI:SS;
recover database until time 2017/07/13 10:00:00 using backup controlfile;
alter database open resetlogs;

 技术分享

NBU 还原windows ORACLE数据库(BW)

标签:lines   size   文件   res   还原归档日志   to_date   str   归档   sequence   

原文地址:http://www.cnblogs.com/Snowfun/p/7293738.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!