When you extract a remote site, the extraction routine pulls out the tables in an order so as to not run into integrity issues. How does it know what order to place into the reload file?

I need to write some routines to pull out data from certain tables, but I also need to reload them in order. I'm hoping there is something in the system tables that can help me accomplish this.

Thanks.

asked 14 May '10, 00:07

Calvin%20Allen's gravatar image

Calvin Allen
1.5k232638
accept rate: 25%

Have a look at the WAIT_FOR_COMMIT option... that might make ordering the inserts unnecessary.

(14 May '10, 07:47) Breck Carter
1

@Breck: However, then one can't use LOAD TABLE as that does an automatic commit...

(14 May '10, 09:55) Volker Barth

AFAIK, the DBXTRACT tool (and DBUNLOAD, too) create and load tables in chronological order, i.e. sorted by *systable.table_id* (and the table_id is used as file name for the unloaded data).

The "not running into integrity issues" feature arises from the fact that FKs are built via "ALTER TABLE t ADD FOREIGN KEY ..." after the load table statements, so that the order of LOADING TABLES is not important at all. (Cf. this question)

However, when you have to extract data in already existing tables with already declared FKs then you should build the order based on FKs. For that, you will have to query the system catalog, primarily table SYSFOREIGNKEY.

permanent link

answered 14 May '10, 09:54

Volker%20Barth's gravatar image

Volker Barth
31.3k312458674
accept rate: 32%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×114
×25
×14
×7

question asked: 14 May '10, 00:07

question was seen: 803 times

last updated: 14 May '10, 09:54