DB2:无法从备份恢复
我正在使用命令
db2 restore db S18 from /users/intadm/s18backup/ taken at 20110913113341 on /users/db2inst1/ dbpath on /users/db2inst1/ redirect without rolling forward
to restore database from backup file located in /users/intadm/s18backup/ .
命令执行给出这样的输出:
SQL1277W A redirected restore operation is being performed. Table space
configuration can now be viewed and table spaces that do not use automatic
storage can have their containers reconfigured.
DB20000I The RESTORE DATABASE command completed successfully.
当我尝试连接到恢复的数据库(通过执行“db2连接到S18”)时,我收到此消息:
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
当我尝试使用数据库查看器连接到数据库时像 SQuireL 一样,错误如下:
DB2 SQL Error: SQLCODE=-1119, SQLSTATE=57019, SQLERRMC=S18, DRIVER=3.57.82
这意味着“恢复功能期间发生错误或恢复仍在进行中”(来自 IBM DB2 手册)
我如何解决此问题并连接到恢复的数据库? UPD:我已经在备份文件上执行了 db2ckbkp,它没有发现备份文件本身有任何问题。
I am using command
db2 restore db S18 from /users/intadm/s18backup/ taken at 20110913113341 on /users/db2inst1/ dbpath on /users/db2inst1/ redirect without rolling forward
to restore database from backup file located in /users/intadm/s18backup/ .
Command execution gives such output:
SQL1277W A redirected restore operation is being performed. Table space
configuration can now be viewed and table spaces that do not use automatic
storage can have their containers reconfigured.
DB20000I The RESTORE DATABASE command completed successfully.
When I'm trying to connect to restored DB (by executing 'db2 connect to S18'), I'm getting this message:
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
When I'm trying to connect to db with db viewer like SQuireL, the error is like:
DB2 SQL Error: SQLCODE=-1119, SQLSTATE=57019, SQLERRMC=S18, DRIVER=3.57.82
which means that 'error occurred during a restore function or a restore is still in progress' (from IBM DB2 manuals)
How can I resolve this and connect to restored database?
UPD: I've executed db2ckbkp on backup file and it did not identified any issues with backup file itself.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
不前滚
只能在从脱机备份恢复时使用。您的备份是否已离线?如果没有,您将需要使用前滚。without rolling forward
can only be used when restoring from an offline backup. Was your backup taken offline? If not, you'll need to use roll forward.当您执行重定向恢复时,您是在告诉 DB2 您想要更改正在恢复的数据库中的数据文件的位置。
上面显示的第一步将执行得非常快。
通常,执行此语句后,您将使用一个或多个
SET TABLESPACE CONTAINERS
来设置每个数据文件的新位置。发出这些语句不是强制性的,但如果您不进行任何更改,则在RESTORE DATABASE
命令中指定redirect
选项是没有意义的。然后,您将发出 RESTORE DATABASE S18 COMPLETE 命令,该命令实际上会从备份映像中读取数据,并将其写入数据文件。
如果您没有执行
RESTORE DATABASE S18 COMPLETE
,那么您的恢复过程不完整,并且您无法连接到数据库是有道理的。When you do a redirected restore, you are telling DB2 that you want to change the locations of the data files in the database you are restoring.
The first step you show above will execute very quickly.
Normally, after you execute this statement, you would have one or more
SET TABLESPACE CONTAINERS
to set the new locations of each data file. It's not mandatory to issue these statements, but there's no point in specifying theredirect
option in yourRESTORE DATABASE
command if you're not changing anything.Then, you would issue the
RESTORE DATABASE S18 COMPLETE
command, which would actually read the data from the backup image, writing it to the data files.If you did not execute the
RESTORE DATABASE S18 COMPLETE
, then your restore process is incomplete and it makes sense that you can't connect to the database.我所做的和有效的:
已执行:
我之前收到一些警告,某些表空间未移动。当我指定 dbpath 到具有足够磁盘空间的分区时 - 警告消失了。
之后,由于我有在线备份,我发出:
就是这样!现在我可以连接了。
What I did and what has worked:
Executed:
I got some warnings before, that some table spaces are not moved. When I specified dbpath to partition with sufficient disk space - warning has disappeared.
After that, as I have an online backup, I issued:
That's it! Now I'm able to connect.