SQLpipe is a free, open-source tool that can transfer the result of a query, or an entire table, from SQL Server to Oracle.
If SQLpipe helps you, please consider starring our GitHub repository! It really helps us.
The easiest way to run SQLpipe is with Docker:
docker run --publish 9000:9000 --name sqlpipe sqlpipe/sqlpipe
There are multiple ways to acquire the program, however. You can view all of those ways on the SQLpipe downloads page.
Gather the following information for SQL Server:
Gather the following information for Oracle:
Transferring data is accomplished by sending a POST request to SQLpipe's /transfer/create route. You can send this kind of command any way you want - from an Airflow DAG, a Cron command, or just Curl on your command line. Here is an outline of the kind of payload you must submit:
{
"source-name": "<any name you like>",
"source-type": "mssql",
"source-connection-string": “Server=<hostname>,<port number>;Database=<db name>;User Id=<username>;Password=<password>;”,
"target-name": "<any name you like>",
"target-type": "oracle",
"target-connection-string": "oracle://<username>:<password>@<hostname>:<port>/<db name>?dba privilege=sysdba",
"source-schema": "<source schema name>",
"source-table": "<source table name>",
"target-table": "<target table name>",
"drop-target-table-if-exists": true,
"create-target-table-if-not-exists": true,
"target-schema": "<target schema name>",
"keep-files": true,
"target-hostname": "<hostname>",
"target-username": "<username>",
"target-password": "<password>",
"target-database": "<target db name>",
"target-port": <port>
}
To move the result of a query, you can use the following command as a starting command:
curl -d '{"source-name": "<any name you like>", "source-type": "mssql", "source-connection-string": “Server=<hostname>,<port number>;Database=<db name>;User Id=<username>;Password=<password>;”, "target-name": "<any name you like>", "target-type": "oracle", "target-connection-string": "oracle://<username>:<password>@<hostname>:<port>/<db name>?dba privilege=sysdba", "query": "<query>", "target-table": "<target table name>", "drop-target-table-if-exists": true, "create-target-table-if-not-exists": true, "target-schema": "<target schema name>", "keep-files": true, "target-hostname": "<hostname>", "target-username": "<username>", "target-password": "<password>", "target-database": "<target db name>", "target-port": <port>}' localhost:9000/transfers/create
To move an entire table (and gain slightly better automatic type inference), you can use the following command as a starting template:
curl -d '{"source-name": "<any name you like>", "source-type": "mssql", "source-connection-string": “Server=<hostname>,<port number>;Database=<db name>;User Id=<username>;Password=<password>;”, "target-name": "<any name you like>", "target-type": "oracle", "target-connection-string": "oracle://<username>:<password>@<hostname>:<port>/<db name>?dba privilege=sysdba", "source-schema":"<source schema name>", "source-table":"<source table name>", "target-table": "<target table name>", "drop-target-table-if-exists": true, "create-target-table-if-not-exists": true, "target-schema": "<target schema name>", "keep-files": true, "target-hostname": "<hostname>", "target-username": "<username>", "target-password": "<password>", "target-database": "<target db name>", "target-port": <port>}' localhost:9000/transfers/create
If the command is successful, the program will tell you that a transfer was queued:
{
"query-transfer": {
"id": "280a8118-9e81-4fcb-ae3b-752a9434bc52",
"created-at": "2023-11-20T16:53:03.383116946Z",
"status": "queued",
"keep-files": true,
"tmp-dir": "/tmp/sqlpipe/280a8118-9e81-4fcb-ae3b-752a9434bc52",
"pipe-file-dir": "/tmp/sqlpipe/280a8118-9e81-4fcb-ae3b-752a9434bc52/pipe-files",
"final-csv-dir": "/tmp/sqlpipe/280a8118-9e81-4fcb-ae3b-752a9434bc52/final-csv",
"source-connection-info": {
"instance-name": "my-source",
"type": "mssql",
"hostname": "",
"database": "",
"username": ""
},
"target-connection-info": {
"instance-name": "my-target",
"type": "oracle",
"hostname": "oracle",
"port": 1521,
"database": "mydb",
"username": "mydb_admin"
},
"drop-target-table-if-exists": true,
"create-target-schema-if-not-exists": false,
"create-target-table-if-not-exists": true,
"source-schema": "dbo",
"source-table": "my_table",
"target-schema": "mydb_admin",
"target-name": "mssql_my_table",
"delimiter": "{dlm}",
"newline": "{nwln}",
"null": "{nll}"
}
}
If you make a mistake submitting the data, SQLpipe will do its best to tell you what's wrong. For example, if you forgot to specify a target table, it would return:
{
"error": {
"target-table": "must be provided"
}
}
Yes, it really is that easy!
If you’d like more in-depth documentation, or want to let us know about a bug, we please make an issue on SQLpipe’s Github page.