Logon database Tiger引起DataGuard不同步问题

当DataGuard升级CPU后,发现主备库不能同步了,日志报错,所以在主库的执行的升级的后脚本“@catbundle.sql cpu apply”不能同步到备库

 

 

现象:

broker状态:

[oracle@webdb2 ~]$ dgmgrl sys/oracle

DGMGRL for Linux: Version 11.2.0.3.0 -64bit Production

 

Copyright (c) 2000, 2009, Oracle. Allrights reserved.

 

欢迎使用 DGMGRL, 要获取有关信息请键入 "help"。

已连接。

DGMGRL> show configuration

 

配置 - webdb

 

  保护模式:        MaxAvailability

  数据库:

   webdb  - 主数据库

   webdb2 - 物理备用数据库

 

快速启动故障转移: DISABLED

 

配置状态:

ORA-16664: 无法从数据库接收结果

DGM-17017: 无法确定配置状态

 

 

--查看主库状态:

SQL> Select timestamp, message FROMV$DATAGUARD_STATUS Where Rownum < 5;

 

TIMESTAMP  MESSAGE

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

2014-10-23 Error 604 received logging on to the standby

2014-10-23  PING[ARC2]: Heartbeat failed to connect tostandby'(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=webdb2)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=webdb2)(SERVER=DEDICATED)))'.Error is 604.

2014-10-23 Error 604 received logging on to the standby

2014-10-23 PING[ARC2]: Heartbeat failed to connect to standby'(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=webdb2)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=webdb2)(SERVER=DEDICATED)))'.Error is 604.

 

 

--此时查看日志

 

主库日志:

ORA-00604: 递归 SQL 级别 1 出现错误

ORA-20154: TNS: 监听程序当前无法识别连接描述符中请求的服务

ORA-06512: 在 line 29

Thu Oct 23 00:25:52 2014

Errors in file/u01/app/ora11g/diag/rdbms/webdb/webdb/trace/webdb_ora_18833.trc:

ORA-00604: 递归 SQL 级别 1 出现错误

ORA-20154: TNS: 监听程序当前无法识别连接描述符中请求的服务

ORA-06512: 在 line 29

Thu Oct 23 00:25:52 2014

Errors in file/u01/app/ora11g/diag/rdbms/webdb/webdb/trace/webdb_ora_18842.trc:

ORA-00604: 递归 SQL 级别 1 出现错误

ORA-20154: TNS: 监听程序当前无法识别连接描述符中请求的服务

ORA-06512: 在 line 29

Thu Oct 23 00:25:53 2014

Error 604 receivedlogging on to the standby

PING[ARC2]: Heartbeatfailed to connect to standby'(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=webdb2)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=webdb2)(SERVER=DEDICATED)))'.Error is 604.

Thu Oct 23 00:26:12 2014

Errors in file /u01/app/ora11g/diag/rdbms/webdb/webdb/trace/webdb_ora_18961.trc:

ORA-00604: 递归 SQL 级别 1 出现错误

ORA-20154: TNS: 监听程序当前无法识别连接描述符中请求的服务

ORA-06512: 在 line 29

 

备库日志:

ORA-00604: 递归 SQL 级别 1 出现错误

ORA-16000: 打开数据库以进行只读访问

ORA-06512: 在 line 3

Thu Oct 23 00:27:39 2014

Errors in file /u01/app/ora11g/diag/rdbms/webdb2/webdb2/trace/webdb2_ora_30130.trc:

ORA-00604: 递归 SQL 级别 1 出现错误

ORA-20154: TNS: 监听程序当前无法识别连接描述符中请求的服务

ORA-06512: 在 line 29

Errors in file/u01/app/ora11g/diag/rdbms/webdb2/webdb2/trace/webdb2_ora_30130.trc:

ORA-00604: 递归 SQL 级别 1 出现错误

ORA-16000: 打开数据库以进行只读访问

ORA-06512: 在 line 3

 

--进一步查看trace文件

主库trace:

[oracle@webdb1 trace]$ more/u01/app/ora11g/diag/rdbms/webdb/webdb/trace/webdb_ora_8589.trc

Trace file/u01/app/ora11g/diag/rdbms/webdb/webdb/trace/webdb_ora_8589.trc

Oracle Database 11g Enterprise EditionRelease 11.2.0.3.0 - 64bit Production

With the Partitioning, Automatic StorageManagement, OLAP, Data Mining

and Real Application Testing options

ORACLE_HOME =/u01/app/ora11g/product/11.2.0/db_1

System name:    Linux

Node name:      webdb1

Release:        2.6.32-200.13.1.el5uek

Version:        #1 SMP Wed Jul 27 21:02:33 EDT 2011

Machine:        x86_64

Instance name: webdb

Redo thread mounted by this instance: 1

Oracle process number: 176

Unix process pid: 8589, image:oracle@webdb1

 

 

*** 2014-10-14 13:19:18.860

*** SESSION ID:(21.12621) 2014-10-1413:19:18.860

*** CLIENT ID:() 2014-10-14 13:19:18.860

*** SERVICE NAME:(SYS$USERS) 2014-10-1413:19:18.860

*** MODULE NAME:(emagent@webdb1 (TNSV1-V3)) 2014-10-14 13:19:18.860

*** ACTION NAME:() 2014-10-14 13:19:18.860

 

Error in executing triggers on connectinternal

*** 2014-10-14 13:19:18.861

dbkedDefDump(): Starting a non-incidentdiagnostic dump (flags=0x0, level=0, mask=0x0)

----- Error Stack Dump -----

ORA-00604: 递归 SQL 级别 1 出现错误

ORA-20154: TNS: 监听程序当前无法识别连接描述符中请求的服务

ORA-06512: 在 line 28

Trace file/u01/app/ora11g/diag/rdbms/webdb/webdb/trace/webdb_ora_8589.trc

Oracle Database 11g Enterprise EditionRelease 11.2.0.3.0 - 64bit Production

With the Partitioning, Automatic StorageManagement, OLAP, Data Mining

and Real Application Testing options

ORACLE_HOME =/u01/app/ora11g/product/11.2.0/db_1

System name:    Linux

Node name:      webdb1

Release:        2.6.32-200.13.1.el5uek

Version:        #1 SMP Wed Jul 27 21:02:33 EDT 2011

Machine:        x86_64

Instance name: webdb

Redo thread mounted by this instance: 1

Oracle process number: 163

Unix process pid: 8589, image:oracle@webdb1

 

备库trace:

[oracle@webdb2 trace]$ more/u01/app/ora11g/diag/rdbms/webdb2/webdb2/trace/webdb2_ora_29791.trc

Trace file/u01/app/ora11g/diag/rdbms/webdb2/webdb2/trace/webdb2_ora_29791.trc

Oracle Database 11g Enterprise EditionRelease 11.2.0.3.0 - 64bit Production

With the Partitioning, Automatic StorageManagement, OLAP, Data Mining

and Real Application Testing options

ORACLE_HOME =/u01/app/ora11g/product/11.2.0/db_1

System name:    Linux

Node name:      webdb2

Release:        2.6.32-200.13.1.el5uek

Version:        #1 SMP Wed Jul 27 21:02:33 EDT 2011

Machine:        x86_64

Instance name: webdb2

Redo thread mounted by this instance: 1

Oracle process number: 22

Unix process pid: 29791, image:oracle@webdb2

 

 

*** 2014-10-23 11:30:21.649

*** SESSION ID:(854.10603) 2014-10-2311:30:21.649

*** CLIENT ID:() 2014-10-23 11:30:21.649

*** SERVICE NAME:(SYS$USERS) 2014-10-2311:30:21.649

*** MODULE NAME:(emagent@webdb2 (TNSV1-V3)) 2014-10-23 11:30:21.649

*** ACTION NAME:() 2014-10-23 11:30:21.649

 

Error in executing triggers on connectinternal

*** 2014-10-23 11:30:21.649

dbkedDefDump(): Starting a non-incidentdiagnostic dump (flags=0x0, level=0, mask=0x0)

----- Error Stack Dump -----

ORA-00604: 递归 SQL 级别 1 出现错误

ORA-20154: TNS: 监听程序当前无法识别连接描述符中请求的服务

ORA-06512: 在 line 29

Error in executing triggers on connectinternal

*** 2014-10-23 11:30:21.650

dbkedDefDump(): Starting a non-incidentdiagnostic dump (flags=0x0, level=0, mask=0x0)

----- Error Stack Dump -----

ORA-00604: 递归 SQL 级别 1 出现错误

ORA-16000: 打开数据库以进行只读访问

ORA-06512: 在 line 3

 

 

 

分析:

可以从看到trace log中看到都与tiger执行有关,于是想到在主库是创建过的两个 logon on database tiger

 

 

 

解决办法:

 

--禁用登录tiger

把一个登录IP限制的tiger的禁用后,主库的

ORA-00604: 递归 SQL 级别 1 出现错误

ORA-20154: TNS: 监听程序当前无法识别连接描述符中请求的服务

报错消失,只剩下下面的报错:

Error 604 received logging on to thestandby

PING[ARC2]: Heartbeat failed to connect tostandby'(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=webdb2)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=webdb2)(SERVER=DEDICATED)))'.Error is 604.

 

备库依然报错

 

--启动备库到mount状态

SQL> shutdown immediate

SQL> startup mount

ORACLE 例程已经启动。

 

Total System Global Area 1.0456E+10 bytes

Fixed Size                  2237488 bytes

Variable Size            5435821008 bytes

Database Buffers         4999610368 bytes

Redo Buffers               17973248 bytes

数据库装载完毕。

SQL> select open_mode from v$database;

 

OPEN_MODE

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

MOUNTED

 

--查看日志

主库:

Thu Oct 23 13:45:15 2014

Archived Log entry 2225 added for thread 1sequence 1122 ID 0xc8d579d3 dest 1:

ARC3: Standby redo logfile selected forthread 1 sequence 1122 for destination LOG_ARCHIVE_DEST_2

Thu Oct 23 13:46:46 2014

ARC3: Archive log rejected (thread 1sequence 1120) at host'(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=webdb2)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=webdb2)(SERVER=DEDICATED)))'

Thu Oct 23 13:46:46 2014

ARC0: Archive log rejected (thread 1sequence 1121) at host'(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=webdb2)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=webdb2)(SERVER=DEDICATED)))'

FAL[server, ARC3]: FAL archive failed, seetrace file.

ARCH: FAL archive failed. Archivercontinuing

ORACLE Instance webdb - Archival Error.Archiver continuing.

FAL[server, ARC0]: FAL archive failed, seetrace file.

ARCH: FAL archive failed. Archivercontinuing

ORACLE Instance webdb - Archival Error.Archiver continuing.

Thu Oct 23 13:46:49 2014

Destination LOG_ARCHIVE_DEST_2 isSYNCHRONIZED

LGWR: Standby redo logfile selected toarchive thread 1 sequence 1124

LGWR: Standby redo logfile selected forthread 1 sequence 1124 for destination LOG_ARCHIVE_DEST_2

Thread 1 advanced to log sequence 1124(LGWR switch)

 Current log# 2 seq# 1124 mem# 0:+DATA/webdb/onlinelog/group_2.262.819826783

 Current log# 2 seq# 1124 mem# 1:+FRA/webdb/onlinelog/group_2.258.819826785

Archived Log entry 2244 added for thread 1sequence 1123 ID 0xc8d579d3 dest 1

 

备库:

Using STANDBY_ARCHIVE_DEST parameterdefault value as USE_DB_RECOVERY_FILE_DEST

Thu Oct 23 13:45:15 2014

RFS[1]: Assigned to RFS process 17293

RFS[1]: Opened log for thread 1 sequence1102 dbid -925543465 branch 819826777

Thu Oct 23 13:45:15 2014

Primary database is in MAXIMUM AVAILABILITYmode

Standby controlfile consistent with primary

Standby controlfile consistent with primary

RFS[2]: Assigned to RFS process 17297

RFS[2]: Selected log 7 for thread 1sequence 1123 dbid -925543465 branch 819826777

Deleted Oracle managed file+FRA/webdb2/archivelog/2014_10_13/thread_1_seq_1049.350.860808821

Archived Log entry 1104 added for thread 1sequence 1102 rlc 819826777 ID 0xc8d579d3 dest 2:

 

可以看到主备库恢复心跳,备库能恢复应用日志

 

 

打开备库操作:

SQL> alter database open;

 

数据库已更改。

 

SQL> select open_mode from v$database;

 

OPEN_MODE

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

READ ONLY

 

SQL> ALTER DATABASE RECOVER MANAGEDSTANDBY DATABASE USING CURRENT LOGFILE DISCONNECT;

ALTER DATABASE RECOVER MANAGED STANDBYDATABASE USING CURRENT LOGFILE DISCONNECT

*

第 1 行出现错误:

ORA-01153: 激活了不兼容的介质恢复

 

 

SQL> select open_mode from v$database;

 

OPEN_MODE

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

READ ONLY WITH APPLY

 

--主库切换日志

SQL> alter system switch logfile;

 

系统已更改。

 

--查看日志

 

主库:

Thu Oct 23 14:19:52 2014

LGWR: Standby redo logfile selected toarchive thread 1 sequence 1125

LGWR: Standby redo logfile selected forthread 1 sequence 1125 for destination LOG_ARCHIVE_DEST_2

Thread 1 advanced to log sequence 1125(LGWR switch)

 Current log# 3 seq# 1125 mem# 0:+DATA/webdb/onlinelog/group_3.263.819826787

 Current log# 3 seq# 1125 mem# 1:+FRA/webdb/onlinelog/group_3.259.819826789

Thu Oct 23 14:19:53 2014

Archived Log entry 2246 added for thread 1sequence 1124 ID 0xc8d579d3 dest 1:

 

备库:

Completed: ALTER DATABASE RECOVER MANAGEDSTANDBY DATABASE  THROUGH ALL SWITCHOVERDISCONNECT  USING CURRENT LOGFILE

Thu Oct 23 14:15:51 2014

ALTER DATABASE RECOVER MANAGED STANDBYDATABASE USING CURRENT LOGFILE DISCONNECT

ORA-1153 signalled during: ALTER DATABASERECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT...

Thu Oct 23 14:19:52 2014

Standby controlfile consistent with primary

RFS[2]: Selected log 7 for thread 1sequence 1125 dbid -925543465 branch 819826777

Thu Oct 23 14:19:52 2014

Archived Log entry 1123 added for thread 1sequence 1124 ID 0xc8d579d3 dest 1:

Thu Oct 23 14:19:52 2014

Media Recovery Waiting for thread 1sequence 1125 (in transit)

Recovery of Online Redo Log: Thread 1 Group7 Seq 1125 Reading mem 0

 Mem# 0: +DATA/webdb2/onlinelog/group_7.282.819884421

 Mem# 1: +FRA/webdb2/onlinelog/group_7.278.819884423

 

可以看到在只读应用状态open备库后,日志应用仍然正常

 

--查看DataGuard状态

[oracle@webdb1 trace]$ dgmgrl sys/oracle

DGMGRL for Linux: Version 11.2.0.3.0 -64bit Production

 

Copyright (c) 2000, 2009, Oracle. Allrights reserved.

 

欢迎使用 DGMGRL, 要获取有关信息请键入 "help"。

已连接。

DGMGRL> show configuration

 

配置 - webdb

 

  保护模式:        MaxAvailability

  数据库:

   webdb  - 主数据库

   webdb2 - 物理备用数据库

 

快速启动故障转移: DISABLED

 

配置状态:

SUCCESS

 

总结:

通过报错分析看到,主备不同步跟CPU补丁升级没有直接关系,跟创建的logon on database 触发器有关,

如果在主数据创建一个logon on database tiger,可能会引起主备库不能同步传输日志的问题,

这时,我们要做是把备库重新mount,然后再open到只读应用状态(READ ONLY WITH APPLY)

因为当备库重启后,备库直接启动到只读应用状态(READ ONLY WITH APPLY),就会出现上面的问题。

 

参考:

http://www.cnblogs.com/Spiritual-journey/archive/2012/10/21/2732806.html

 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值