我正在尝试将DB2数据库还原到新的服务器/位置。以下是使用的命令,这些命令在命令行上单独运行:
create db MYDBNAME
restore db MYDBNAME from D:\ on C: dbpath on C: NEWLOGPATH 'C:\DB2\NODE0000\MYDBNAME\LOGS\' REDIRECT
SET TABLESPACE CONTAINERS FOR 9 USING (PATH 'TBSP32K0000')
SET TABLESPACE CONTAINERS FOR 11 USING (PATH 'TBSP32K0001')
SET TABLESPACE CONTAINERS FOR 13 USING (PATH 'TBSP32K0002')
SET STOGROUP PATHS FOR IBMSTOGROUP ON 'C:\'
restore db MYDBNAME continue
rollforward db MYDBNAME to end of logs and complete
备份信息:
MEDIA HEADER REACHED:
=====================
Server Database Name -- MYDBNAME
Server Database Alias -- MYDBNAME
Client Database Alias -- MYDBNAME
Timestamp -- 20180430230002
Database Partition Number -- 0
Instance -- CTGINST2
Database Configuration Type -- 0 (Non-shared data)
Sequence Number -- 1
Database Member ID -- 0
Release ID -- 0x1000 (DB2 v10.5)
AL version -- V:10 R:5 M:0 F:9 I:0 SB:0
Database Seed -- 0x4F18E7E4
DB Comment's Codepage (Volume) -- 0
DB Comment (Volume) --
DB Comment's Codepage (System) -- 0
DB Comment (System) --
Authentication Value -- 255 (Not specified)
Backup Mode -- 1 (Online)
Includes Logs -- 1 (Yes)
Compression -- 1 (Compressed)
Backup Type -- 0 (Database-level)
Backup Granularity -- 0 (Non-incremental)
Merged Backup Image -- 0 (No)
Status Flags -- 0x60
LOGARCHMETH1 is set
LOGARCHMETH2 is set
System Catalogs in this image -- 1 (Yes)
Catalog Partition Number -- 0
DB Codeset -- UTF-8
DB Territory -- GB
LogID -- 1323886033
LogPath -- X:\DBLOGS\NODE0000\LOGSTREAM0000\
Backup Buffer Size -- 4194304 (1024 4K pages)
Number of Sessions -- 1
Platform -- 0x17 (NT-64)
当我运行最后的'rollforward'命令时,我收到以下错误:
SQL0752N Connecting to a database is not permitted within a logical unit of work when the CONNECT type 1 setting is in use. SQLSTATE=0A001
dbdiag.log显示:
Rollforward failed to connect to database. sqlcode -752.
运行'list tablespaces show details'之后,我看到我的所有表空间都显示'恢复待定,存储可能被定义'
当我运行'list utilities show detail'时,我得到了这个结果(从不移动)
ID = 1
Type = RESTORE
Database Name = MYDBNAME
Member Number = 0
Description = db
Start Time = 12/05/2018 14:33:15.516532
State = Executing
Invocation Type = User
Progress Monitoring:
Completed Work = 67112960 bytes
Start Time = 12/05/2018 14:33:15.516546
注意:
答案 0 :(得分:0)
您需要显示restore ... continue
步骤的确切结果。
我怀疑您的说明中未提及至少一个表空间或存储组,否则指定的容器会出现问题。
要检查:请求Db2生成恢复脚本(将其内容与命令行进行比较)。
e.g:
db2 -v restore db MYDBNAME from D:\ REDIRECT generate script %temp%\myrestore.txt
在生成的文件(myrestore.txt)中,比较'设置表空间容器'并且设置了stogroup路径'使用命令行创建行,以查看命令行中是否未提及任何表空间/存储组。
调整任何缺少的表空间或存储组的说明,然后重试。您可以中止失败的恢复,必要时删除数据库,然后重试。
如果数据库源自不同的主机名,请验证当前主机名在C:上是否有足够的可用空间以适应已还原的数据库和事务日志文件。看来您的原始数据库在X上有其日志文件:但是您希望新数据库将它们存储在C:上。通常,您希望活动事务日志位于与容器不同的设备上。
通常在db2diag中有其他信息,因此在RESTORE操作的开始和最终的SQL0752N之间读取db2diag中的所有消息是必要的。检查所有这些消息。