This article mainly describes how to complete the porting process from AIX platform to Linux platform based on DB2 PHP application system. The article contains the low-level DB2 database porting, the high-level PHP application system porting the detailed steps as well as the migration process may encounter problems and solutions.
Task overview
The work of system migration is mainly divided into the following aspects:
Cross-platform migration of 1.DB2 database system
Installation and configuration of 2.Apache Server and PHP application system
Below we will introduce the specific steps of migration and configuration separately in 2 aspects.
Cross-platform migration of DB2 database system
Database environment
SOURCE Environment: AIX+DB2 v8.1
Target Environment: LINUX+DB2 v8.1
The source database contains 2 databases INSTANCE:SRCDB1 and SRCDB2. In the SRCDB1/SRCDB2 database, hundreds of database tables are included, and there are many indexes, foreign KEY constraints, triggers, stored procedures, and tables containing the self-added fields (tables with generated ALWAYS as IDENTITY definitions fields). More difficult, we do not have an exact creation script for these database objects.
Selection of migration scenarios
If the migrated source and destination systems belong to the same type of operating system, such as the migration between Linux, or the migration between AIX systems, the situation is relatively simple, and DB2 itself has provided relevant utilities to implement this database migration between the same type of platform, such as: BACKUP and RESTORE Command. Of course, depending on the situation, there is a clear understanding of the parameters provided by the utility, such as the use of different table spaces by the source system and the target system, which involves the problem of table space redirection. As the focus of this article is on Cross-platform porting, this scenario is clearly not meeting the requirements and is no longer being discussed here.
So, how do you handle a Cross-platform database migration issue? Is it possible to use utility tool Db2move? Db2move can migrate only data from tables, but not to database objects such as indexes, foreign KEY constraints, triggers, and stored procedures, and there are limits to the tables that contain the data from the Db2move field. Also, Db2move can only import data into a table in an existing database and cannot display the location of the specified table space. Because in the process of database system migration, not only the data in the migration table, but also the database objects such as indexes, foreign KEY constraints, triggers and stored procedures are needed, which is more advantageous than the one selected in this article. You can use Db2move only as an alternative to migrating table data.
For export and import, you can export import operations on only one table at a time, and you need to manually enter the commands for export and import, as well as the names of the data tables you want to import, which may be considered in the case of a few database tables, But it's not the best solution. In the case of a large number of tables in the database, this approach is basically unrealistic, and the import command does not guarantee that the data from the added field is consistent with the original table data.
According to the processing mechanism of the database objects by DB2, this paper presents a feasible scheme for porting a cross-platform DB2 database system by means of combining Db2look with DDL and DML scripts, and dealing with triggers, stored procedures and foreign key constraints in the original database.
Here we take SRCDB1 as an example to introduce the whole process of database migration in this case. There are four database schemas in the SRCDB1 database, SRCDB1, ASN, db2dbg, and SQLDBA. Suppose the user name of the SRCDB1 database is user_srcdb1, password: pw_srcdb1.