Using Oracle SQL Developer, you can export databases to SQL scripts (only for INSERT statements) using the menu item "Tools"> "Export Database". The problem is that the table is exported in alphabetical order, and it does not seem possible to change this order (or I did not find how to proceed at least).
This is a problem because when you have foreign key constraints, it is possible that the exported SQL script cannot be imported back, since the parents must be inserted in front of the children. Assume that B is the parent and A is the child, (simplified) SQL Server SQL developer, the exported SQL script will be:
INSERT A; <-- error: B is needed
INSERT B;
So, does anyone have a solution:
- or export a database with automatically ordered table insert operators, depending on foreign key constraints,
- or export a database by manually specifying the order of table insert statements,
- or temporarily disable foreign key constraints to be able to import the script in alphabetical order, and then re-enable constraints
?
PS: the idea is to allow table structures as is, and only to import data.
sp00m source
share