设为首页 收藏本站
查看: 573|回复: 0

[经验分享] oracle数据库的数据字典视图,数据来自哪个(些)表?

[复制链接]

尚未签到

发表于 2017-12-11 13:38:02 | 显示全部楼层 |阅读模式
1 SQL>  
  2 SQL>
  
  3 SQL> select text from dba_views where view_name like 'DBA_TABLES';
  
  4
  
  5 TEXT
  
  6 --------------------------------------------------------------------------------
  
  7 select u.name, o.name,
  
  8 decode(bitand(t.property,2151678048), 0, ts.name,
  
  9 decode(t.ts#, 0, null, ts.name)),
  
10 decode(bitand(t.property, 1024), 0, null, co.name),
  
11 decode((bitand(t.property, 512)+bitand(t.flags, 536870912)),
  
12 0, null, co.name),
  
13 decode(bitand(t.trigflag, 1073741824), 1073741824, 'UNUSABLE', 'VALID'),
  
14 decode(bitand(t.property, 32+64), 0, mod(t.pctfree$, 100), 64, 0, null),
  
15 decode(bitand(ts.flags, 32), 32, to_number(NULL),
  
16 decode(bitand(t.property, 32+64), 0, t.pctused$, 64, 0, null)),
  
17 decode(bitand(t.property, 32), 0, t.initrans, null),
  
18
  
19 TEXT
  
20 --------------------------------------------------------------------------------
  
21 decode(bitand(t.property, 32), 0, t.maxtrans, null),
  
22 decode(bitand(t.property, 17179869184), 17179869184,
  
23 ds.initial_stg * ts.blocksize,
  
24 s.iniexts * ts.blocksize),
  
25 decode(bitand(t.property, 17179869184), 17179869184,
  
26 ds.next_stg * ts.blocksize,
  
27 s.extsize * ts.blocksize),
  
28 decode(bitand(t
  
29
  
30
  
31 SQL> set long 2048;
  
32 SQL>
  
33 SQL>
  
34 SQL> select text from dba_views where view_name like 'DBA_TABLES';
  
35
  
36 TEXT
  
37 --------------------------------------------------------------------------------
  
38 select u.name, o.name,
  
39 decode(bitand(t.property,2151678048), 0, ts.name,
  
40 decode(t.ts#, 0, null, ts.name)),
  
41 decode(bitand(t.property, 1024), 0, null, co.name),
  
42 decode((bitand(t.property, 512)+bitand(t.flags, 536870912)),
  
43 0, null, co.name),
  
44 decode(bitand(t.trigflag, 1073741824), 1073741824, 'UNUSABLE', 'VALID'),
  
45 decode(bitand(t.property, 32+64), 0, mod(t.pctfree$, 100), 64, 0, null),
  
46 decode(bitand(ts.flags, 32), 32, to_number(NULL),
  
47 decode(bitand(t.property, 32+64), 0, t.pctused$, 64, 0, null)),
  
48 decode(bitand(t.property, 32), 0, t.initrans, null),
  
49
  
50 TEXT
  
51 --------------------------------------------------------------------------------
  
52 decode(bitand(t.property, 32), 0, t.maxtrans, null),
  
53 decode(bitand(t.property, 17179869184), 17179869184,
  
54 ds.initial_stg * ts.blocksize,
  
55 s.iniexts * ts.blocksize),
  
56 decode(bitand(t.property, 17179869184), 17179869184,
  
57 ds.next_stg * ts.blocksize,
  
58 s.extsize * ts.blocksize),
  
59 decode(bitand(t.property, 17179869184), 17179869184,
  
60 ds.minext_stg, s.minexts),
  
61 decode(bitand(t.property, 17179869184), 17179869184,
  
62 ds.maxext_stg, s.maxexts),
  
63
  
64 TEXT
  
65 --------------------------------------------------------------------------------
  
66 decode(bitand(ts.flags, 3), 1, to_number(NULL),
  
67 decode(bitand(t.property, 17179869184), 17179869184,
  
68 ds.pctinc_stg, s.extpct)),
  
69 decode(bitand(ts.flags, 32), 32, to_number(NULL),
  
70 decode(bitand(o.flags, 2), 2, 1,
  
71 decode(bitand(t.property, 17179869184), 17179869184,
  
72 ds.frlins_stg, decode(s.lists, 0, 1, s.lists)))),
  
73 decode(bitand(ts.flags, 32), 32, to_number(NULL),
  
74 decode(bitand(o.flags, 2), 2, 1,
  
75 decode(bitand(t.property, 17179869184), 17179869184,
  
76 ds.maxins_stg, decode(s.groups, 0, 1, s.groups)))),
  
77
  
78 TEXT
  
79 --------------------------------------------------------------------------------
  
80 decode(bitand(t.property, 32+64), 0,
  
81 decode(bitand(t.flags, 32), 0, 'YES', 'NO'), null),
  
82 decode(bitand(t.flags,1), 0, 'Y', 1, 'N', '?'),
  
83 t.rowcnt,
  
84
  
85
  
86 SQL> set long 65535;
  
87 SQL>
  
88 SQL>
  
89 SQL> select text from dba_views where view_name like 'DBA_TABLES';
  
90
  
91 TEXT
  
92 --------------------------------------------------------------------------------
  
93 select u.name, o.name,
  
94 decode(bitand(t.property,2151678048), 0, ts.name,
  
95 decode(t.ts#, 0, null, ts.name)),
  
96 decode(bitand(t.property, 1024), 0, null, co.name),
  
97 decode((bitand(t.property, 512)+bitand(t.flags, 536870912)),
  
98 0, null, co.name),
  
99 decode(bitand(t.trigflag, 1073741824), 1073741824, 'UNUSABLE', 'VALID'),
  
100 decode(bitand(t.property, 32+64), 0, mod(t.pctfree$, 100), 64, 0, null),
  
101 decode(bitand(ts.flags, 32), 32, to_number(NULL),
  
102 decode(bitand(t.property, 32+64), 0, t.pctused$, 64, 0, null)),
  
103 decode(bitand(t.property, 32), 0, t.initrans, null),
  
104
  
105 TEXT
  
106 --------------------------------------------------------------------------------
  
107 decode(bitand(t.property, 32), 0, t.maxtrans, null),
  
108 decode(bitand(t.property, 17179869184), 17179869184,
  
109 ds.initial_stg * ts.blocksize,
  
110 s.iniexts * ts.blocksize),
  
111 decode(bitand(t.property, 17179869184), 17179869184,
  
112 ds.next_stg * ts.blocksize,
  
113 s.extsize * ts.blocksize),
  
114 decode(bitand(t.property, 17179869184), 17179869184,
  
115 ds.minext_stg, s.minexts),
  
116 decode(bitand(t.property, 17179869184), 17179869184,
  
117 ds.maxext_stg, s.maxexts),
  
118
  
119 TEXT
  
120 --------------------------------------------------------------------------------
  
121 decode(bitand(ts.flags, 3), 1, to_number(NULL),
  
122 decode(bitand(t.property, 17179869184), 17179869184,
  
123 ds.pctinc_stg, s.extpct)),
  
124 decode(bitand(ts.flags, 32), 32, to_number(NULL),
  
125 decode(bitand(o.flags, 2), 2, 1,
  
126 decode(bitand(t.property, 17179869184), 17179869184,
  
127 ds.frlins_stg, decode(s.lists, 0, 1, s.lists)))),
  
128 decode(bitand(ts.flags, 32), 32, to_number(NULL),
  
129 decode(bitand(o.flags, 2), 2, 1,
  
130 decode(bitand(t.property, 17179869184), 17179869184,
  
131 ds.maxins_stg, decode(s.groups, 0, 1, s.groups)))),
  
132
  
133 TEXT
  
134 --------------------------------------------------------------------------------
  
135 decode(bitand(t.property, 32+64), 0,
  
136 decode(bitand(t.flags, 32), 0, 'YES', 'NO'), null),
  
137 decode(bitand(t.flags,1), 0, 'Y', 1, 'N', '?'),
  
138 t.rowcnt,
  
139 decode(bitand(t.property, 64), 0, t.blkcnt, null),
  
140 decode(bitand(t.property, 64), 0, t.empcnt, null),
  
141 t.avgspc, t.chncnt, t.avgrln, t.avgspc_flb,
  
142 decode(bitand(t.property, 64), 0, t.flbcnt, null),
  
143 lpad(decode(t.degree, 32767, 'DEFAULT', nvl(t.degree,1)),10),
  
144 lpad(decode(t.instances, 32767, 'DEFAULT', nvl(t.instances,1)),10),
  
145 lpad(decode(bitand(t.flags, 8), 8, 'Y', 'N'),5),
  
146
  
147 TEXT
  
148 --------------------------------------------------------------------------------
  
149 decode(bitand(t.flags, 6), 0, 'ENABLED', 'DISABLED'),
  
150 t.samplesize, t.analyzetime,
  
151 decode(bitand(t.property, 32), 32, 'YES', 'NO'),
  
152 decode(bitand(t.property, 64), 64, 'IOT',
  
153 decode(bitand(t.property, 512), 512, 'IOT_OVERFLOW',
  
154 decode(bitand(t.flags, 536870912), 536870912, 'IOT_MAPPING', null
  
155 ))),
  
156 decode(bitand(o.flags, 2), 0, 'N', 2, 'Y', 'N'),
  
157 decode(bitand(o.flags, 16), 0, 'N', 16, 'Y', 'N'),
  
158 decode(bitand(t.property, 8192), 8192, 'YES',
  
159 decode(bitand(t.property, 1), 0, 'NO', 'YES')),
  
160
  
161 TEXT
  
162 --------------------------------------------------------------------------------
  
163 decode(bitand(o.flags, 2), 2, 'DEFAULT',
  
164 decode(bitand(decode(bitand(t.property, 17179869184), 17179869184,
  
165
  
166 ds.bfp_stg, s.cachehint), 3),
  
167 1, 'KEEP', 2, 'RECYCLE', 'DEFAULT')),
  
168 decode(bitand(o.flags, 2), 2, 'DEFAULT',
  
169 decode(bitand(decode(bitand(t.property, 17179869184), 17179869184,
  
170
  
171 ds.bfp_stg, s.cachehint), 12)/4,
  
172 1, 'KEEP', 2, 'NONE', 'DEFAULT')),
  
173 decode(bitand(o.flags, 2), 2, 'DEFAULT',
  
174
  
175 TEXT
  
176 --------------------------------------------------------------------------------
  
177 decode(bitand(decode(bitand(t.property, 17179869184), 17179869184,
  
178
  
179 ds.bfp_stg, s.cachehint), 48)/16,
  
180 1, 'KEEP', 2, 'NONE', 'DEFAULT')),
  
181 decode(bitand(t.flags, 131072), 131072, 'ENABLED', 'DISABLED'),
  
182 decode(bitand(t.flags, 512), 0, 'NO', 'YES'),
  
183 decode(bitand(t.flags, 256), 0, 'NO', 'YES'),
  
184 decode(bitand(o.flags, 2), 0, NULL,
  
185 decode(bitand(t.property, 8388608), 8388608,
  
186 'SYS$SESSION', 'SYS$TRANSACTION')),
  
187 decode(bitand(t.flags, 1024), 1024, 'ENABLED', 'DISABLED'),
  
188
  
189 TEXT
  
190 --------------------------------------------------------------------------------
  
191 decode(bitand(o.flags, 2), 2, 'NO',
  
192 decode(bitand(t.property, 2147483648), 2147483648, 'NO',
  
193 decode(ksppcv.ksppstvl, 'TRUE', 'YES', 'NO'))),
  
194 decode(bitand(t.property, 1024), 0, null, cu.name),
  
195 decode(bitand(t.flags, 8388608), 8388608, 'ENABLED', 'DISABLED'),
  
196 case when (bitand(t.property, 32) = 32) then
  
197 null
  
198 when (bitand(t.property, 17179869184) = 17179869184) then
  
199 decode(bitand(ds.flags_stg, 4), 4, 'ENABLED', 'DISABLED')
  
200 else
  
201 decode(bitand(s.spare1, 2048), 2048, 'ENABLED', 'DISABLED')
  
202
  
203 TEXT
  
204 --------------------------------------------------------------------------------
  
205 end,
  
206 case when (bitand(t.property, 32) = 32) then
  
207 null
  
208 when (bitand(t.property, 17179869184) = 17179869184) then
  
209 decode(bitand(ds.flags_stg, 4), 4,
  
210 case when bitand(ds.cmpflag_stg, 3) = 1 then 'BASIC'
  
211 when bitand(ds.cmpflag_stg, 3) = 2 then 'OLTP'
  
212 else decode(ds.cmplvl_stg, 1, 'QUERY LOW',
  
213 2, 'QUERY HIGH',
  
214 3, 'ARCHIVE LOW',
  
215 'ARCHIVE HIGH') end,
  
216
  
217 TEXT
  
218 --------------------------------------------------------------------------------
  
219 null)
  
220 else
  
221 decode(bitand(s.spare1, 2048), 0, null,
  
222 case when bitand(s.spare1, 16777216) = 16777216
  
223 then 'OLTP'
  
224 when bitand(s.spare1, 100663296) = 33554432 -- 0x2000000
  
225 then 'QUERY LOW'
  
226 when bitand(s.spare1, 100663296) = 67108864 -- 0x4000000
  
227 then 'QUERY HIGH'
  
228 when bitand(s.spare1, 100663296) = 100663296 -- 0x2000000+0x400000
  
229 0
  
230
  
231 TEXT
  
232 --------------------------------------------------------------------------------
  
233 then 'ARCHIVE LOW'
  
234 when bitand(s.spare1, 134217728) = 134217728 -- 0x8000000
  
235 then 'ARCHIVE HIGH'
  
236 else 'BASIC' end)
  
237 end,
  
238 decode(bitand(o.flags, 128), 128, 'YES', 'NO'),
  
239 decode(bitand(t.trigflag, 2097152), 2097152, 'YES', 'NO'),
  
240 decode(bitand(t.property, 17179869184), 17179869184, 'NO',
  
241 decode(bitand(t.property, 32), 32, 'N/A', 'YES')),
  
242 decode(bitand(t.property,16492674416640),2199023255552,'FORCE',
  
243 4398046511104,'MANUAL','DEFAULT')
  
244
  
245 TEXT
  
246 --------------------------------------------------------------------------------
  
247 from sys.user$ u, sys.ts$ ts, sys.seg$ s, sys.obj$ co, sys.tab$ t, sys.obj$ o,
  
248 sys.obj$ cx, sys.user$ cu, x$ksppcv ksppcv, x$ksppi ksppi,
  
249 sys.deferred_stg$ ds
  
250 where o.owner# = u.user#
  
251 and o.obj# = t.obj#
  
252 and bitand(t.property, 1) = 0
  
253 and bitand(o.flags, 128) = 0
  
254 and t.bobj# = co.obj# (+)
  
255 and t.ts# = ts.ts#
  
256 and t.obj# = ds.obj# (+)
  
257 and t.file# = s.file# (+)
  
258
  
259 TEXT
  
260 --------------------------------------------------------------------------------
  
261 and t.block# = s.block# (+)
  
262 and t.ts# = s.ts# (+)
  
263 and t.dataobj# = cx.obj# (+)
  
264 and cx.owner# = cu.user# (+)
  
265 and ksppi.indx = ksppcv.indx
  
266 and ksppi.ksppinm = '_dml_monitoring_enabled'
  
267
  
268
  
269 SQL>
  
270 SQL>

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.iyunv.com/thread-422978-1-1.html 上篇帖子: Linux平台 Oracle 10gR2(10.2.0.5)RAC安装 Part2:clusterware安装和升级 下篇帖子: Oracle SQL Developer出现错误 【ora-28002:the password will expire within 7 days】的解决办法
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表