在Windows 10 PC上安装了DB2 Express C v10.5和v11.1。
数据库备份成功但恢复以两个版本的错误结束。
我也使用Data Studio 4.1.2尝试过相同的操作,但此处备份也成功但恢复命令卡住了。
从Data Studio备份和恢复脚本 -
CONNECT TO SAMPLEDB;
QUIESCE DATABASE IMMEDIATE FORCE CONNECTIONS;
CONNECT RESET;
DEACTIVATE DATABASE SAMPLEDB;
BACKUP DATABASE SAMPLEDB TO "E:\Database" COMPRESS EXCLUDE LOGS WITHOUT PROMPTING;
CONNECT TO SAMPLEDB ;
UNQUIESCE DATABASE;
CONNECT RESET;
RESTORE DATABASE SAMPLEDB FROM "E:\Database" TAKEN AT 20161020191200 INTO NEWDB WITHOUT PROMPTING;
这适用于Windows 7和8。
此问题是否特定于Windows 10上的Db2 Express C? 任何人都可以建议解决方案和/或在哪里阅读兼容性状态。
添加 -
从Data Studio恢复不会出现任何错误,但只是卡住了。
备份和恢复脚本的结果 -
db2 => CONNECT TO CBL2010 USER db2admin USING *******
Database Connection Information
Database server = DB2/NT 10.5.5
SQL authorization ID = DB2ADMIN
Local database alias = CBL2010
db2 => QUIESCE DATABASE IMMEDIATE
DB20000I The QUIESCE DATABASE command completed successfully.
db2 => CONNECT RESET
DB20000I The SQL command completed successfully.
db2 => BACKUP DB CBL2010 USER db2admin USING ******* to E:\Backup COMPRESS WITHOUT PROMPTING
Backup successful. The timestamp for this backup image is : 20161024162942
db2 => CONNECT TO CBL2010 USER db2admin USING *******
Database Connection Information
Database server = DB2/NT 10.5.5
SQL authorization ID = DB2ADMIN
Local database alias = CBL2010
db2 => UNQUIESCE DATABASE
DB20000I The UNQUIESCE DATABASE command completed successfully.
db2 => CONNECT RESET
DB20000I The SQL command completed successfully.
db2 => RESTORE DB CBL2010 USER db2admin USING ******* FROM E:\Backup TAKEN AT 20161024162942 INTO CBLBKUP WITHOUT PROMPTING
SQL1092N The requested command or operation failed because the user ID does
not have the authority to perform the requested command or operation. User
ID: "XAXTRANET". SQLSTATE=00000
在这里,我提供的是db2admin'作为用户,但令人惊讶的是,错误是针对登录用户' XAXTRANET'。
登录和提供的用户都拥有PC管理员权限。
并且根据'得到Dbm Cfg'命令,未设置sysadm组 -
SYSADM group name (SYSADM_GROUP) =
SYSCTRL group name (SYSCTRL_GROUP) =
SYSMAINT group name (SYSMAINT_GROUP) =
SYSMON group name (SYSMON_GROUP) =
答案 0 :(得分:0)
您指定的命令ID(RESTORE ... USER db2admin ...
)用于连接到现有数据库。由于您似乎正在恢复到新数据库(...INTO CBLBKUP...
),因此必须首先创建该数据库,这需要实例附件,这是ID XAXTRANET
的来源。
在发出RESTORE
命令之前尝试显式附加到实例:
db2 => ATTACH TO DB2 USER db2admin USING whatever
以上假设您使用的是默认实例名称DB2
- 如果需要,请将其更改为您的实际实例名称。