oracle tabs作用,tab和user_tables的区别

tab和user_tables都是视图,可以看看它们的定义。

SELECT TEXT FROM ALL_VIEWS WHERE VIEW_NAME ='TAB';

select o.name,

decode(o.type#, 2, 'TABLE', 3, 'CLUSTER',

4, 'VIEW', 5, 'SYNONYM'), t.tab#

from  sys.tab$ t, sys.obj$ o

where o.owner# = userenv('SCHEMAID')

and o.type# >=2

and o.type# <=5

and o.linkname is null

and o.obj# = t.obj# (+);

SELECT TEXT FROM ALL_VIEWS WHERE VIEW_NAME ='USER_TABLES';

select o.name, decode(bitand(t.property, 4194400), 0, ts.name, null),

decode(bitand(t.property, 1024), 0, null, co.name),

decode((bitand(t.property, 512)+bitand(t.flags, 536870912)),

0, null, co.name),

decode(bitand(t.property, 32+64), 0, mod(t.pctfree$, 100), 64, 0, null),

decode(bitand(ts.flags, 32), 32, to_number(NULL),

decode(bitand(t.property, 32+64), 0, t.pctused$, 64, 0, null)),

decode(bitand(t.property, 32), 0, t.initrans, null),

decode(bitand(t.property, 32), 0, t.maxtrans, null),

s.iniexts * ts.blocksize,

decode(bitand(ts.flags, 3), 1, to_number(NULL),

s.extsize * ts.blocksize),

s.minexts, s.maxexts,

decode(bitand(ts.flags, 3), 1, to_number(NULL),

s.extpct),

decode(bitand(ts.flags, 32), 32, to_number(NULL),

decode(bitand(o.flags, 2), 2, 1, decode(s.lists, 0, 1, s.lists))),

decode(bitand(ts.flags, 32), 32, to_number(NULL),

decode(bitand(o.flags, 2), 2, 1, decode(s.groups, 0, 1, s.groups))),

decode(bitand(t.property, 32), 32, null,

decode(bitand(t.flags, 32), 0, 'YES', 'NO')),

decode(bitand(t.flags,1), 0, 'Y', 1, 'N', '?'),

t.rowcnt,

decode(bitand(t.property, 64), 0, t.blkcnt, null),

decode(bitand(t.property, 64), 0, t.empcnt, null),

decode(bitand(t.property, 64), 0, t.avgspc, null),

t.chncnt, t.avgrln, t.avgspc_flb,

decode(bitand(t.property, 64), 0, t.flbcnt, null),

lpad(decode(t.degree, 32767, 'DEFAULT', nvl(t.degree,1)),10),

lpad(decode(t.instances, 32767, 'DEFAULT', nvl(t.instances,1)),10),

lpad(decode(bitand(t.flags, 8), 8, 'Y', 'N'),5),

decode(bitand(t.flags, 6), 0, 'ENABLED', 'DISABLED'),

t.samplesize, t.analyzetime,

decode(bitand(t.property, 32), 32, 'YES', 'NO'),

decode(bitand(t.property, 64), 64, 'IOT',

decode(bitand(t.property, 512), 512, 'IOT_OVERFLOW',

decode(bitand(t.flags, 536870912), 536870912, 'IOT_MAPPING', null))),

decode(bitand(o.flags, 2), 0, 'N', 2, 'Y', 'N'),

decode(bitand(o.flags, 16), 0, 'N', 16, 'Y', 'N'),

decode(bitand(t.property, 8192), 8192, 'YES',

decode(bitand(t.property, 1), 0, 'NO', 'YES')),

decode(bitand(o.flags, 2), 2, 'DEFAULT',

decode(s.cachehint, 0, 'DEFAULT', 1, 'KEEP', 2, 'RECYCLE', NULL)),

decode(bitand(t.flags, 131072), 131072, 'ENABLED', 'DISABLED'),

decode(bitand(t.flags, 512), 0, 'NO', 'YES'),

decode(bitand(t.flags, 256), 0, 'NO', 'YES'),

decode(bitand(o.flags, 2), 0, NULL,

decode(bitand(t.property, 8388608), 8388608,

'SYS$SESSION', 'SYS$TRANSACTION')),

decode(bitand(t.flags, 1024), 1024, 'ENABLED', 'DISABLED'),

decode(bitand(t.flags, 2097152), 2097152, 'YES', 'NO'),

decode(bitand(t.property, 1024), 0, null, cu.name),

decode(bitand(t.flags, 8388608), 8388608, 'ENABLED', 'DISABLED')

from sys.ts$ ts, sys.seg$ s, sys.obj$ co, sys.tab$ t, sys.obj$ o,

sys.obj$ cx, sys.user$ cu

where o.owner# = userenv('SCHEMAID')

and o.obj# = t.obj#

and bitand(t.property, 1) = 0

and t.bobj# = co.obj# (+)

and t.ts# = ts.ts#

and t.file# = s.file# (+)

and t.block# = s.block# (+)

and t.ts# = s.ts# (+)

and t.dataobj# = cx.obj# (+)

and cx.owner# = cu.user# (+)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值