- 最后登录
- 2018-8-16
- 在线时间
- 100 小时
- 威望
- 45
- 金钱
- 292
- 注册时间
- 2012-4-24
- 阅读权限
- 10
- 帖子
- 53
- 精华
- 0
- 积分
- 45
- UID
- 385
|
1#
发表于 2012-7-4 01:30:34
|
查看: 8228 |
回复: 7
各位好,
我们有一个DG环境:
OS: AIX 5.2 64bit,
DB version: 10.2.0.4 64bit,
1 primary + 1 logical standby,
一星期前,发现有几个日志一直在current状态,但是过了一周了mining_scn都未改变。logical standby自己的归档日志40s大概生成一个。经过日志挖掘,发现这个日志里面几乎所有都是对某几个序列的更新。这个更新比较奇怪,他会把sequence的start with的值,以及cache的值做一些修改。
这几个scn的值在这一周都没有变化过:- SQL> SELECT APPLIED_SCN, LATEST_SCN, MINING_SCN, RESTART_SCN FROM V$LOGSTDBY_PROGRESS;
- APPLIED_SCN LATEST_SCN MINING_SCN RESTART_SCN
- ------------- -------------- -------------- --------------
- 1844801217 1857454587 1844801222 1844637788
复制代码
这个内部序列update的语句形式这样:
- UPDATE "SYS"."seq$"
- SET "increment$" = '1',
- "minvalue" = '1',
- "maxvalue" = '99999',
- "cycle#" = '1',
- "order$" = '0',
- "cache" = '20',
- "highwater" = '16701',
- "audit$" = '--------------------------------',
- "flags" = '8'
- WHERE "obj#" = '38038'
- AND "increment$" = '1'
- AND "minvalue" = '1'
- AND "maxvalue" = '99999'
- AND "cycle#" = '1'
- AND "order$" = '0'
- AND "cache" = '20'
- AND "highwater" = '16681'
- AND "audit$" = '--------------------------------'
- AND "flags" = '8'
- AND rowid = 'AAAABDAABAAAAHzAA5';
-
复制代码
Object的具体信息:- SQL> r
- 1* select object_id, object_name, object_type from dba_objects where object_id=44703
- OBJECT_ID OBJECT_NAME OBJECT_TYPE
- ---------- ---------------------------------------- -------------------
- 44703 OUTP_ANAESTHESIA_SEQUENCE_NO SEQUENCE
复制代码 Primary上这个序列的定义:- SQL> set long 1000;
- SQL> r
- 1* select dbms_metadata.get_ddl('SEQUENCE','OUTP_ANAESTHESIA_SEQUENCE_NO','OUTPDOCT') from dual
- DBMS_METADATA.GET_DDL('SEQUENCE','OUTP_ANAESTHESIA_SEQUENCE_NO','OUTPDOCT')
- --------------------------------------------------------------------------------
- CREATE SEQUENCE "OUTPDOCT"."OUTP_ANAESTHESIA_SEQUENCE_NO" MINVALUE 1 MAXVAL
- UE 999999999999 INCREMENT BY 1 START WITH 121 CACHE 20 NOORDER CYCLE
复制代码 而Standby上这个序列的定义却是这样:- SQL> set long 100000;
- SQL> r
- 1* select dbms_metadata.get_ddl('SEQUENCE','OUTP_ANAESTHESIA_SEQUENCE_NO','OUTPDOCT') from dual
- DBMS_METADATA.GET_DDL('SEQUENCE','OUTP_ANAESTHESIA_SEQUENCE_NO','OUTPDOCT')
- --------------------------------------------------------------------------------
- CREATE SEQUENCE "OUTPDOCT"."OUTP_ANAESTHESIA_SEQUENCE_NO" MINVALUE 1 MAXVAL
- UE 999999999999 INCREMENT BY -60 START WITH 920434195299 NOCACHE NOORDER CYCLE
复制代码 尝试过重启sql apply, 重启logical standby 数据库。
但是都不能解决问题。
最后发现有个bug和目前的想想较为匹配<Bug 9486060 Many "update seq$" SQLs generated / spin on logical standby - superceded>
这个bug最后指向的workaround是<Bug 9906543 Logical standby Apply lag due to apply slaves synchronizing a sequence>提到的。
描述如下:- Workaround:
- Drop the guard, and then recreate the sequence at the standby with the
- correct START WITH value (corresponding to the HIGHWATER at the primary).
复制代码 我执行的过程:- alter session disable guard;
- -- 因为正常执行关闭不成功,会挂起很长时间没反应,使用了abort的方法:
- ALTER DATABASE ABORT LOGICAL STANDBY APPLY;
- drop sequence OUTPDOCT.OUTP_ANAESTHESIA_SEQUENCE_NO;
- CREATE SEQUENCE "OUTPDOCT"."OUTP_ANAESTHESIA_SEQUENCE_NO" MINVALUE 1 MAXVAL
- UE 999999999999 INCREMENT BY 1 START WITH 121 CACHE 20 NOORDER CYCLE;
- ALTER DATABASE START LOGICAL STANDBY APPLY IMMEDIATE;
- alter session enable guard;
- 过了一阵,在logical standby的对应sequence里,发现又被改变了:
- SQL> select dbms_metadata.get_ddl('SEQUENCE','OUTP_ANAESTHESIA_SEQUENCE_NO','OUTPDOCT') from dual;
- DBMS_METADATA.GET_DDL('SEQUENCE','OUTP_ANAESTHESIA_SEQUENCE_NO','OUTPDOCT')
- --------------------------------------------------------------------------------
- CREATE SEQUENCE "OUTPDOCT"."OUTP_ANAESTHESIA_SEQUENCE_NO" MINVALUE 1 MAXVAL
- UE 999999999999 INCREMENT BY 1 START WITH 1520821 CACHE 20 NOORDER CYCLE
复制代码 DG alert log和 DG diag脚本跑出的信息已经上传。
Primary_Standby_alert_log.zip
(530.36 KB, 下载次数: 1103)
DG_diag_info.zip
(15.59 KB, 下载次数: 1280)
请大家帮忙看看,有没什么好办法。
谢谢。
[ 本帖最后由 miloluo 于 2012-7-5 11:13 编辑 ] |
|