Determine table load order with many foreign keys in to DB2 LUW 9.5
Posted on 2010-09-16
Objective: Loading many tables in the correct order to prevent foreign key and any other violations.
We have 60-90 tables that need to be loaded into a DB2 LUW 9.5 instance. There are a considerable number of foreign key relationships on many tables.
I "think" an SQL script that looks at various system tables, and produces a list of the "load order of tables" is needed. The list can include the type of table (table, view, nickname, etc), and any other information that you believe is useful (number of rows in the tables would be a plus, but certainly not necessary).
I have searched for hints or scripts that might provide this capability.
Notwithstanding RISKS, what about an sql script to disable keys, indices, foreign keys, et cetera prior to loading data? And a second SQL script to enable all of these subsequent load completion? Is that possible?
Finally, the only software tools we have available are Control Center and Data Studio 2.2. A third party ETL tool will be used to select and load the data (not DBLoad).
I may be asking for a lot, so I will make this a 500 point question; depending on responses I may award points to "best-assisted" answers too.
Please let me know if additional information is needed.