每次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 过程已成功完成。
阅读(4370) | 评论(0) | 转发(0) |