恢复数据库的顺序:
1. 从备份恢复数据库:RESTORE DATABASE ERP(这是备份文件数据库名称) FROM /bak(这是备份文件所在目录) TAKEN AT 20001007042824(备份文件名) into ERP(新数据库名) REPLACE EXISTING REDIRECT
2. 重定向表空间:(可用list tablespace containers for 0...查看表空间容器)
SET TABLESPACE CONTAINERS FOR 0 IGNORE ROLLFORWARD CONTAINER OPERATIONS USING (PATH /db2/db2inst/db2inst/NODE0000/SQL00001/SQLT0000.0) //这是系统管理表空间
SET TABLESPACE CONTAINERS FOR 1 IGNORE ROLLFORWARD CONTAINER OPERATIONS USING (PATH /db2/db2inst/db2inst/NODE0000/SQL00001/SQLT0001.0)
SET TABLESPACE CONTAINERS FOR 2 IGNORE ROLLFORWARD CONTAINER OPERATIONS USING (FILE /data/ERP_DB/TB_ERP/USERSPACE1 38400) //这是用户管理表空间,38400是说有38400个页,每个页通常是4K大小,所以表空间就是150M
SET TABLESPACE CONTAINERS FOR 3 IGNORE ROLLFORWARD CONTAINER OPERATIONS USING (FILE /data/ERP_DB/TB_ERP/INDEXSPACE 38400)
SET TABLESPACE CONTAINERS FOR 4 IGNORE ROLLFORWARD CONTAINER OPERATIONS USING (FILE /data/ERP_DB/TB_ERP/LONGSPACE 38400)
3. 恢复继续:RESTORE DATABASE ERP CONTINUE