1背景
某现场数据库ADG同步中断1个月且主库归档日志未保留一个月时间。
2整体思路
将备库数据库ADG同步、监听及数据库停止,删除备库归档及数据库文件,启动备库到nomount,在主库对备库进行RMAN恢复,恢复完成后,将备库打开并开启同步
3具体步骤
1. 停止ADG备库
sqlplus / as sysdba
Shutdown immediate
2. 删除原备库数据文件、归档、redo等文件
cd /database/XXXYYY
rm -rf *
cd /database/archive/
rm -rf *
3. 启动备库到nomount状态
sqlplus / as sysdba
startup nomount;
4. 恢复数据库
rman target / auxiliary sys/XXX@XXXYYY_S
run {
allocate channel ch001 type disk;
Allocate auxiliary channel ch002 type disk;
duplicate target database for standby from active database nofilenamecheck dorecover;
release channel ch001;
release channel ch002;
}
5. 开启同步
SQL> alter database open;
Database altered.
SQL> alter database recover managed standby database using current logfile disconnect from session;
Database altered.
6. 查看备库日志应用延迟
set line 200
set pagesize 20;
column name format a13;
column value format a20;
column unit format a30;
column TIME_COMPUTED format a30;
select name,value,unit,time_computed from v$dataguard_stats where name in ('transport lag','apply lag');
四、结语
登高必自卑,行远必自迩。
目前自己处于学习阶段,如果文章有问题,请指正!