欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

[20180823]IMU与db link.txt

程序员文章站 2023-12-17 18:18:28
[20180823]IMU与db link.txt--//当使用db link查看远程表时,实际上会产生小小的日志.--//当时如果与IMU结合在一起,可以导致IMU的失效.1.环境:SCOTT@book> @ ver1PORT_STRING VERSION BANNER x86_64/Linux ......

[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;

上一篇:

下一篇: