Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: [Q] Load (or delete) order

Re: [Q] Load (or delete) order

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Mon, 16 Aug 1999 11:34:50 GMT
Message-ID: <37b8f661.2012714@newshost.us.oracle.com>


A copy of this was sent to "Vladik" <reason_at_shadow.net> (if that email address didn't require changing) On Fri, 13 Aug 1999 21:14:51 -0400, you wrote:

>Well,
>I did not hear any responses sofar. So I guess
>there is no script like that. I was also
>told that Oracle does not provide any program that helps in
>that area. I am surprised, it seems like figuring
>out dependencies amongst tables is something a lot
>of people would be interested it.
>

there are the views all_dependencies and user_dependencies that show the relationships. In the end tho -- its not a 100% solvable problem.

put these tables into your database and see what happens to your C program :) you might be surprised..

SQL> create table t1 ( x int primary key, y int );

Table created.

SQL> create table t2 ( a int primary key, b int references t1(x) );

Table created.

SQL> alter table t1 add constraint t1_fk foreign key (y) references t2(a);

Table altered.

SQL> create table t3 ( x int primary key, y int references t3(x) );

Table created.

>Anyways, I solved this by writing a C program
>that builds a dependency tree structure. And
>then prints out notes on each level.
>Each node is either a parent or a child. A parent
>node represents a table that needs to be populated
>before a child table can be populated. Parent-Child
>relation ship can be obtained from user_constraints.
>Once the tree is built if traversed from top level
>to bottom -- table names for the load order will
>be printed, and the delete order is just a reverse of load.
>
>Vladislav
>
>
><vladik854_at_my-deja.com> wrote in message news:7ond1k$vtc$1_at_nnrp1.deja.com...
>> Hello,
>> does anyone know of a script that can figure
>> out the load (or delete) order for oracle tables
>> We have a lot of tables with tons of referential integrity
>> constraints and I need to know the order at wich I have
>> to delete tables (it is a reverse of load order)
>>
>> I know that there is a way to do that because Oracle importer
>> does the same things when loading tables .
>>

No, it loads the tables and then goes back and enables constraints. It does not bother with trying to figure out (the sometimes impossible) load order of tables....

>> Thanks in advance.
>> If, possible, I would appreciate an e-mail
>> back at vlpa_at_daleen.com
>>
>>
>> Sent via Deja.com http://www.deja.com/
>> Share what you know. Learn what you don't.
>

--
See http://govt.us.oracle.com/~tkyte/ for my columns 'Digging-in to Oracle8i'... Current article is "Part I of V, Autonomous Transactions" updated June 21'st  

Thomas Kyte                   tkyte_at_us.oracle.com
Oracle Service Industries     Reston, VA   USA

Opinions are mine and do not necessarily reflect those of Oracle Corporation Received on Mon Aug 16 1999 - 06:34:50 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US