The following articles mainly describe the correct procedure for transferring the DB2 V8 database system. Install the DB2 v9 database on the system with the old version of the DB2 database installed, we all need to migrate all the instances and database systems of the old version to DB2 V9.
Port the DB2 V8 Database System, including the migration Instance, DB2 Management Server (DAS), and database. For the DB2 V8 database system, you can directly migrate to DB2 V9. For DB2 V6 and V7 products, you must first migrate to DB2 V8 and then to DB2 V9.
On a Windows system, we have installed the DB2 ESE (Enterprise Server Edition) V8.2 database system. Suppose we have created a DB2 instance. At the same time, we have created a database Sample under this instance.
We need to install DB2 V9 on this system and port DB2 ESE V8.2 to DB2 V9. The Database Administrator account is db2admin and has the permissions of the system administrator. Next we will start our journey to port DB2 ESE V8.2 on the Windows platform above.
Migrate database instances
There are two ways to migrate database instances. One is automatic migration by the database installer, and the other is manual database migration. On Windows, you can choose to port from DB2 V8 to DB2 V9 during the installation of DB2 V9. After the installation is complete, the DB2 V8 instance will be automatically transplanted to DB2 V9.
1. Automatic instance migration
Log on to the system as a system administrator, such as db2admin;
Run the installation program setup.exe of DB2 V9;
On the "Install product" panel shown in figure 1, select "migrate" the old database system;
On the Panel that selects the installation folder, we can see that the installation path is automatically set to "c: \ Program Files \ IBM \ SQLLIB \" in DB2 ESE V8.2 \". We do not need or select the installation folder. After the installation is complete, the original installed DB2 in this directory will be upgraded;
After the migration process is complete, run the db2level command to verify whether the database instance has been successfully migrated. Figure 2 shows the result of executing the db2level command. We can see that the original database instance DB2 has been successfully migrated, and its version information is "DB2 v9.1.0.356 ";
Run DB2 Control Center. When you access the original database Sample, an error message dialog box is displayed. Prompt that the database is created by a database of a lower version. Therefore, the database must be migrated. 3.
2. Manual instance migration
If the "migrate" database is not selected during installation, We can manually migrate the instance after installation.
The DB2 instance that stops running, db2stop;
To migrate a DB2 instance, run the following command. $ DB2DIR \ bin \ db2imigr/u: user, password InstName. $ DB2DIR is the DB2 installation path. User and password are the usernames and passwords in the database service. InstName is the name of the database instance. For our example, we can use the following command C: \ Program Files \ IBM \ dwe \ SQLLIB \ bin \ db2imigr/u: db2admin, passw0rd DB2.
After the database instance is migrated, restart the database instance DB2. Db2start.
Database migration
After the preceding DB2 instance migration is completed, we need to continue the database migration under this instance. Assume that there is a Sample database under this instance.
Log on to the system with a user of this instance with SYSADM permissions, such as db2admin;
Run the db2 command line tool to execute the DATABASE migration command in this environment: MIGRATE database DATABASE-alias USER username USING password. Database-alias is the name or alias of the database to be migrated. Username is a user name with SYSADM permissions for authentication. In our example, assume that the password of db2admin is passw0rd. Then we need to execute the following command to MIGRATE the sample DATABASE: migrate database sample USER db2adim USING passw0rd.
To verify that our database has been successfully migrated to DB2 V9, we can connect to the database sample and query the data. Our test result 4 is shown. Now we can successfully connect to the database sample and query the data.
Migrate the DB2 Management Server
In the migration of the DB2 database system, we can also migrate the original DAS, or delete the original DAS first, and then create a new DAS. On the DB2 server, you can only have one DAS. The following are the specific steps for migrating the DAS.
Log On with the account of the DAS administrator, such as db2admin;
Stop the DAS server. Run the following command: db2admin stop.
Migrate the original DB2 V8 DAS server. Assume that our DB2 is installed in the C: \ Program Files \ IBM \ SQLLIB directory. Run the following command: \ bin \ dasmigr, that is, C: \ Program Files \ IBM \ SQLLIB \ bin \ dasmigr. To verify whether our DAS has been successfully migrated to DB2 V9, run the db2daslevel command. Figure 5 shows the running result.
After the DAS migration is complete, we can restart the DAS server: db2admin start.
Common Errors and Solutions
The most common error during migration is that the log file is not large enough. The error message is shown in Listing 1.
Listing 1. log error messages
SQL1704N Database migration failed. Reason code "3 ".
The solution is as follows:
Connect to the database TO be migrated: connect to sample;
Use the get database configuration command to determine the size of the current log file. For example, set in Listing 2:
Listing 2. Setting the size of the log file
Log File size (4 kb) (LOGFILSIZ) = 1024
Number of Primary log files (LOGPRIMARY) = 13
Number of auxiliary log files (LOGSECOND) = 4
Log File Path = C: \ DB2 \ NODE0000 \ SQL00004 \ SQLOGDIR \
You can use the following command to increase the log space size: update db cfg for sample using current value * 2. FOR example, update db cfg for sample using LOGPRIMARY 26 and update db cfg for sample using LOGSECOND 8.
Another common warning is SQL1243W. In this case, you must uninstall or rename the SYSTOOLS. DB2LOOK_INFO table. Run the following command: db2 RENAME named ools. DB2LOOK_INFO TO new-table-name. The above content is an introduction to the migration of the DB2 V8 database system. I hope you will have some gains.