一:问题描述

主备库所在机器都重启后,rac(主库)开机自动启动,但备库(单实例)不是开机启动,现已手工启动到mount,并已在备库上alter database recover  standby database disconnect from session;。

发现主库归档日志无法同步到备库:

rac1:

 

rac2:

 

备库:

 

 

--奇怪的是,v$archive_gap竟然还为空。

查看报警日志:

 

二:解决办法

首先检查一下备库监听是否启动(当状态为‘ready’,表示已经启动)

如果监听未启动,则启动监听:lsnrctl start即可。

如果监听已经启动,则:

手工把缺的日志从主库scp/rcp拷过来,然后alter database register logfile.

三:具体步骤

比如下面是应该拷贝的日志:

+DATA/prod/1_29_856078807.arc  29      1

+DATA/prod/2_14_856078807.arc  14      2

+DATA/prod/1_30_856078807.arc  30      1

+DATA/prod/2_15_856078807.arc  15      2

+DATA/prod/2_16_856078807.arc  16      2

1:使用RMANASM设备中拷贝出来所需归档文件

run {

copy archivelog '+DATA/PROD/1_29_856078807.arc' to '/home/oracle/1_29_856078807.arc';

 

copy archivelog '+DATA/PROD/1_30_856078807.arc' to '/home/oracle/1_30_856078807.arc';

copy archivelog '+DATA/prod/2_14_856078807.arc' to '/home/oracle/2_14_856078807.arc';

copy archivelog '+DATA/prod/2_15_856078807.arc' to '/home/oracle/2_15_856078807.arc';

copy archivelog '+DATA/prod/2_16_856078807.arc' to '/home/oracle/2_16_856078807.arc';

}

 

 

 

Starting backup at 27-AUG-14

using channel ORA_DISK_1

channel ORA_DISK_1: starting archive copy

input archive log thread=1 sequence=29 recid=82 stamp=856665609

output filename=/home/oracle/1_29_856078807.arc recid=89 stamp=856669631

channel ORA_DISK_1: archivelog copy complete, elapsed time: 00:00:02

Finished backup at 27-AUG-14

……

2:在备库查看归档路径

SQL> archive log list;

Database log mode        Archive Mode

Automatic archival        Enabled

Archive destination        /arch/sdyprod

Oldest online log sequence     0

Next log sequence to archive   0

Current log sequence        0

3:在主库将未同步的归档日志拷贝到备库

[oracle@rac1 ~]$ scp 2* 192.168.8.225:/arch/sdyprod/

oracle@192.168.8.225's password: 

2_14_856078807.arc                                                                                                                                           100% 1024     1.0KB/s   00:00    

2_15_856078807.arc                                                                                                                                           100%  121KB 120.5KB/s   00:00    

2_16_856078807.arc                                                                                                                                           100%   20KB  20.0KB/s   00:00    

[oracle@rac1 ~]$ scp 1* 192.168.8.225:/arch/sdyprod/

oracle@192.168.8.225's password: 

1_29_856078807.arc                                                                                                                                           100% 5356KB   5.2MB/s   00:01    

1_30_856078807.arc                                                                                                                                           100%   12MB  11.7MB/s   00:00    

[oracle@rac1 ~]$ 

4:在备库取消日志应用

SQL> alter database recover managed standby database cancel;

Database altered.

5:注册日志文件

SQL> alter database register logfile '/arch/sdyprod/1_29_856078807.arc';

……

Database altered.

SQL> alter database register logfile '/arch/sdyprod/2_16_856078807.arc';

Database altered.

6:开始日志应用

SQL> alter database recover managed standby database disconnect from session;

Database altered.

--本篇文章参考自:http://blog.itpub.net/14507784/viewspace-759605/

如果还是无法解决,可以参考文章:http://www.xifenfei.com/1176.html

 

 

posted on 2014-08-27 15:45  雅冰石  阅读(3135)  评论(0编辑  收藏  举报