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