To schedule conversion or call database migration from an automation script you can use console version of PostgreSQL to MySQL converter. This is the file P2SAGENT.EXE in the installation folder. The program accepts the following parameters:
--dest=... | MySQL database name | |
--dump | convert PostgreSQL database into MySQL script file | |
--help | display help message and exit | |
--logfile=... | path to the logfile where execution traces will be written | |
--mode=... | how to process existing MySQL database (0 - overwrite the entire database, 1 - overwrite existing tables only, 2 - skip existing tables, 3 - merge, 4 - synchronize) |
|
--mysqlh=... | MySQL server IP address or network name | |
--mysqlu=... | MySQL user name | |
--mysqlp=... | MySQL user password | |
--myport=... | MySQL port | |
--no_schema | do not include schema name in table name | |
--pgport=... | PostgreSQL port | |
--posgsh=... | PostgreSQL server IP address or network name | |
--posgsu=... | PostgreSQL user name | |
--posgsp=... | PostgreSQL user password | |
--profile=... | path to the file to load conversion settings from | |
--silent | use this option to disable program output | |
--skip_idx | skip converting indexes | |
--src=... | PostgreSQL database name | |
--tab_def | convert table definitions only | |
--tab_file=... | file containing table names to convert (one table name per line) | |
--views | convert PostgreSQL views into MS SQL format |
In the following example the program converts all tables from PostgreSQL database "db 1" into MySQL database "db1_sql":
P2SAGENT.EXE --src="db 1" --posgsu=postgres --posgsp=qwerty --dest="db1_sql" --mysqlh=orahost --mysqlu=SYSTEM --mysqlp=the_passsword
Notes: