加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

DB2恢复方案二:一个表空间容器被意外的删除或者损坏

(2014-11-05 20:22:33)
标签:

db2

it

杭州美创科技有限公司

分类: 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  Table space access is not allowed.  SQLSTATE=55039

你可以用下面命令查看表空间状态

·db2 list tablespaces show detail

可以发现shijiwei表空间的状态为State   = 0x4000,意思呢是离线或者不可用的状态,如果你执行LIST TABLESPACE CONTAINERS命令,你可以看出哪个容器是丢失或者不可用的

·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

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有