DB2 9.7 中如何将数据库管理表空间转换为自动存储表空间
2010-03-17 00:00:00 来源:WEB开发网TS2 表空间当前使用两个用户指定的容器用于 DMS 类型的表空间。在这个基础上通过下面 4 个步骤我们可以将这个表空间转换成自动存储表空间。
第一步,做一个数据库或表空间的备份。
第二步,使用 redirect 选项恢复数据库或表空间。
RESTORE DATABASE database_name TABLESPACE table_space_name REDIRECT
第三步,在恢复过程中使用 SET TABLESPACE CONTAINERS 命令将 DMS 表空间改为自动存储表空间。并继续恢复数据库或表空间。
SET TABLESPACE CONTAINERS FOR tablespace_id USING AUTOMATIC STORAGE
RESTORE DATABASE database_name CONTINUE
第四步,对数据库进行前滚恢复。
ROLLFORWARD DATABASE database_name TO END OF LOGS AND STOP
清单 6. 使用数据库重定向操作转换表空间的实例
步骤一,
db2 backup db testdb tablespace ts2 online to /db2/backup
Backup successful. The timestamp for this backup image is : 20091102012416
步骤二,
db2 "restore db testdb tablespace(ts2) from /db2/backup redirect"
SQL1277W A redirected restore operation is being performed. Table space
configuration can now be viewed and table spaces that do not use automatic
storage can have their containers reconfigured.
DB20000I The RESTORE DATABASE command completed successfully.
步骤三,
db2 set tablespace containers for 5 using automatic storage
DB20000I The SET TABLESPACE CONTAINERS command completed successfully.
db2 restore database testdb continue
DB20000I The RESTORE DATABASE command completed successfully.
步骤四,
db2 rollforward db testdb to end of logs and stop
Rollforward Status
Input database alias = testdb
Number of nodes have returned status = 1
Node number = 0
Rollforward status = not pending
Next log file to be read =
Log files processed = -
Last committed transaction = 1970-01-01-00.00.00.000000 UTC
DB20000I The ROLLFORWARD command completed successfully.
更多精彩
赞助商链接