Migration guide: IBM Db2 to SQL Server
Applies to: SQL Server
In this guide, you learn how to migrate your user databases from IBM Db2 to SQL Server by using SQL Server Migration Assistant (SSMA) for Db2.
For other migration guides, see Azure Database Migration Guides.
Prerequisites
Before you begin migrating your Db2 database to SQL Server, perform the following steps:
- Verify that your source environment is supported.
- Download and install SSMA for Db2.
- Get connectivity and sufficient permissions to access both source and target.
Pre-migration
After you meet the prerequisites, you're ready to discover the topology of your environment and assess the feasibility of your migration.
Assess and convert
Use SSMA for Db2 to review database objects and data, and assess your databases for migration.
To create an assessment, perform the following steps:
Open SSMA for Db2.
Select File, and then select New Project.
Provide a project name and location and then, in the dropdown list, select a SQL Server migration target. Select OK.
Select Connect to Db2, and then enter the Db2 connection details.
Right-click the Db2 schema you want to migrate, and then select Create report to generate an HTML report. Alternatively, you can select Create report at the upper right.
Review the HTML report to understand the conversion statistics and any errors or warnings. You can also open the report in Excel to get an inventory of Db2 objects and the effort required to perform schema conversions. The default location for the report is in the report folder within SSMAProjects, as shown here:
drive:\<username>\Documents\SSMAProjects\MyDb2Migration\report\report_<date>
Validate data types
Validate the default data-type mappings, and change them based on requirements, if necessary. To do so, perform the following steps:
Select Tools, and then select Project Settings.
Select the Type mapping tab.
You can change the type mapping for each table by selecting the table name on the Db2 Metadata explorer pane.
Convert schema
To convert the schema, perform the following steps:
(Optional) To convert dynamic or specialized queries, right-click the node, and then select Add statement.
Select the Connect to SQL Server tab, and then enter the connection details for your SQL Server instance.
Right-click the schema you're working with, and then select Convert Schema. Alternatively, you can select the Convert Schema tab at the upper right.
After the conversion is completed, compare the converted structure to the original structure to identify potential problems, and address them based on the recommendations.
On the output pane, select the Review results icon, and then review any errors on the Error list pane.
For an offline schema remediation exercise, save the project locally by selecting File > Save Project. Doing so gives you an opportunity to evaluate the source and target schemas offline and remediate them before you publish the schema to your SQL Server instance.
Migrate
After you complete assessing your databases and addressing any discrepancies, the next step is to run the migration process.
To publish your schema and migrate your data, perform the following steps:
Publish the schema. On the SQL Server Metadata Explorer pane, right-click the database, and then select Synchronize with Database.
Migrate the data. On the Db2 Metadata Explorer pane, right-click the schema or object you want to migrate, and then select Migrate Data. Alternatively, you can select the Migrate Data tab at the upper right.
To migrate data for an entire database, select the check box next to the database name. To migrate data from individual tables, expand the database, expand Tables, and then select the check box next to the table. To omit data from individual tables, clear the check box.
Provide connection details for both the Db2 and SQL Server instances.
After the migration is completed, view the Data Migration Report.
Connect to your SQL Server instance by using SQL Server Management Studio (SSMS), and then validate the migration by reviewing the data and schema.
Post-migration
After you successfully complete the migration stage, you need to complete a series of post-migration tasks to ensure that everything is functioning as smoothly and efficiently as possible.
Remediate applications
After you migrate the data to the target environment, all the applications that formerly consumed the source need to start consuming the target. Accomplishing this step can require some changes to the applications.
Perform tests
The test approach to database migration consists of the following activities:
Develop validation tests: To test the database migration, you need to use SQL queries. You must create the validation queries to run against both the source and target databases. Your validation queries should cover the scope you defined.
Set up a test environment: The test environment should contain a copy of the source database and the target database. Be sure to isolate the test environment.
Run validation tests: Run validation tests against the source and the target, and then analyze the results.
Run performance tests: Run performance tests against the source and the target, and then analyze and compare the results.
Migration assets
For more assistance with completing this migration scenario, see the following resources. They were developed in support of a real-world migration project engagement.
Title | Description |
---|---|
Data workload assessment model and tool | Provides suggested "best fit" target platforms, cloud readiness, and application/database remediation levels for specified workloads. It offers simple, one-click calculation, and report generation that helps to accelerate large estate assessments by providing an automated, uniform target-platform decision process. |
IBM Db2 zOS data assets discovery and assessment package | After running the SQL script on a database, you can export the results to a file on the file system. Several file formats are supported, including CSV, so that you can capture the results in external tools, such as spreadsheets. This method can be useful if you want to easily share results with teams that don't have the workbench installed. |
IBM Db2 LUW inventory scripts and artifacts | Includes a SQL script that queries IBM Db2 LUW version 11.1 system tables, and provides results in CSV format of the following items: a count of objects by schema and object type, a rough estimate of "Raw Data" in each schema, and the sizing of tables in each schema. |
IBM Db2 to SQL Server - Database Compare utility | The Database Compare utility is a Windows console application that you can use to verify that the data is identical both on source and target platforms. You can use the tool to efficiently compare data, down to the row or column level in all or selected tables, rows, and columns. |
The Data SQL Engineering team developed these resources. This team's core charter is to unblock and accelerate complex modernization for data platform migration projects to Microsoft's Azure data platform.