The following articles mainly describe the correct procedure for migrating IBM DB2 cross-platform databases and the precautions worth your attention during the actual procedure of migrating IBM DB2 cross-platform databases, DB2 is a relational database software with a wide range of commercial applications.
As a database administrator, database system migration is a complex and arduous process. The help documents on the Internet and DB2 have many introductions on DB2 database migration, but they are rarely discussed about cross-platform migration of DB2 databases. This article will summarize the steps and precautions for cross-platform database migration based on the author's successful practices.
Introduction
Suppose you are the administrator of a DB2 commercial database system. You are assigned a task to support the continuous development of business systems by the business development and testing teams, creating a database system independent of the product environment for them, so as not to affect the daily business operations. For various reasons, this development and testing database system will run in an operating system different from the product environment.
We know that DB2 provides some convenient database management tools, such as the overall backup and recovery functions of the database, you can use it to easily migrate an IBM DB2 database from one physical node to another. However, DB2's backup and recovery functions currently only support migration between homogeneous operating system platforms, for example, from windows to windows, from AIX to AIX. There is no dedicated tool for cross-platform database migration required by the preceding tasks.
Migration steps
After the author's practice, the procedure for cross-platform migration of the DB2 database is summarized as follows:
Record the configuration parameters of the source database management system for system tuning after migration;
Check the source database system objects and specify the database system objects to be migrated;
Export the dataset of the source database system;
Generate the data object Definition Statement of the source database system;
Create a new database on the target platform and set it according to the source system;
Import the source dataset;
Check the dataset import process logs to eliminate possible errors;
Execute the Data Object Definition Statement;
Check the execution logs of Data Object statements to eliminate possible errors;
Check and update the definition of the stored procedure;
Connect to the application system and test whether the database migration is successful.
The following is an example of following the above steps. The specific IBM DB2 commands for executing these steps are provided for your reference.
1. Record the configuration parameters of the source database management system. These are important data environment settings. Some of these settings are related to whether the migration is successful.
List 1. commands for displaying database management system configuration parameters
The following is a reference clip:
DB2 get dbm cfg
List 2. commands for displaying database configuration parameters
The following is a reference clip:
DB2 get db cfg for source_db_name
Note: Italic part shoshould be replaced by your settings.
Note: For complex source databases, pay attention to the memory size parameter of the Application Group (appgroup_memo_sz ). If its size is not enough, there will be problems when the data object definition is generated later.
Listing 3. commands for displaying Database Registry Variables
The following is a reference clip:
DB2set-all
Listing 4. commands for displaying database tablespace
The following is a reference clip:
DB2 list tablespaces show detail
Listing 5. Display database package commands
The following is a reference clip:
DB2 list packages
The preceding table space and package commands must be connected to the source database.
2. Check the source database system objects and specify the database system objects to be migrated.
How do I check the source database system objects? One of the most intuitive ways is to use the IBM DB2 control center (DB2cc) to View tables, views, triggers, user-defined functions, stored procedures, and other database objects. Pay special attention to the existence of large tables. For example, a table with a data row definition may be larger than 8 K. Such a table needs to create a tablespace with sufficient page size on the target database. The following steps will show columns. Note that there are external stored procedures. The external packages associated with these stored procedures must be manually re-associated.