DB2Is a relationship with a wide range of commercial applicationsDatabaseSoftware. As a database administrator, database system migration is a complex and arduous process. The help documents on the Internet and DB2 contain a lot of information about DB2 databases.MigrationBut it is rarely discussed about cross-platform migration of DB2 databases. Based on my successful practices, This article summarizes the steps and precautions for cross-platform database migration. I am very happy to share with you and hope to help you.
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, users can use it to easily migrate a DB2 database from one physical node to another physical node. However, the backup and recovery functions of DB2 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:
Instance:The following is an example of following the above steps. The specific 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.
Listing 1.Command for displaying database management system configuration parameters
Db2 get dbm cfg
List 2.Command for displaying database configuration parameters
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.Command for displaying Database Registry Variables
Db2set-all
Listing 4.Command for displaying database tablespace
Db2 list tablespaces show detail
Listing 5.Show database package commands
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? The most intuitive method is to use the 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.
3. Export the dataset of the source Database System
DB2 provides a tool called db2move that allows you to export data from all user-defined tables to an IXF (integrated exchange format) file. At the same time, when importing data, it can also generate the index defined in the table. The specific export command is as follows:
Listing 6.Export source Dataset
Db2move dbname
Export-u
Username
-P
Password
Depending on the database size and machine performance, the export process may take several minutes to several hours. In my experience, the export process lasted more than two hours. It can be seen that experience is a long process, and now someone has studied it for us, so we can directly learn the ready-made labor results, saving time and improving efficiency, everyone is welcome to study.