Call now: 252-767-6166  
Oracle Training Oracle Support Development Oracle Apps

 E-mail Us
 Oracle Articles
New Oracle Articles

 Oracle Training
 Oracle Tips

 Oracle Forum
 Class Catalog

 Remote DBA
 Oracle Tuning
 Emergency 911
 RAC Support
 Apps Support
 Oracle Support

 SQL Tuning

 Oracle UNIX
 Oracle Linux
 Remote s
 Remote plans
 Application Server

 Oracle Forms
 Oracle Portal
 App Upgrades
 SQL Server
 Oracle Concepts
 Software Support

 Remote S


 Consulting Staff
 Consulting Prices
 Help Wanted!


 Oracle Posters
 Oracle Books

 Oracle Scripts

Don Burleson Blog 








Oracle - Tracking constraint dependencies

Oracle Database Tips by Donald Burleson

Question:  I know that the Oracle data pump utility (expdp and impdp) will extract and re-add tables in their proper order to avoid constraint violations.  What are the other Oracle data dictionary views that are used to track object dependencies and how do I write a script to display tables in their reverse-order of constrain dependence?

Answer:  Oracle has several ways.  One is the dba_dependencies view and we also have the utldtree utility.

Using the dba_dependencies View to display dependencies

See here for my full notes and script on dba_dependencies.  Here is a global script to display all tables which have dependencies upon other tables.  Just change the "my_tablename" value:

column c1 heading "object|level"         format a16
column c2 heading "object|name"          format a40
column c3 heading "referencing|object"   format a40

   lpad (' ', 2 * (level - 1)) || to_char (level, '999') as c1,
   owner || '.' || name || ' (' || type || ')' as c2,
   referenced_owner || '.' || referenced_name || ' (' || referenced_type || ')' as c3
start with
   owner = 'SYS'
   name = 'my_tablename'
connect by prior
   referenced_owner = owner
and prior
   referenced_name = name
and prior
   referenced_type = type
   type = 'TABLE';

Using the utldtree utility

Oracle provides utldtree.sql in your $ORACLE_HOME/rdbms/admin directory for displaying any object (tables, stored procedures) and all of their dependencies.

When you execute utldtree.sql, a procedure named deptree_fill is created, and youi specify the object name and type:

deptree_fill('object_type', 'object_owner', 'object_name');

You are now able to execute the deptree_fill procedure, followed by a query to the resulting ideptree table:

SQL> exec deptree_fill('TABLE','SCOTT','EMP');

SQL> select * from ideptree;

If you like Oracle tuning, see the book "Oracle Tuning: The Definitive Reference", with 950 pages of tuning tips and scripts. 

You can buy it direct from the publisher for 30%-off and get instant access to the code depot of Oracle tuning scripts.



Oracle Training at Sea
oracle dba poster

Follow us on Twitter 
Oracle performance tuning software 
Oracle Linux poster


Burleson is the American Team

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals.  Feel free to ask questions on our Oracle forum.

Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Errata?  Oracle technology is changing and we strive to update our BC Oracle support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:  

and include the URL for the page.


Burleson Consulting

The Oracle of Database Support

Oracle Performance Tuning

Remote DBA Services


Copyright © 1996 -  2020

All rights reserved by Burleson

Oracle ® is the registered trademark of Oracle Corporation.