Does exporting database as CSV retain its schema?

95 Views Asked by At

I want to migrate a database from Btrieve (PSQL) to Oracle. For this i'll first convert my source db to CSV then i'll convert exported CSV to target db. I'm not sure but as far as i know, it is not possible to get schema retained while exporting a DB to CSV.

1

There are 1 best solutions below

0
On

It retains its schema insofar as it can tell you the column names, and column order. And from values, you can derive the column type (for example lots of unquoted numbers suggest an int or decimal type).

But it doesn't maintain useful things like primary keys, foreign keys, constraints, defaults.

You can try getting and copying a table schema from the source db, then pasting and running it against to your new db and see if it works (with some minor tweaks). Or you could use a tool like liquibase which should be able to help here.