t1 mkdir xxx 3.更改容器及文件的存储路径:
db2 "set tablespace containers for 0 using (Path '/db2sys/db2inst1/xxx/NODE0000/SQL00001/SQLT0000.0')"
db2 "set tablespace containers for 1 using (Path '/db2sys/db2inst1/xxx/NODE0000/SQL00001/SQLT0001.0')"
db2 "set tablespace containers for 2 using (Path '/db2sys/db2inst1/xxx/NODE0000/SQL00001/SQLT0002.0')"
db2 "set tablespace containers for 3 using (Path '/db2sys/db2inst1/xxx/NODE0000/SQL00001/SYSTOOLSPACE')"
db2 "set tablespace containers for 4 using (Path '/db2sys/db2inst1/xxx/NODE0000/SQL00001/SYSTOOLSTMPSPACE')"
db2 "set tablespace containers for 5 using (File '/db2sys/db2inst1/xxx/NODE0000/SQL00001/CDTABLESPACE.DAT' 50000)"
db2 "set tablespace containers for 6 using (File '/db2sys/db2inst1/xxx/NODE0000/SQL00001/TSASNCA' 38400)"
db2 "set tablespace containers for 7 using (File '/db2sys/db2inst1/xxx/NODE0000/SQL00001/TSASNUOW' 12800)"
db2 "set tablespace containers for 8 using (Path '/db2sys/db2inst1/xxx/NODE0000/SQL00001/xxxCLOB')"
ps:其中遇到一个SQL0298N的报错: SQL0298N Bad container path. SQLSTATE=428B2 容器类型和容器名指定均正确。查到最后查不出办法,最后使用一个比较笨拙的办法; 解决方法: 删除xxx数据库:
>db2 drop db xxx 重新使用db2 restore 恢复并添加to参数: >db2 restore db xxx from . on /db2sys/db2inst1/xxx replace existing redirect without rolling forward 在重复上面更改容器和数据文件路径的命令就OK了。 路径更改完毕之后,restore continue: >
db2 restore db xxx continue DB20000I The RESTORE DATABASE command completed successfully.
更改归档路径 >db2 update db cfg for xxx using LOGARCHMETH1 disk:/db2sys/db2log/xxx
重启数据库使参数生效: >
db2 stop >
db2 start
Ps:其中db2 connect 的时候遇到SQL0332N >
db2 connect to xxx SQL0332N Character conversion from the source code page "1386" to the target code page "819" is not supported. SQLSTATE=57017 解决方法: >
db2set DB2COMM=tcpip
>
db2set DB2CODEPAGE=1386
>
db2set DB2COMM=tcpip DB2CODEPAGE=1386 >
db2 terminate
>
db2 connect to cnap
Database Connection Information
Database server = DB2/AIX64 9.7.7 SQL authorization ID = DB2INST1 Local database alias = XXX
Ok ,DB2 就算恢复完成了。
|