To get the tree list of the objects on which an object depends
2009-09-30 18:57
3719 查看
Short desc | To get the tree list of the objects on which an object depends |
Os | Any |
Tested on | |
Remarks | The calling user must have the select privilege on the SYS underlying tables. For instance, DBA role, or SELECT ANY TABLE privilege in 8i and SELECT ANY DICTIONARY in 9i. |
Submitted by | Michel Cadot |
Date | Feb 2004 |
Category | |
Description | This script gives the tree of all objects on which the passing object depends. |
Define THEOBJECT = &2
Define THETYPE = &3
Set linesize 100
Column obj_ format a100 heading "'&THEOWNER..&THEOBJECT' (&THETYPE) depends on"
select substr(lpad(' ',2*(r.lvl-1))||
decode(o.linkname, null, u.name, o.remoteowner)||
'.'||o.name||
decode(o.linkname, null, '', '@'||o.linkname)||
' ('||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',
39, 'LOB PARTITION',
40, 'LOB SUBPARTITION',
42, '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',
62, 'EVALUATION CONTEXT',
'UNDEFINED')||')'
,1,100) obj_
from sys.disk_and_fixed_objects o, sys.user$ u,
( select level lvl, d.p_obj# obj#, rownum nb
from sys.dependency$ d
connect by d.d_obj# = prior d.p_obj#
start with d.d_obj# in
( select obj# from sys.obj$
where owner# = (select user# from sys.user$
where name = upper('&THEOWNER'))
and name = upper('&THEOBJECT')
and type# = decode(upper('&THETYPE'), 'NEXT OBJECT', 0,
'INDEX', 1, 'TABLE', 2, 'CLUSTER', 3,
'VIEW', 4, 'SYNONYM', 5,
'SEQUENCE', 6, 'PROCEDURE', 7,
'FUNCTION', 8, 'PACKAGE', 9,
'PACKAGE BODY', 11, 'TRIGGER', 12,
'TYPE', 13, 'TYPE BODY', 14,
'TABLE PARTITION', 19,
'INDEX PARTITION', 20, 'LOB', 21,
'LIBRARY', 22, 'DIRECTORY', 23,
'QUEUE', 24, 'JAVA SOURCE', 28,
'JAVA CLASS', 29, 'JAVA RESOURCE', 30,
'INDEXTYPE', 32, 'OPERATOR', 33,
'TABLE SUBPARTITION', 34,
'INDEX SUBPARTITION', 35,
'LOB PARTITION', 39,
'LOB SUBPARTITION', 40,
'MATERIALIZED VIEW', 42,
'DIMENSION', 43, 'CONTEXT', 44,
'RULE SET', 46, 'RESOURCE PLAN', 47,
'CONSUMER GROUP', 48,
'SUBSCRIPTION', 51, 'LOCATION', 52,
'XML SCHEMA', 55, 'JAVA DATA', 56,
'SECURITY PROFILE', 57,
'EVALUATION CONTEXT', 62)
) ) r
where u.user# = o.owner#
and o.obj# = r.obj#
order by r.nb
/
SELECT NAME, REFERENCED_NAME
FROM USER_DEPENDENCIES
WHERE TYPE = 'VIEW'
AND NAME = <NAME OF THE VIEW>;
相关文章推荐
- The method below converts an array of objects to a DataTable object in C#.
- How to get the published properties of an persistent object
- Get to the Top on Google: Tips and Techniques to Get Your Site to the Top of the Search Engine Ranki
- How to put an object on the request in a servlet
- Fast ways in R to get the first row of a data frame grouped by an identifier
- sql server query to get the list of column name in a table
- Data Structure Linked List: Write a function to get the intersection point of two Linked Lists.
- uiview 某点返回 色值 How to get the color of a pixel in an UIView?
- Passing a list of objects from view to controller via jquery ajax(Json(aspx) -> object(C#))
- How to get the data from a cell when I click on the GridButtonColumn of the same row
- The "." operator was supplied with an index value of type "java.lang.String" to be applied to a List
- 实现Parcelable接口,Writing a list of parcelable objects to a parcelable object
- An object in the SharePoint administrative framework could not be deleted because other objects depend on it.
- From an inner class, "this" points to the inner object. How do I get a "this" pointer to the enclosing object?
- INS-35354] The system on which you are attempting to install Oracle RAC is not part of a valid clust
- It Depends Deciding on the Correct Ratio of Developers to Testers
- 92 Examine the output of the query that you executed to list the objects in the recycle bin: SQL> SE
- convert the contents of an NSData object to an NSString
- Err:The "." operator was supplied with an index value of type "java.lang.String" to be applied to a List or array
- How do I get the name of an object's type in JavaScript