oracle DG库从磁带全库恢复



1,获取最新的控制文件
在主库执行以下命令,如果报错,换一个文件名
alter database create standby controlfile as '/home/oracle/control01.ctl';

scp /home/oracle/control01.ctl 备库ip:/home/oracle/

2,复制到备库对应位置后进行恢复
sqlplus / as sysdba
SQL> shutdown immediate
SQL> startup nomount 
SQL> exit

rman target /
RMAN> restore controlfile from '/home/oracle/control01.ctl';  ----这里的control01.ctl和上面生成的文件名对应
RMAN> sql  'alter database mount standby database';

在后台恢复
vi restore.sh

rman target / < reuse;
ALTER DATABASE ADD STANDBY LOGFILE thread 1 group 22  ('/xxx/xxxrdo_u01/xxx/stdredo22.log') size  reuse;
ALTER DATABASE ADD STANDBY LOGFILE thread 1 group 23  ('/xxx/xxxrdo_u01/xxx/stdredo23.log') size  reuse;
ALTER DATABASE ADD STANDBY LOGFILE group 21 ('/wuhcxidst0/wuhcxidst0rdo_u01/wuhcxidst0/stdredo01.log') SIZE 314572800;
ALTER DATABASE ADD STANDBY LOGFILE group 22 ('/wuhcxidst0/wuhcxidst0rdo_u01/wuhcxidst0/stdredo02.log') SIZE 314572800;
ALTER DATABASE ADD STANDBY LOGFILE group 23 ('/wuhcxidst0/wuhcxidst0rdo_u01/wuhcxidst0/stdredo03.log') SIZE 314572800;

4,在DG备库上启动同步
alter database recover managed standby database  disconnect from session;
select process,status,sequence# from v$managed_standby; 
---- 正常情况下会存在一个mrp0进程,需要追平日志
####如何判断日志是否追平####
主库查询当前最新日志序号
select SEQUENCE# from v$log where STATUS='CURRENT';
备库查看当前所需日志号(WAIT_FOR_LOG)
select STATUS,SEQUENCE# from  v$managed_standby where PROCESS='MRP0';
####以上2个查询结果一致,则已经追平####
----继续执行以下命令
alter database recover managed standby database cancel;
alter database open read only ;
alter database recover managed standby database using current logfile disconnect from session;


你可能感兴趣的:(oracle DG库从磁带全库恢复)