forked from dalibo/sqlserver2pgsql
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparams.json
More file actions
7 lines (7 loc) · 6.8 KB
/
Copy pathparams.json
File metadata and controls
7 lines (7 loc) · 6.8 KB
1
2
3
4
5
6
7
{
"name": "Sqlserver2pgsql",
"tagline": "Migration tool to convert a Microsoft SQL Server Database into a PostgreSQL database, as automatically as possible",
"body": "sqlserver2pgsql\r\n===========\r\n\r\nThis is a migration tool to convert a Microsoft SQL Server Database into a PostgreSQL database, as automatically as possible.\r\n\r\nIt is written in Perl.\r\n\r\n\r\nIt does two things:\r\n\r\n * convert a SQL Server schema to a PostgreSQL schema\r\n * produce a Pentaho Data Integrator (Kettle) job to migrate \r\n all the data from SQL Server to PostgreSQL. This second part is optionnal\r\n\r\n\r\nNotes, warnings:\r\n==========================\r\nThis tool will never be completely finished. For now, it works with all the SQL Server\r\ndatabases I had to migrate. If it doesn't work with yours, feel free to modify this,\r\nsend me patches, or the SQL dump from your SQL Server Database, with the\r\nproblem you are facing. I'll try to improve the code, but I need this SQL dump.\r\n\r\nIt won't migrate PL procedures, the languages are too different.\r\n\r\nI usually only test this script under Linux. It should work on Windows, as I had to do it once\r\nwith Windows, and on any Unix system.\r\n\r\n\r\nYou'll need to install a few things to make it work. See INSTALL.md\r\n\r\nInstall\r\n==========================\r\n\r\nSee https://github.com/dalibo/sqlserver2pgsql/blob/master/INSTALL.md\r\n\r\n\r\nUsage\r\n=============================\r\nOk, I have installed Kettle and Java, I have sqlserver2pgsql.pl, what do I do now ?\r\n\r\nYou'll need several things:\r\n\r\n * The connection parameters to the SQL Server database:\r\n IP address, port, username, password, database name\r\n * Access to an empty PostgreSQL database (where you want your migrated data)\r\n * A text file containing a SQL dump of the SQL Server database\r\n\r\nTo get this SQL Dump, follow this procedure, in SQL Server's management interface:\r\n * Under SQL Server Management Studio, Right click on the database you want to export\r\n * Select Tasks/Generate Scripts\r\n * Click \"Next\" on the welcome screen (if it hasn't already been desactivated)\r\n * Select your database\r\n * In the list of things you can export, just change \"Script Indexes\" from False to True, then \"Next\"\r\n * Select Tables then \"Next\"\r\n * Select the tables you want to export (or select all), then \"Next\"\r\n * Script to file, choose a filename, then \"Next\"\r\n * Select unicode encoding (who knows…, maybe someone has put accents in objects names, or in comments)\r\n * Finish\r\n\r\nYou'll get a file containing a SQL script. Get it on the server you'll want to\r\nrun sqlserver2pgsql.pl from.\r\n\r\nIf you just want to convert this schema, run:\r\n\r\n > sqlserver2pgsql.pl -f my_sqlserver_script.txt -b name_of_before_script -a name_of_after_script -u name_of_unsure_script\r\n\r\nThe before script contains what is needed to import data (types, tables and columns).\r\nThe after script contains the rest (indexes, constraints). It should be run\r\nafter data is imported. The unsure script contains objects where we attempt to migrate, but cannot guarantee,\r\nsuch as views.\r\n\r\n-conf uses a conf file. All options below can also be set there. Command line options will overwrite conf options.\r\nThere is an example of such a conf file (example_conf_file)\r\n\r\nYou can also use the -i, -num and/or -nr options:\r\n\r\n-i : Generate an \"ignore case\" schema, using citext, to emulate MSSQL's case insensitive collation.\r\n It will create citext fields, with check constraints.\r\n\r\n-nr : Don't convert the dbo schema to public. By default, this conversion is done, as it converts MSSQL's default\r\nschema to PostgreSQL's default schema\r\n\r\n-relabel_schemas is a list of schemas to remap. The syntax is : 'source1=>dest1;source2=>dest2'. Don't forget to quote this option or the shell might alter it\r\nthere is a default dbo=>public remapping, that can be cancelled with -nr. Use double quotes instead of simple quotes on Windows.\r\n\r\n-num : Converts numeric (xxx,0) to the appropriate smallint, integer or bigint. It won't keep the constraint on\r\nthe size of the scale of the numeric\r\n\r\n-validate_constraints=yes/after/no: for foreign keys, if yes: foreign keys are created as valid in the after script (default)\r\n if no: they are created as not valid (enforced only for new rows)\r\n if after: they are created as not valid, but the statements to validate them are put in the unsure file\r\n\r\nIf you want to also import data:\r\n\r\n > ./sqlserver2pgsql.pl -b before.sql -a after.sql -u unsure.sql -k kettledir \\ \r\n -sd source -sh 192.168.0.2 -sp 1433 -su dalibo -sw mysqlpass \\\r\n -pd dest -ph localhost -pp 5432 -pu dalibo -pw mypgpass -f sql_server_schema.sql\r\n\r\n-k is the directory where you want to store the kettle xml files (there will be\r\none for each table to copy, plus the one for the job)\r\n\r\nYou'll also need to specify the connection parameters. They will be stored inside the kettle files (in\r\ncleartext, so don't make this directory public):\r\n-sd : sql server database\r\n-sh : sql server host\r\n-sp : sql server port (usually 1433)\r\n-su : sql server username\r\n-sw : sql server password\r\n-pd : postgresql database\r\n-ph : postgresql host\r\n-pp : postgresql port\r\n-pu : postgresql username\r\n-pw : postgresql password\r\n-f : the SQL Server structure dump file\r\n\r\nYou've generated everything. Let's do the import:\r\n\r\n```\r\n # Run the before script (creates the tables)\r\n > psql -U mypguser mypgdatabase -f name_of_before_script\r\n # Run the kettle job:\r\n > cd my_kettle_installation_directory\r\n > ./kitchen.sh -file=full_path_to_kettle_job_dir/migration.kjb -level=detailed\r\n # Run the after script (creates the indexes, constraints...)\r\n > psql -U mypguser mypgdatabase -f name_of_after_script\r\n```\r\n\r\nIf you want to dig deeper into the kettle job, you can use kettle_report.pl to display the individual table's transfer performance. Then, if needed, you'll be able to modify the Kettle job to optimize it, using Spoon, Kettle's GUI\r\n\r\nYou can also use a configuration file if you like:\r\n\r\n > ./sqlserver2pgsql.pl -conf example_conf_file -f mydatabase_dump.sql\r\n\r\nThere is an example configuration file provided. You can also mix the configuration file with command line options. Command line options have the priority over values set in the configuration file.\r\n\r\nFAQ\r\n================================\r\n\r\nSee https://github.com/dalibo/sqlserver2pgsql/blob/master/FAQ.md\r\n\r\n\r\nLicence\r\n================================\r\n\r\nGPL v3 : http://www.gnu.org/licenses/gpl.html\r\n",
"google": "",
"note": "Don't delete this file! It's used internally to help with page regeneration."
}