ITPub博客

首页 > 数据库 > 数据库开发技术 > DB2 恢复误删除的表

DB2 恢复误删除的表

原创 数据库开发技术 作者:fjzcau 时间:2015-03-06 20:31:14 0 删除 编辑
--全备份
db2 backup db testdb online to /data/backup/testdb compress
备份成功。此备份映像的时间戳是:20131218084437

--删除表
db2 drop table emp1

--列出备份中已经删除的表,包含建表语句
db2 list history dropped table  all for testdb


--使用删除表之前的全备份进行恢复
db2 "restore db testdb from /data/backup/testdb tablespace(tbs_data2) taken at 20131218084437"

--前滚,并将表的数据导出到 /data/backup 目录下
db2 rollforward db testdb to end of logs and stop recover dropped table 000000000800b42200070010 to /data/backup

cat /data/backup/NODE0000/data
111,"zhangming           ",1

--创建被删除的表
db2 "create table db2inst1.emp1(empno integer not null, empname char(20) , deptno integer) in tbs_data2"

--导入数据
db2 import from /data/backup/NODE0000/data  of del insert into db2inst1.emp1

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/22661144/viewspace-1450992/ ,如需转载,请注明出处,否则将追究法律责任。

下一篇: DB2 设置归档模式
请登录后发表评论 登录
全部评论

注册时间:2011-04-03

  • 博文量
    208
  • 访问量
    547143