Re: How to export if I have foreign keys?
Posted by: Michael Buell
Date: May 12, 2005 07:07AM

If this is any help. I am no expert but I have a db that uses a lot of primary / foreign key restraints throughout. What I have found to work best when I have done an export -> import is this.

Rather than just doing a mysql_dump which exports by table name alphabetically.

First export your entire DB STRUCTURE ONLY, that will do the CREATE followed by ALTER statements to set up the key relationships. export_structure.sql

Then Select only your primary key tables to export data and save that dump in a file by itself , export_prime.sql

Then select all of your foreign key tables into another file, export_foreign.sql

I also have a number of tables that I refer to as domain tables or list tables. These are stand-alone tables. I export those seperately from the key tables , export_domains.sql

Then do your import starting with the structure which will create a dublicate db. Then import the prime, then the foreigns and then the stand-alones.

This process although requireing several more steps has never failed for me.

Options: ReplyQuote


Subject
Written By
Posted
Re: How to export if I have foreign keys?
May 12, 2005 07:07AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.