Create an instance
# Cd/opt/IBM/db2/v9.7/instance
#./Db2icrt-p 50004-u db2inst4 db2inst4
Database creation
$ Db2 create db payment on/home/db2inst4 using codeset GBK territory CN
Check backup files
$ Db2ckbkp-h PAYMENT.0.db2inst2. node1_.catn1_.20130913013001.001
Backup Mode -- 1 # indicates an online Backup file.
Includes Logs -- 1 # indicates that the backup file contains the archive Logs required for recovery. <喎?http: www.bkjia.com kf ware vc " target="_blank" class="keylink"> Vcd4kpggzpsn6s8nhqnlgvcwxv1_vadm + large "http://www.bkjia.com/uploadfile/Collfiles/20131224/2013122410080743.jpg" alt = "\">
Modify script
$ Vi pay. clp ---- Edit
Modify the following content based on the actual situation (the storage path of the new database ):
The values in the following parameters correspond to the values in the preceding "generate migration script" statement.
Modify container path (tablespace)
Create the corresponding tablespace based on the actual modification in pay. clp:
Create a tablespace
$ Db2 "select bpname, NPAGES, pagesize from syscat. BUFFERPOOLS" ---- view the buffer pool
$ Cat pool. SQL ---- write a script to create a tablespace
#! /Bin/sh
Db2 connect to payment
Db2 create bufferpool PAYM_SYS_POOL_4K size 25000 pagesize 4 k
Db2 create bufferpool PAYM_SYS_POOL_8K size 25000 pagesize 8 k
Db2 create bufferpool PAYM_SYS_POOL_32K size 25000 pagesize 32 k
Db2 "create tablespace EPS_SPACE_8K PAGESIZE 8 k managed by database using (file"/home/db2inst4/db2inst4/tablespaces/EPS_SPACE_8K '100 M) autoresize yes bufferpool PAYM_SYS_POOL_8K"
Db2 "create user temporary tablespace EPS_SPACE_32K PAGESIZE 32 k managed by system using ('/home/db2inst4/db2inst4/tablespaces/EPS_SPACE_32K') BUFFERPOOL PAYM_SYS_POOL_32K"
Db2 "create user temporary tablespace into oolstmpspace PAGESIZE 4 k managed by system using ('/home/db2inst4/db2inst4/tablespaces/SYSTOOLSTMPSPACE') BUFFERPOOL paym_sys_pool_4 K"
Db2 "create system temporary tablespace PAYMENT_TMP PAGESIZE 32 k managed by database using (file '/home/db2inst4/db2inst4/tablespaces/PAYMENT_TMP' 100 M) BUFFERPOOL PAYM_SYS_POOL_32K"
The created tablespace corresponds to the tablespace in pay. clp.
Run the recovery script
$ Chmod + x pay. clp
$ Db2-tvf pay. clp
Rollforward Database
$ Db2 "rollforward database payment to end of logs and stop overflow log path ("/home/db2inst4 ")"
Check Database
$ Db2 connect to payment ---- connect to the database
$ Db2 list tables for schema db2inst2 ---- list tables
$ Db2 get db cfg for payment
Update archiving Log Path
$ Mkdir payment_archive_log ---- create a folder for archiving logs that love you
$ Db2 update db cfg for payment using LOGARCHMETH1 DISK:/home/db2inst4/payment_archive_log ---- update the archiving Log Path
$ Db2 connect reset ---- disconnect all connections
Manually switch to archive logs
$ Db2 force applications all
$ Db2 terminate
$ Db2 archive log for database payment