一、模拟dg断档
1.1 备端关闭日志应用和数据库 ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL; shutdown immediate
1.2 主端多次切换归档 alter system switch logfile;
1.3 主端删除最近的归档日志 rm -rf thread_2_seq_65.424.1098461429 rm -rf thread_2_seq_66.425.1098461449
1.4 备端开启同步进程 ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION;
1.5 备端检查断档
SQL> SELECT * FROM V$ARCHIVE_GAP;
THREAD
2 65 66 1
可以看到丢了线程2的65和66两个归档日志。
二、断档恢复
2.1 备库关闭日志应用 ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
2.2 断档恢复 RMAN> RECOVER STANDBY DATABASE FROM SERVICE orcl;
Starting recover at 04-MAR-22 using target database control file instead of recovery catalog Oracle instance started
Total System Global Area 1828712616 bytes
Fixed Size 9138344 bytes Variable Size 469762048 bytes Database Buffers 1342177280 bytes Redo Buffers 7634944 bytes
contents of Memory Script: { restore standby controlfile from service ‘orcl’; alter database mount standby database; } executing Memory Script
Starting restore at 04-MAR-22 allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=4 device type=DISK
channel ORA_DISK_1: starting datafile backup set restore channel ORA_DISK_1: using network backup set from service orcl channel ORA_DISK_1: restoring control file channel ORA_DISK_1: restore complete, elapsed time: 00:00:07 output file name=/data/controlfile/current01.ctl Finished restore at 04-MAR-22
released channel: ORA_DISK_1 Statement processed Executing: alter system set standby_file_management=manual
contents of Memory Script: { recover database from service ‘orcl’; } executing Memory Script
Starting recover at 04-MAR-22 allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=1162 device type=DISK skipping datafile 5; already restored to SCN 15154323 skipping datafile 6; already restored to SCN 15154323 skipping datafile 8; already restored to SCN 15154323 skipping datafile 10; already restored to SCN 16682725 skipping datafile 11; already restored to SCN 16682725 skipping datafile 12; already restored to SCN 16682725 skipping datafile 13; already restored to SCN 16682725 skipping datafile 14; already restored to SCN 16682725 skipping datafile 40; already restored to SCN 16682725 channel ORA_DISK_1: starting incremental datafile backup set restore channel ORA_DISK_1: using network backup set from service orcl destination for restore of datafile 00001: /data/datafile/system.278.1093269883 channel ORA_DISK_1: restore complete, elapsed time: 00:00:27 channel ORA_DISK_1: starting incremental datafile backup set restore channel ORA_DISK_1: using network backup set from service orcl destination for restore of datafile 00003: /data/datafile/sysaux.279.1093269935 channel ORA_DISK_1: restore complete, elapsed time: 00:00:25 channel ORA_DISK_1: starting incremental datafile backup set restore channel ORA_DISK_1: using network backup set from service orcl destination for restore of datafile 00004: /data/datafile/undotbs1.280.1093269971 channel ORA_DISK_1: restore complete, elapsed time: 00:00:02 channel ORA_DISK_1: starting incremental datafile backup set restore channel ORA_DISK_1: using network backup set from service orcl destination for restore of datafile 00007: /data/datafile/users.281.1093269975 channel ORA_DISK_1: restore complete, elapsed time: 00:00:01 channel ORA_DISK_1: starting incremental datafile backup set restore channel ORA_DISK_1: using network backup set from service orcl destination for restore of datafile 00009: /data/datafile/undotbs2.291.1093271573 channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
starting media recovery
media recovery complete, elapsed time: 00:00:00 Finished recover at 04-MAR-22 Executing: alter system set standby_file_management=auto Finished recover at 04-MAR-22
恢复完成后,备库处于mount状态,需要启动到read only。
|