Chinaunix首页 | 论坛 | 博客
  • 博客访问: 3903984
  • 博文数量: 534
  • 博客积分: 10470
  • 博客等级: 上将
  • 技术积分: 4800
  • 用 户 组: 普通用户
  • 注册时间: 2006-05-26 14:08
文章分类

全部博文(534)

文章存档

2021年(1)

2019年(1)

2017年(1)

2016年(2)

2013年(2)

2012年(10)

2011年(43)

2010年(10)

2009年(17)

2008年(121)

2007年(253)

2006年(73)

分类: Oracle

2007-08-04 09:16:50

每次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 过程已成功完成。
阅读(4280) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~