Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2005
    Posts
    73

    Unanswered: 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

  2. #2
    Join Date
    Sep 2004
    Location
    Belgium
    Posts
    1,126
    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/

  3. #3
    Join Date
    Oct 2004
    Location
    DELHI INDIA
    Posts
    338
    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

  4. #4
    Join Date
    Jan 2007
    Location
    Jena, Germany
    Posts
    2,721
    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

  5. #5
    Join Date
    Oct 2004
    Location
    DELHI INDIA
    Posts
    338
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •