Amazon books

Thursday, April 29, 2010

Checking Dependency Objects using dba_dependencies or utldtree.sql

If I need to find out recursively dependent objects from an object I usually execute one of these two methods:

########################################################
1-Use the dba_dependencies view
col owner for a15
col name for a30
col type for a10
col referenced_owner for a15
col referenced_name for a30
col referenced_link_name for a10

select
*
from
dba_dependencies
where
name='TAB_EMP' and owner='PKG';

OWNER NAME TYPE REFERENCED_OWNE REFERENCED_NAME REFERENCED_TYPE REFERENCED DEPENDENCY_TYPE
--------------- ------------------------------ ---------- --------------- ------------------------------ ------------------ ---------- ---------------
PKG TAB_EMP TABLE SYS STANDARD PACKAGE HARD
PKG TAB_EMP TABLE PKG EMP_PERSON_TYP TYPE HARD

2-Use the utldtree.sql package. This package creates a procedure named deptree_fill and can be used as follows:

--run utldtree to create the procedure and view (user must be SYS in order to see all dependencies)
SQL>@?/rdbms/admin/utldtree.sql
SQL> exec deptree_fill(type =>'TABLE',schema => 'PKG',name => 'EMP_PERSON_OBJ_TABLE');

PL/SQL procedure successfully completed

SQL> select * from deptree order by seq#;

NESTED_LEVEL TYPE SCHEMA NAME SEQ#
------------ ---------- ------------------------------ ------------------------------ ----------
0 TABLE PKG EMP_PERSON_OBJ_TABLE 0

SQL> select * from ideptree;

DEPENDENCIES
--------------------------------------------------------------------------------
TABLE PKG.EMP_PERSON_OBJ_TABLE


########################################################


Regards,
Paulo Portugal

No comments:

Post a Comment