This topic describes how to migrate a database from SQL Server to Babelfish for ApsaraDB RDS for PostgreSQL. Babelfish's compatibility features enable you to migrate quickly without extensive code rewrites, reducing effort and saving resources.
Prerequisites
-
You have created a Babelfish for ApsaraDB RDS for PostgreSQL instance. For more information, see Create a Babelfish for ApsaraDB RDS for PostgreSQL instance.
-
You have created a Babelfish account. For more information, see Manage Babelfish accounts.
-
You have configured an IP address whitelist to allow the client's server to access the Babelfish for ApsaraDB RDS for PostgreSQL instance. For more information, see Configure an IP address whitelist.
-
You have obtained the endpoint and TDS port of the Babelfish for ApsaraDB RDS for PostgreSQL instance. For more information, see View the endpoint and TDS port number.
Procedure
-
Export table objects and data from the SQL Server database.
-
Use the SQL Server Management Studio (SSMS) client to connect to the SQL Server database. For more information, see Connect to a SQL Server instance by using SQL Server Management Studio (SSMS).
-
In Object Explorer, right-click the target database under the SQL Server instance, and then click .
-
Complete the Generate Scripts wizard to export a
.sqlfile.-
Overview: No configuration is required. Click Next.
-
Choose Objects: Select Script entire database and all database objects, and then click Next.
-
Set Scripting Options: Select Save as script file, specify a File Name, and then click Next.
-
To export the database schema (DDL), click Advanced. In the Advanced Scripting Options dialog box, set Script triggers to True, and click OK.
-
To export the data (DML), click Advanced and set Type of data to script to Data only.
-
-
Digest: No configuration is required. Click Next.
-
Save Scripts: No configuration is required. Click Done.
The exported
.sqlfile is saved to the path you specified in the Set Scripting Options step. -
-
-
Use the Babelfish Compass assessment tool to assess the T-SQL statements for compatibility with Babelfish and then adapt them accordingly.
NoteFor information about how to obtain and use the Babelfish Compass tool, see the official Babelfish Compass documentation.
-
Execute the adapted SQL statements in Babelfish.
-
Connect to the TDS port of the Babelfish for ApsaraDB RDS for PostgreSQL instance. For more information, see Client connection examples.
-
Execute the adapted SQL statements sequentially on the ApsaraDB RDS for PostgreSQL instance.
-
Related documents
-
Obtaining and using the Babelfish Compass tool: see the official Babelfish Compass documentation.
-
Connecting to a Babelfish instance: see Client connection examples.
-
Viewing instance endpoints and TDS ports: see View the endpoint and TDS port number.