IBM DB2 and SQL Server are popular relational database management systems. While IBM DB2 is strictly for enterprise database management, SQL Server works on the Windows operating system and Microsoft Azure as a backend for various applications. If you need to convert from DB2 to SQL Server, this DB2 database migration guide will overview the steps you need to take.

1. Get Familiar With SSMA

Microsoft designed SQL Server Migration Assistant (SSMA) for DB2 to simplify and speed up your DB2 migration. You may use it to do the following:

  • Connect to a DB2 database using Microsoft OLE DB.
  • Review database objects
  • Assess the time needed to convert database objects
  • Migrate database objects
  • Move data to SQL Server or Azure SQL database

2. Map DB2 Databases and Data Types

You can map DB2 schemas to SQL Server database schemas in two different ways.

  1. Map every DB2 database to a separate database in SQL Server, giving it the same name as the original in DB2
  2. Map individual DB2 databases as separate schemas within a single SQL Server database.

Unlike DB2, One SQL Server database instance can contain multiple databases which are not attached to a single user ID.

After mapping your database schemas, you need to map the DB2 data types to the SQL Server data type that matches the DB2 data type.

3. Migrate Security Parameters

Security in DB2 involves setting up three essential security items:

  • Authentication
  • Authorization
  • User Privileges

Authentication in MS SQL Server always occurs on the server. But in applications that use DB2, user authentication can occur on the server, on the client, or in an intermediate gateway.

Depending on the type of authentication adopted, you may need to change the authentication in your new SQL Server database. You may choose Windows authentication for in-house desktop applications or mixed authentication for web-based applications.

4. Convert Database Objects

You may use the SSMA for DB2 to convert database objects. In the metadata explorer, open up the database schemas. Then, select some or all the objects and then convert them.

Note that not all the DB2 objects will convert. So, you need to look at the summary report created at the end of the conversion to see the objects with conversion errors.

5. Convert Functions, Procedures, and Views

The native syntax of DB2 differs from the syntax used in SQL Server. As a result, you may be able to see the data from a view in DB2, but you will need to rewrite the view in SQL Server. The same thing applies to functions and stored procedures.

6. Migrate Data to the New SQL Server Database

After creating the database schema, objects, and stored procedures, you can move the data into your new SQL Server.

Remember that not all data types can be converted directly from DB2 to SQL Server. Also, date and time values are stored differently in both database systems.

So take time to scrutinize the data before you load it. Preferably, you can create data views using select statements before you load them into your new database.

Beware that data loading operations are resource-intensive. They slow down the speed of your network and computer significantly.

If you are moving data into an on-premise server, you must avoid disrupting normal workflow. This may require you and your team to choose nighttime or weekends for data migration.

7. Perform Rigorous Testing

After the data migration is complete, you must test the data in your new SQL Server database. Then modify applications that were using the old DB2 database and test them extensively.

Database migration involving large databases or data residing on legacy systems is a complex task. That’s why it is advisable to consult a data migration expert for professional assistance.

Want to have an expert migrate or extract data for you?

Contact MediQuant at 844.286.8683 to see a free demo of our data extraction tool and process. You can also reach us through our contact page to discuss all your data archiving and migration needs.