笔记:恢复ADG

说明:
adg出现故障需要重建adg时使用

记录:

源库:
备份数据库

rman target / << EOF
run                                                                                                    
{
allocate channel c1 type disk;                                                                        
allocate channel c2 type disk;  
allocate channel c3 type disk;                                                                        
allocate channel c4 type disk;                                                                         
backup AS COMPRESSED BACKUPSET database format '/ora_bak/full_%d_%T_%s_%p';                                       
sql "alter system archive log current";                                                                
backup AS COMPRESSED BACKUPSET archivelog all format '/ora_bak/arch_%d_%T_%s_%p';         
backup current controlfile format '/ora_bak/ctl_%d_%T_%s_%p';
} 

EOF

将备份拷贝至灾备库

灾备库:
启动至nomount

startup nomount

恢复控制文件

restore standby controlfile to '+DATADG/CONTROLFILE/current.306.994095609' from '/tmp/tmp_bak/ctl_20200730_9502_1';
restore standby controlfile to '+RECDG/CONTROLFILE/current.346.994095611' from '/tmp/tmp_bak/ctl_20200730_9502_1';

启动到mount

shutdown immediate;
startup nomount;
alter database mount standby database;

注册备份信息

CROSSCHECK BACKUP;
DELETE NOPROMPT EXPIRED BACKUP;

catalog start with '/tmp/tmp_bak';

恢复数据库

rman target / <<EOF
run{ 
allocate channel c1 type disk;
allocate channel c2 type disk;
allocate channel c3 type disk;       
allocate channel c4 type disk;
set newname for datafile  1 to '+DATADG';
set newname for datafile  2 to '+DATADG';
set newname for datafile  3 to '+DATADG';
set newname for datafile  4 to '+DATADG';
set newname for datafile  5 to '+DATADG';
set newname for datafile  6 to '+DATADG';
set newname for datafile  7 to '+DATADG';
set newname for datafile  8 to '+DATADG';
set newname for datafile  9 to '+DATADG';
set newname for datafile 10 to '+DATADG';	
set newname for datafile 11 to '+DATADG';
set newname for datafile 12 to '+DATADG';
set newname for datafile 13 to '+DATADG';
set newname for datafile 14 to '+DATADG';
set newname for datafile 15 to '+DATADG';
set newname for datafile 16 to '+DATADG';
set newname for datafile 17 to '+DATADG';
set newname for datafile 18 to '+DATADG';
set newname for datafile 19 to '+DATADG';
set newname for datafile 20 to '+DATADG';
set newname for datafile 21 to '+DATADG';
set newname for datafile 22 to '+DATADG';
set newname for datafile 23 to '+DATADG';
set newname for datafile 24 to '+DATADG';
set newname for datafile 25 to '+DATADG';
set newname for datafile 26 to '+DATADG';
set newname for datafile 27 to '+DATADG';
set newname for datafile 28 to '+DATADG';
set newname for tempfile 1 to  '+DATADG';
set newname for tempfile 2 to  '+DATADG';
set newname for tempfile 3 to  '+DATADG';
restore database;
switch datafile all;
switch tempfile all;
recover database;
}
EOF

恢复同步

recover managed standby database disconnect from session;

启动ADG

shutdown immediate
startup
recover managed standby database using current logfile disconnect from session;
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值