Admin/admin

Object의 Dependency확인하기 - utldtree.sql

Qhtlr 2007. 10. 30. 11:13

$ORACLE_HOME/rdbms/admin/utldtree.sql

Rem    NAME
Rem      deptree.sql - Show objects recursively dependent on given object
Rem    DESCRIPTION
Rem      This procedure, view and temp table will allow you to see all
Rem      objects that are (recursively) dependent on the given object.
Rem      Note: you will only see objects for which you have permission.
Rem      Examples:
Rem        execute deptree_fill('procedure', 'scott', 'billing');
Rem        select * from deptree order by seq#;
Rem
Rem        execute deptree_fill('table', 'scott', 'emp');
Rem        select * from deptree order by seq#;
Rem
Rem        execute deptree_fill('package body', 'scott', 'accts_payable');
Rem        select * from deptree order by seq#;
Rem
Rem        A prettier way to display this information than
Rem             select * from deptree order by seq#;
Rem        is
Rem             select * from ideptree;
Rem        This shows the dependency relationship via indenting.  Notice
Rem        that no order by clause is needed with ideptree.
Rem    RETURNS
Rem
Rem    NOTES
Rem      Run this script once for each schema that needs this utility.

예제]
SQL> exec deptree_fill('table','SCOTT','EMP');

SQL>  select * from deptree order by seq#;
NESTED_LEVEL TYPE               SCHEMA     NAME                                 SEQ#
------------ ------------------ ---------- ------------------------------ ----------
           0 TABLE              SCOTT      EMP                                     0
           1 TRIGGER            SCOTT      AFTER_INS_UPD_ON_EMP                    1
           1 PROCEDURE          SCOTT      GIVE_RAISE                              2
           1 UNDEFINED          SCOTT      EMP_SNAPSHOT                            3

SQL> select * from ideptree;

DEPENDENCIES
------------------------------------------------------------------------------------
TABLE SCOTT.EMP
   TRIGGER SCOTT.AFTER_INS_UPD_ON_EMP
   PROCEDURE SCOTT.GIVE_RAISE
   UNDEFINED SCOTT.EMP_SNAPSHOT