无意中发现Oracle 10203流复制的bug
scriptaj
|
1#
scriptaj 发表于 2008-01-18 00:00
无意中发现Oracle 10203流复制的bug
作者msn:olivenan@hotmail.com
本例为源库和目标库均为Oracle 10203 流复制 ORA-01435: user does not exist 本来这个错误很平常的,但是不平常的是我做的是对baseconf用户的流复制的是baseconf,而不是logbill的。我在源库的logbill用户下创建的视图,按理说Oracle流复制不应该同步logbill下面DML和DDL。 错误如下: SQL> set serveroutput on SQL> exec print_transaction('4.28.1988928'); ----- Local Transaction ID: 4.28.1988928 ----- Source Database: BILLBJ.CHINACACHE ----Error in Message: 1 ----Error Number: 1435 ----Message Text: ORA-01435: user does not exist --message: 1 type name: SYS.LCR$_DDL_RECORD source database: BILLBJ.CHINACACHE owner: LOGBILL object: VW_LOG_BILLING_TO_CHANNEL is tag null: Y ddl: create view vw_log_billing_to_channel as select distinct bbc.billing_id, bbc.channel_id from baseconf.bil_billing_to_channel bbc, channel_to_service cs where cs.channel_id = bbc.channel_id and cs.service_id = '1400' 一、进一步测试 源库: 1、测试logbill的ddl是否同步 SQL> show user User is "logbill" SQL> create table t1 as select * from dba_objects; Table created SQL> select count(*) from t1; COUNT(*) ---------- 83834 SQL> 目标库: SQL> show user User is "logbill" SQL> SQL> select count(*) from t1; select count(*) from t1 ORA-00942: 表或视图不存在 SQL> desc t1; Object t1 does not exist. 结论:说明Oracle在一般情况下是不会复制logbill下的ddl的,dml也不会复制的,这里没有列出来dml测试而已。 继续: 2、在执行ddl时sql语句包含baseconf的对象 源库:logbill下创建表 SQL> drop table t1 purge; Table dropped SQL> create table t1 as select * from baseconf.pub_node where 1=2; Table created 目标库: SQL> show user User is "logbill" SQL> desc t1; Object t1 does not exist. SQL> desc t1; Object t1 does not exist. 结论:没有复制该条ddl。 3、创建视图,sql如下: 源库: SQL> create view v_test as select * from baseconf.pub_node where 1=2; View created 目标库: SQL> select * from dba_views where view_name ='V_TEST'; OWNER VIEW_NAME TEXT_LENGTH TEXT TYPE_TEXT_LENGTH TYPE_TEXT OID_TEXT_LENGTH OID_TEXT VIEW_TYPE_OWNER VIEW_TYPE SUPERVIEW_NAME ------------------------------ ------------------------------ ----------- -------------------------------------------------------------------------------- ---------------- -------------------------------------------------------------------------------- --------------- -------------------------------------------------------------------------------- ------------------------------ ------------------------------ ------------------------------ LOGBILL V_TEST 227 select "NODE_ID","LOCATION","C_LOCATION","NODE_STAT","NODE_ABBR","INSTALL_DATE", SQL> select count(*) from v_test; COUNT(*) ---------- 0 SQL> 结论:此时目标节点也创建了该视图,这就是oracle的bug。 4、创建同义词 源库: SQL> create synonym v_test2 for baseconf.pub_node; Synonym created SQL> 目标库: SQL> select * from dba_synonyms t where t.synonym_name='V_TEST2'; OWNER SYNONYM_NAME TABLE_OWNER TABLE_NAME DB_LINK ------------------------------ ------------------------------ ------------------------------ ------------------------------ -------------------------------------------------------------------------------- LOGBILL V_TEST2 BASECONF PUB_NODE SQL> 结论:同义词也复制到目标节点了。 5、删除已经同步的对象 源库: SQL> drop view v_test; View dropped SQL> drop synonym v_test2; 目标库: SQL> select count(*) from v_test; COUNT(*) ---------- 0 SQL> select * from dba_synonyms t where t.synonym_name='V_TEST2'; OWNER SYNONYM_NAME TABLE_OWNER TABLE_NAME DB_LINK ------------------------------ ------------------------------ ------------------------------ ------------------------------ -------------------------------------------------------------------------------- LOGBILL V_TEST2 BASECONF PUB_NODE SQL> 结论:oracle此时并没有将删除ddl同步到目标节点。 结论:虽然这个不会给我们实际工作中带来太大影响,但是那些我们尚不知的bug也许有很多的潜在危险,oracle 10203的流复制也不是很完美的。 |