If the database is currently using raw disks or volumes, you can do the conversion using DB2 redirected restore. DB2 redirected restore allows you to redefine or redirect data to new tablespace containers during a restore. Use the following procedure to use VxFS with the Quick I/O feature. For more information on DB2 backup and restore, refer to the relevant chapters in the administration guide or command reference book.
See the DB2 Administration Guide.
See the DB2 Command Reference.
Warning: |
The procedure provided assumes that the database runs on a single file system after the upgrade. |
To convert from raw devices to VxFS with Quick I/O
Create a VxFS file system using a size that is 10 percent larger than the original database or total raw device size. You can create more file systems based on your performance and availability requirements.
Verify that the database can perform rollforward recovery. In order to do this, the database parameters LOGRETAIN and/or USEREXIT must be enabled. For example:
$ db2 get db cfg for DATABASE | egrep "LOGRET|USEREXIT" $ db2 update db cfg for DATABASE USING LOGRETAIN ON $ db2 update db cfg for DATABASE USING USEREXIT ON
Preallocate Quick I/O files using qiomkfile.
See Creating database containers as Quick I/O files using qiomkfile.
For example, use the DB2 backup database command to dump all data:
$ db2 backup database DATABASE to /dumpdir
Stop the DB2 instance and then restart.
$ db2stop force $ db2start
Restore the database to the newly defined Quick I/O files:
$ db2 restore db DATABASE from /dumpdir taken at TIME \
Redefine the storage that the database is now to use:
$ db2 set tablespace containers for TBS_ID using \
(device '/qio_file_path' TBS_SIZE)
$ db2 restore db DATABASE continue $ db2 rollforward db DATABASE to end of logs $ db2 rollforward db DATABASE complete
This is an example of a redirected restore
Create a VM volume on VM group PRODdg (as root)
# vxassist -g PRODdg make newdata1 500m
Create a new VxFS file system and mount (as root)
# mkdir /newdata1 # mkfs -F vxfs /dev/vx/rdsk/PRODdg/newdata1 # mount -F vxfs /dev/vx/rdsk/PRODdg/newdata1 /newdata1 # chown -R db2inst1:db2iadm /newdata1
Check on required settings and prepare new containers
# su - db2inst1 $ db2 connect to PROD $ db2 list tablespaces $ db2 update db cfg for PROD USING LOGRETAIN ON $ db2 update db cfg for PROD USING USEREXIT ON $ db2 terminate $ cd /newdata1
$ /opt/VRTSvxfs/sbin/qiomkfile -s 200m data_container_001
Backup the database and restore redirect into the new DMS devices (Quick I/O files)
$ db2 backup database PROD to /dump_device timestamp: 20010828121254 $ db2stop force $ db2start $ db2 restore db PROD from /dump_device taken at 20010828121254 replace existing redirect
Check for tablespaces state (restore pending, storage must/may be defined)
$ db2 connect to PROD $ db2 list tablespaces show detail
Issue a SET TABLESPACE CONTAINERS command for each tablespace whose containers must be redefined
The set tablespace containers command converts one tablespace container. Repeat the set tablespace containers step as necessary for other tablespaces.
For example, to redirect tablespace container 5 to DMS device data_container_001 under /newdata1 directory:
$ db2 list tablespace containers for 5
An alternative migration strategy is to use the db2move command to export and import specific tables from a database. This command is used as follows:
For example, to migrate table cust using the db2move command: