背景:DB2 11.5,在A服务器指定的数据目录是/data/db2inst1/isimdb,
还原到B服务器时,由于/data下剩余空间不足,要还原到/soft/db2inst1/isimdb下
操作步骤:
db2 “restore db ISIMDB from ‘/soft/qa/’ to ‘/soft/db2inst1/isimdb’ redirect without prompting”
db2 “SET STOGROUP PATHS FOR IBMSTOGROUP ON ‘/soft/db2inst1/isimdb'”
DB20000I The RESTORE DATABASE command completed successfully.
db2 restore db ISIMDB continue
DB20000I The SET STOGROUP PATHS command completed successfully.
尝试连接ISIMDB
db2 connect to isimdb
如果是离线备份,可以连接成功,
如果是联机备份,会报错:
还需要将B服务器上缺少的事务日志文件从A服务器上复制过来。
将日志文件拷贝到对应的目录,如:/soft/db2inst1/isimdb/NODE0000/SQL00001/LOGSTREAM0000/LOGSTREAM0000/
sudo chown -R db2inst1:db2iadm1 /soft/db2inst1/isimdb/NODE0000/SQL00001/LOGSTREAM0000/LOGSTREAM0000/
db2 rollforward database ISIMDB to end of logs and complete
Rollforward status
Input database alias = ISIMDB
Number of members have returned status = 1
Member ID = 0
Rollforward status = not pending
Next log file to be read =
Log files processed = S0132963.LOG – S0132963.LOG
Last committed transaction = 2025-09-23-03.57.07.000000 UTC
DB20000I The ROLLFORWARD command completed successfully.