Skip to content

Windows Psql connecting and running script command

ertemmstein edited this page Apr 18, 2019 · 19 revisions

Create Scripts

perl .\sqlserver2pgsql.pl -f [MSSQLDBSCRIPT] -b output_before_script -a output_after_script -u output_unsure_script

Create Schema

psql -f [output_before_script] -U [PQSQLUSER] -h [PQSQLHOSTIP] -p [PORT] [PQSQLDBNAME]

Create kettle data migration job

perl .\sqlserver2pgsql.pl -b output_before_script -a output_after_script -u output_unsure_script -k [KETTLE_FULLPATH]\data-integration -sd [MSSQLDBNAME] -sh [MSSQLHOSTIP] -sp [PORT] -su [MSSQLUSER] -sw [MSSQLPASSWORD] -pd [PQSQLDBNAME] -ph [PQSQLHOSTIP] -pp [PORT] -pu [PQSQLUSER] -pw [PQSQLPASSWORD] -f [MSSQLDBSCRIPT]

Start data migration

Note : You must run SpoonConsole.bat(inside Kettle base folder) once then under the .kettle folder(Users/[Username]/.kettle) add this line to

  • kettle.properties file : KETTLE_EMPTY_STRING_DIFFERS_FROM_NULL=Y
  • Run this command (In kettle base directory):
    .\kitchen.bat -file=[KETTLE_FULLPATH]\data-integration\migration.kjb -level=detailed

Create the indexes, constraints...

psql -f output_after_script -U [PQSQLUSER] -h [PQSQLHOSTIP] -p [PORT] [PQSQLDBNAME]