[20180823]IMU與db link.txt

lfree發表於2018-08-22

[20180823]IMU與db link.txt

--//當使用db link檢視遠端表時,實際上會產生小小的日誌.
--//當時如果與IMU結合在一起,可以導致IMU的失效.

1.環境:
SCOTT@book> @ ver1
PORT_STRING                    VERSION        BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx            11.2.0.4.0     Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

CREATE  PUBLIC DATABASE LINK LOOPBACK CONNECT TO SCOTT IDENTIFIED BY book USING 'localhost:1521/book:DEDICATED';
create table deptx as select * from dept;

2.測試:
SCOTT@book> @ &r/viewsess "IMU commits"
NAME        STATISTIC#      VALUE        SID
----------- ---------- ---------- ----------
IMU commits        374          0          1

SCOTT@book> update deptx set dname=lower(dname) where deptno=10;
1 row updated.

SCOTT@book> commit;
Commit complete.

SCOTT@book> @ &r/viewsess "IMU commits"
NAME        STATISTIC#      VALUE        SID
----------- ---------- ---------- ----------
IMU commits        374          1          1

--//可以發現當前資料庫IMU起作用的.

SCOTT@book> @ &r/viewsess "IMU commits"
NAME        STATISTIC#      VALUE        SID
----------- ---------- ---------- ----------
IMU commits        374          0          1

SCOTT@book> update deptx set dname=lower(dname) where deptno=10;
1 row updated.

SCOTT@book> select sysdate from dual@loopback;
SYSDATE
-------------------
2018-08-22 09:04:00

SCOTT@book> commit ;
Commit complete.

SCOTT@book> @ &r/viewsess "IMU commits"
NAME        STATISTIC#      VALUE        SID
----------- ---------- ---------- ----------
IMU commits        374          0          1

--//當是當執行dml時有dblink的語句,IMU失效,回到原來的模式.

--//viewsess.sql指令碼:
set verify off
column name format a70
SELECT b.NAME, a.statistic#, a.VALUE,a.sid
  FROM v$mystat a, v$statname b
 WHERE lower(b.NAME) like lower('%&1%') AND a.statistic# = b.statistic# ;
 --and a.value>0;

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-2212614/,如需轉載,請註明出處,否則將追究法律責任。

相關文章