all objects oracle,DBA_OBJECTS / ALL_OBJECTS / BJ=USER_OBJECTS

1.DBA_OBJECTS / ALL_OBJECTS / BJ=USER_OBJECTS视图是非常非常常用的数据视图,可以获得数据库中任意的对象sys@ora10g> desc dba_objects;Name                                      Null?    Type

----------------------------------------- -------- -----------------------------

OWNER                                              VARCHAR2(30)

OBJECT_NAME                                        VARCHAR2(128)

SUBOBJECT_NAME                                     VARCHAR2(30)

OBJECT_ID                                          NUMBER

DATA_OBJECT_ID                                     NUMBER

OBJECT_TYPE                                        VARCHAR2(19)

CREATED                                            DATE

LAST_DDL_TIME                                      DATE

TIMESTAMP                                          VARCHAR2(19)

STATUS                                             VARCHAR2(7)

TEMPORARY                                          VARCHAR2(1)

GENERATED                                          VARCHAR2(1)

SECONDARY                                          VARCHAR2(1)sys@ora10g> select count(*) from dba_objects;COUNT(*)----------11441sys@ora10g> select count(*) from obj;COUNT(*)----------6751sys@ora10g> select count(*) from user_objects;COUNT(*)----------6751sys@ora10g> select count(*) from all_objects;COUNT(*)----------11376sys@ora10g> conn sec/secConnected.sec@ora10g> select object_name,object_type from obj;OBJECT_NAME                    OBJECT_TYPE------------------------------ -------------------TEST                           TABLESTATS_TEST                     TABLE2.通过查看catalog.sql获得oracle创建DBA_OBJECTS数据字典视图的语句create or replace view DBA_OBJECTS(OWNER, OBJECT_NAME, SUBOBJECT_NAME, OBJECT_ID, DATA_OBJECT_ID,OBJECT_TYPE, CREATED, LAST_DDL_TIME, TIMESTAMP, STATUS,TEMPORARY, GENERATED, SECONDARY)asselect u.name, o.name, o.subname, o.obj#, o.dataobj#,decode(o.type#, 0, 'NEXT OBJECT', 1, 'INDEX', 2, 'TABLE', 3, 'CLUSTER',4, 'VIEW', 5, 'SYNONYM', 6, 'SEQUENCE',7, 'PROCEDURE', 8, 'FUNCTION', 9, 'PACKAGE',11, 'PACKAGE BODY', 12, 'TRIGGER',13, 'TYPE', 14, 'TYPE BODY',19, 'TABLE PARTITION', 20, 'INDEX PARTITION', 21, 'LOB',22, 'LIBRARY', 23, 'DIRECTORY', 24, 'QUEUE',28, 'JAVA SOURCE', 29, 'JAVA CLASS', 30, 'JAVA RESOURCE',32, 'INDEXTYPE', 33, 'OPERATOR',34, 'TABLE SUBPARTITION', 35, 'INDEX SUBPARTITION',40, 'LOB PARTITION', 41, 'LOB SUBPARTITION',42, NVL((SELECT distinct 'REWRITE EQUIVALENCE'FROM sum$ sWHERE s.obj#=o.obj#and bitand(s.xpflags, 8388608) = 8388608),'MATERIALIZED VIEW'),43, 'DIMENSION',44, 'CONTEXT', 46, 'RULE SET', 47, 'RESOURCE PLAN',48, 'CONSUMER GROUP',51, 'SUBSCRIPTION', 52, 'LOCATION',55, 'XML SCHEMA', 56, 'JAVA DATA',57, 'SECURITY PROFILE', 59, 'RULE',60, 'CAPTURE', 61, 'APPLY',62, 'EVALUATION CONTEXT',66, 'JOB', 67, 'PROGRAM', 68, 'JOB CLASS', 69, 'WINDOW',72, 'WINDOW GROUP', 74, 'SCHEDULE', 79, 'CHAIN',81, 'FILE GROUP','UNDEFINED'),o.ctime, o.mtime,to_char(o.stime, 'YYYY-MM-DD:HH24:MI:SS'),decode(o.status, 0, 'N/A', 1, 'VALID', 'INVALID'),decode(bitand(o.flags, 2), 0, 'N', 2, 'Y', 'N'),decode(bitand(o.flags, 4), 0, 'N', 4, 'Y', 'N'),decode(bitand(o.flags, 16), 0, 'N', 16, 'Y', 'N')from sys.obj$ o, sys.user$ uwhere o.owner# = u.user#and o.linkname is nulland (o.type# not in (1  /* INDEX - handled below */,10 /* NON-EXISTENT */)or(o.type# = 1 and 1 = (select 1from sys.ind$ iwhere i.obj# = o.obj#and i.type# in (1, 2, 3, 4, 6, 7, 9))))and o.name != '_NEXT_OBJECT'and o.name != '_default_auditing_options_'and bitand(o.flags, 128) = 0union allselect u.name, l.name, NULL, to_number(null), to_number(null),'DATABASE LINK',l.ctime, to_date(null), NULL, 'VALID','N','N', 'N'from sys.link$ l, sys.user$ uwhere l.owner# = u.user#/3.oracle官方文档中关于ALL_OBJECTS的描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值