How to get all the dependencies Oracle object

1. You want to define all used objects, a change which may affect your object:

select 
    level as hlevel, -- dependencies level
    referenced_owner as ref_owner, -- referenced owner name
    lpad(' ', 2*(level-1)) || referenced_name as ref_name,  -- refernced object name
    referenced_type as ref_type, -- referenced object type
    owner parent_owner, -- parent owner name
    name parent_name, - parent object name
    type parent_type -- parent object type
from dba_dependencies
where referenced_owner not in ('SYS', 'SYSTEM', 'PUBLIC')
start with
    owner = :owner -- owner name of your object
    and name = :object -- your object name
connect by owner = prior referenced_owner
    and name = prior referenced_name
    and type = prior referenced_type
ORDER SIBLINGS BY referenced_name; 

2. You want to define all the objects that are affected by changing of your object:

select 
    level as hlevel, -- dependencies level
    owner as parent_owner, -- parent owner name
    lpad(' ', 2*(level-1)) || name as parent_name, -- parent object name
    type as parent_type, -- parent object type
    referenced_owner, -- referenced owner name
    referenced_name, -- referenced object name
    referenced_type -- referenced object type
from dba_dependencies
where referenced_owner not in ('SYS', 'SYSTEM', 'PUBLIC')
start with
    referenced_owner = :owner -- owner name of your object
    and referenced_name = :object -- your object name
connect by prior owner = referenced_owner
    and prior name = referenced_name
    and prior type = referenced_type
ORDER SIBLINGS BY name
; 

 

Реклама