DB2 多表空间 重定向 还原

下面是我经过实际操作总结得《DB2 多表空间 重定向 还原》

@echo 0.列举出数据库MAMDB的表空间容器列表:
db2 connect to mamdb
db2 list tablespaces

@echo 下面是被列举出来的表空间,包括系统维护表空间和数据库维护表空间;
@echo syscatspace
@echo tempspace1
@echo userspace1
@echo tempspace3

@echo tab_smam
@echo idx_smam
@echo systoolspace

@echo systoolstmpspace

@echo 1.创建还原目标数据库
db2 create db mytest

@echo 2.重定向还原(确保e:\mylog存在,确保DB2备份文件在E盘根目录,拷贝时间戳)
db2 restore db mamdb from e:\ taken at 20101117130001  into mytest logtarget e:\mylog redirect 

@echo 3.重定向容器位置(数据表空间必须保证文件大小超过待还原数据,系统表空间采用目录形式,文件单位为32KB)
db2 set tablespace containers for 0 using (path "E:\2011-11-17-restore\syscatspace")
db2 set tablespace containers for 1 using (path "E:\2011-11-17-restore\tempspace1")
db2 set tablespace containers for 2 using (path "E:\2011-11-17-restore\userspace1")
db2 set tablespace containers for 3 using (path "E:\2011-11-17-restore\tempspace3")
db2 set tablespace containers for 7 using (path "E:\2011-11-17-restore\systoolstmpspace")

db2 set tablespace containers for 4 using (file "E:\2011-11-17-restore\tab_smam" 100000)
db2 set tablespace containers for 5 using (file "E:\2011-11-17-restore\idx_smam" 100000)
db2 set tablespace containers for 6 using (file "E:\2011-11-17-restore\systoolspace" 10000)
@echo 4.继续恢复数据
db2 restore db mamdb continue 
@echo 5.前滚日志
db2 rollforward db mytest to end of logs and stop overflow log path (e:\mylog)
pause

 

 

具体每个命令出来的结果我就不写了,根据实际环境来操作吧!

posted @ 2010-11-17 20:00  遥望星空  阅读(1983)  评论(0编辑  收藏  举报