每次truncate table objd的值将会逐渐增加。视图的objd值为0。
itpub(http://www.itpub.net/664032.html) 上的解释:
dataobj# 对应于object实际存储的seg$的对应的编号..
这样就可以将逻辑存储与物理存储隔离, 提高处理的灵活性..
比如truncate/alter table exchange partition.
PL/SQL 事例:
=======================
set serveroutput on;
declare
cnt int;
begin
select count(1) into cnt from tab where tname='TAB2';
if cnt = 1 then
execute immediate 'drop table tab2';
end if;
execute immediate 'create table tab2(a int)';
for i in 1 .. 10 loop
for rval in
(
select o.obj# objn,o.dataobj# objd,u.name uname,o.name tname
from sys.obj$ o, sys.user$ u
where o.owner#=u.user# and u.name='GAN' and o.name='TAB2')
loop
dbms_output.put_line('objn:' || rval.objn || ' objd:' || rval.objd ||
' username:' || rval.uname || ' tablename:' || rval.tname);
end loop;
execute immediate 'truncate table tab2';
end loop;
end;
|
测试结果:
======================
objn:29852 objd:29852 username:GAN tablename:TAB2
objn:29852 objd:29853 username:GAN tablename:TAB2
objn:29852 objd:29854 username:GAN tablename:TAB2
objn:29852 objd:29855 username:GAN tablename:TAB2
objn:29852 objd:29856 username:GAN tablename:TAB2
objn:29852 objd:29857 username:GAN tablename:TAB2
objn:29852 objd:29858 username:GAN tablename:TAB2
objn:29852 objd:29859 username:GAN tablename:TAB2
objn:29852 objd:29860 username:GAN tablename:TAB2
objn:29852 objd:29861 username:GAN tablename:TAB2
PL/SQL 过程已成功完成。
阅读(4449) | 评论(0) | 转发(0) |