DB2恢复方案二:一个表空间容器被意外的删除或者损坏
(2014-11-05 20:22:33)
标签:
db2it杭州美创科技有限公司 |
分类: DB2 |
步骤1.列出所有被定义的表空间清单
·db2 connect to sample
·db2 list tablespaces show detail
步骤2.做一个所有表空间容器信息的清单
·db2 list tablespace containers for 8 show detail
步骤3.备份表空间
·db2 terminate
·db2 force application all
·db2 backup database sample tablespace test1 to /oracle/log_archive/shijiawei
步骤4.模拟表空间失败
rm /oracle/shijiawei/SQLTAG.NAM
当你再连接到数据库并且尝试执行对破坏的表空间进行操作时:
·db2 connect to sample
·db2 "create table tab1(c1 INTEGER) in shijiawei"
会收到下面的信息
SQL0290N
你可以用下面命令查看表空间状态
·db2 list tablespaces show detail
可以发现shijiwei表空间的状态为State
·db2 LIST TABLESPACE CONTAINERS FOR 8 SHOW DETAIL
步骤6.还原表空间备份片
·db2 terminate
·db2 "RESTORE DATABASE sample TABLESPACE (shijiawei) FROM /oracle/log_archive/shijiawei"
步骤7.检查表空间的状态
确保容器可访问:
·db2 list tablespaces show detail
·db2 list tablespace containers for 8 show detail
步骤8.验证还原是正确的
·create table tab1(no INTEGER) in shijiawei
Note: You may encounter a situation where after restoring the table space, further recovery action is needed. This may occur if there are any log file changes that were not applied yet to make the database consistent. In this case, simply issue one of the following commands to complete the recovery:
·db2 ROLLFORWARD DATABASE sample TO END OF LOGS AND STOP

加载中…