If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Dependent tables

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-03-08, 17:10
dba_udb dba_udb is offline
Registered User
 
Join Date: Mar 2005
Posts: 73
Dependent tables

OS: SOl 2,9
DB2 9.1 FP4.

All , How do i figure out the dependent tables for a particular tables
or on what table this particular table is dependent on.

I was importing a lot of data and i had plenty of issues because the tables
are either has dependent table or it was a dependent for soem other table.

Is there a easy way to order the tables , like dependents first so that i can load them first.

thanks
Reply With Quote
  #2 (permalink)  
Old 12-03-08, 17:31
Peter.Vanroose Peter.Vanroose is offline
Registered User
 
Join Date: Sep 2004
Location: Belgium
Posts: 1,079
Quote:
Originally Posted by dba_udb
Is there a easy way to order the tables, like dependents first so that i can load them first.
I would suggest you turn off constraint checking on all loads; and afterwards use the SET INTEGRITY command. See e.g. p.166 of the "Data Movement Utilities" guide, SC23-5847-01.
The tables will be temporarily in "integrity pending" state during these opterations.

Actually, there is a way to find out about dependencies (by checking the catalog), but you could actually have a "chicken and egg" problem where there is a circular dependency. In that case, none op the possible load sequences would work!
__________________
--_Peter Vanroose,
__IBM Certified Database Administrator, DB2 9 for z/OS
__IBM Certified Application Developer
__ABIS Training and Consulting
__http://www.abis.be/
Reply With Quote
  #3 (permalink)  
Old 12-04-08, 03:51
JAYANTA_DATTA JAYANTA_DATTA is offline
Registered User
 
Join Date: Oct 2004
Location: DELHI INDIA
Posts: 336
You can also try the following:

select tabname,reftabname from syscat.REFERENCES where tabschema = 'TEST_SCH' and tabname like 'TB_TES%' with ur

Where TABNAME is the CHILD Table and REFTABNAME is the PARENT table.
__________________

Jayanta Datta
DB2 UDB DBA
IBM India, Global Delivery
New Delhi
Reply With Quote
  #4 (permalink)  
Old 12-04-08, 04:22
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
That will only gather the first level of dependencies, of course. You need a recursive query (see the manuals and search for "Bill of materials") to really get all of them. You will have to take care of circular dependencies in the query as Peter noted.
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
Reply With Quote
  #5 (permalink)  
Old 12-04-08, 05:07
JAYANTA_DATTA JAYANTA_DATTA is offline
Registered User
 
Join Date: Oct 2004
Location: DELHI INDIA
Posts: 336
I see what you are saying. May be if you are interested in looking into the dependency as the pesron on the top is asking for systematic LOAD/IMPORT, the SYSCAT query can be used to understand the dependency level. Moreover for multiple dependencies (in case exists), then the CREAT_TIME field can be used from the REFERENCES table with DESCending option. But yes, do completely agree, if he is least interested to know the dependency, then JUST RUN the LOAD one after another (swicthing off CHECK), and execute INTEGRITY after all Loads are done.
__________________

Jayanta Datta
DB2 UDB DBA
IBM India, Global Delivery
New Delhi
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On