Oracle 19c DG断档恢复

一、模拟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#  LOW_SEQUENCE# HIGH_SEQUENCE#  CON_ID
---------- ------------- -------------- --------
	 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。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值