Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


Share this Page URL
Help

Chapter 7. Migrating existing DB2 UDB da... > Migrating a DB2 database using db2lo... - Pg. 77

db2 "SET TABLESPACE CONTAINERS FOR 0 USING (PATH $NewDBDIR/catalog)" db2 "SET TABLESPACE CONTAINERS FOR 1 USING (PATH $NewDBDIR/temp)" db2 "restore db $OLD_DB_NAME continue" Note: Using the information collected in Step 3, you will need to create set tablespace container for commands for each tablespace found in the database. Execute the script file just created to perform a redirected restore operation. 6. Verify that the database was successfully migrated by performing a few simple tests (as outlined in 6.4, "Database verification" on page 71). 7.2 Migrating a DB2 database using db2look and db2move Earlier, it was mentioned that the easiest way to physically move a DB2 database from one storage location to another is by backing up the database and then performing a redirected restore operation to copy the database to a new location. However, because a redirected restore operation allows you to change the storage location for one or more tablespaces but not the tablespace type (SMS or DMS), this process cannot be used for migrating a DB2 database if you wish to change the tablespace type (for example, to switch from DMS tablespaces to SMS tablespaces). Instead, to perform this type of migration, a new DB2 database that uses the desired tablespace types must be created and data from the existing database must be copied to the new database. Data can be copied on a table-by-table basis using DB2's EXPORT and IMPORT commands, but a more efficient way to copy an entire DB2 database is by using DB2's db2move utility. This utility queries the system catalog tables for the specified database and compiles a list of all user tables found. It then exports the contents and table structure of each table found to a PC/IXF formatted file. The set of files produced can be used to populate a new a DB2 database that uses tablespaces that are associated with files stored on an IBM N series storage system. The db2move utility can be run in one of three modes: EXPORT, IMPORT, or LOAD. When run in EXPORT mode, the db2move utility invokes DB2's EXPORT utility to extract data from one or more tables and externalize it to PC/IXF formatted files. It also creates a file named db2move.lst that contains the names of all tables processed, along with the names of the files that the table's data was written to. In addition, the db2move utility may produce one or more message Chapter 7. Migrating existing DB2 UDB databases to an IBM N series storage system 77