SSIS:无法打开数据库 xyz.正在恢复中 [英] SSIS: database xyz cannot be opened. It is in the middle of a restore
问题描述
在 SSIS 2008 中,当 OLE DB 数据源返回这样的错误数据库 [xyz] 无法打开.它正在恢复中."时,有没有办法围绕这个问题设计 SSIS 包?
In SSIS 2008, is there is way to design an SSIS package around the problem when an OLE DB data source returns an error like this "Database [xyz] cannot be opened. It is in the middle of restore."?
我希望有一种方法可以将循环设计到 SSIS 2008 包中以捕获此错误,可能需要等待 5 或 10 分钟让源数据库完成恢复(例如从日志传送),然后再试一次 - 使用内置最大重试限制.
I am hoping there is a way to design a loop into an SSIS 2008 package to trap this error, maybe wait 5 or 10 minutes for the source DB to finish restoring (from log shipping for example) and then try again - with a max retry limit built in.
谢谢.
推荐答案
是的.连接时,不要连接到数据库.例如,在不同的连接对象中使用 master.
Yes. When you connect, don't connect to your database. Use master, say, in a different connection object.
然后,查询sys.databases中的状态列.如果不是 0,请稍等,再试一次.
Then, query the state column in sys.databases. If not 0, wait for a bit, try again.
这篇关于SSIS:无法打开数据库 xyz.正在恢复中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!