oracle dataguard 日志 很多no,Oracle DataGuard归档日志丢失处理方法

本文介绍了一种通过增量SCN备份和恢复的方法来修复Oracle备库中丢失的归档日志,包括备份控制文件、数据文件的恢复及数据库的重启步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

问题描述

9.3日dg备库异常关闭,9.17日主库磁盘空间满,删除了归档日志,导致备库丢失了9.3号到9.17号得归档日志,所以当9.24日启动备库时报错

ORA-10458: standby database requires recovery

ORA-01196: file 1 is inconsistent due to a failed media recovery session

ORA-01110: data file 1: '/u01/oracle/oradata/system/system01.dbf'

解决办法:

1、在主库备份控制文件

backup current controlfile for standby format '/archivelog/0924_ctl_%U.bka'

2、已备库得最大SCN号在主库备份

在备库上执行

select name,to_char(checkpoint_change#) from v$datafile order by checkpoint_change#;

NAME                                                        TO_CHAR(CHECKPOINT_CHANGE#)

----------------------------------------------------------------------------------------------------------------

/u01/app/oracle/oradata/TBSP_STAT_DATA_202009_01.dbf

446416908432

3、在主库上执行备份语句

rman target /

run

{

allocate channel c1 device type disk;

allocate channel c2 device type disk;

allocate channel c3 device type disk;

allocate channel c4 device type disk;

allocate channel c5 device type disk;

backup as compressed backupset incremental from scn 446416908432 database format '/archivelog/0924_%U.bka' tag 'forstandby';

release channel c1;

release channel c2;

release channel c3;

release channel c4;

release channel c5;

}

4、把生成得备份文件都传到备库上

scp 0924* x.x.x.x:/tmp/

5、

这时候我们需要关闭备库,然把把实例启动到nomount关态

STANDBY> shutdown immediate;

ORA-01109: database not open

Database dismounted.

ORACLE instance shut down.

STANDBY> startup nomount;

ORACLE instance started.

Total System Global Area 1224736768 bytes

Fixed Size   2923824 bytes

Variable Size 939524816 bytes

Database Buffers 268435456 bytes

Redo Buffers  13852672 bytes

6、在备库上执行restore,先恢复控制文件,在恢复数据文件

rman target / nocatalog

RMAN> restore standby controlfile from '/tmp/0924_ctl_0rr22q7u_1_1.dbf';

Starting restore at 03-APR-16

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=23 device type=DISK

............................................

很快控制文件就了恢复完成了,我们打开另一个窗口,通过sqlplus把备库以standby的方式mount起来

STANDBY> alter database mount;

恢复数据文件

先注册一下备份文件

rman> catalog start with '/tmp';

开始恢复

run

{

allocate channel c1 device type disk;

allocate channel c2 device type disk;

allocate channel c3 device type disk;

allocate channel c4 device type disk;

allocate channel c5 device type disk;

recover database;

release channel c1;

release channel c2;

release channel c3;

release channel c4;

release channel c5;

}

7、启动备库同步

SQL> alter database open read only;

Database altered.

SQL> alter database recover managed standby database disconnect from session using current logfile;

Database altered.

select process,client_process,sequence#,status from v$managed_standby;

PROCESS   CLIENT_P  SEQUENCE# STATUS

--------- -------- ---------- ------------

RFS       ARCH              0 IDLE

RFS       UNKNOWN           0 IDLE

RFS       UNKNOWN           0 IDLE

PROCESS   CLIENT_P  SEQUENCE# STATUS

--------- -------- ---------- ------------

RFS       LGWR          71162 IDLE

MRP0      N/A           71158 APPLYING_LOG

现在我们查看备库状态,MRP进程已经开始最新的日志应用了.到此我们通过增量SCN备份和恢复来修复

备库归档日志丢失的过程已经全部完成了.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值