I need to convert the structure of PostgreSQL databases to Oracle. In PostgreSQL, I have a postgres database with data. In Oracle I have a blank database in which I want to write postgres database which in PostgreSQL.
In fact, I do not need the data, only the structure (relationships).
For this I use Liquibase. I get the changelog from PostgreSQL with the command:
- liquibase \
--driver=org.postgresql.Driver \
--classpath="C:\db_drivers\postgresql-9.3-1102.jdbc3.jar" \
--changeLogFile="./postgresql_changelog.xml" \
--url="jdbc:postgresql://localhost:5432/postgres" \
--username=schema_name_here \
--password=************** \
--logLevel=debug \
--defaultSchemaName=sep \
generateChangeLog
After this I try to create objects in the Oracle database:
-
liquibase
--driver=oracle.jdbc.OracleDriver
--classpath="C:\db_drivers\ojdbc14.jar"
--changeLogFile="./postgresql_changelog.xml"
--url="jdbc:oracle:thin:@ip_here:orabeta"
--username=***
--password=***
update
Does not work: ORA-00902
Here is a fragment of postgresql_changelog.xml:
I also generate a pure SQL- file:
-
liquibase
--driver=oracle.jdbc.OracleDriver
--classpath="C:\db_drivers\ojdbc14.jar"
--changeLogFile="./postgresql_changelog.xml"
--url="jdbc:oracle:thin:@ip_here:orabeta"
--username=***
--password=***
updateSQL > update.sql
Here is a fragment of update.sql:
-
...
CREATE TABLE SCHEMA_HERE.TABLE1A (total_pk INT8 NOT NULL, form_fk INT8, .....etc );
INSERT INTO SCHEMA_HERE.TABLE1A (ID, FORM_ID, ...etc)
...
I would like to generate the file, in which all data types correspond to the target database, ie that I want to create. I can write a simple parser that replace data types, but it is not the right solution - can be many database.
It possible to generate XML/ SQL output with data types of target database?
Or maybe there is an option that allow to generate output with "abstract" data types? Ie with the data types that are not in the real databases, for example, instead of INT8 - Integer, etc.
I would be very grateful for the information. Thanks to all.