SQL Server timeout while restoring databases with SMO

放肆的年华 提交于 2019-11-28 09:07:42

问题


I have a .NET application where I restore a number of databases using SMO. The timeout setting in the connection string is set to 0 (unlimited). Most databases restore fine, except one databases that sometimes times out on the restore. The size of it approaches 3 GB. Are there any workarounds for this problem? Is there a setting I am missing. I am using DatabaseRestore object to restore the database. Thanks!


回答1:


There are two timeout settings for SMO - one is the ConnectionTimeOut settings, and the other is the StatementTimeOut setting - you need to make sure you are setting the right one: http://social.msdn.microsoft.com/Forums/en-US/sqldisasterrecovery/thread/b4000547-7a48-4bda-9a68-ac646259e7d2/

This is another question with a specific issue that resolved their problem: SMO ConnectionContext.StatementTimeout setting is ignored

Hope this helps...

Also, there is a poweshell script that 'supposedly' works well for large databases.. http://devio.wordpress.com/category/automssqlbackup/



来源:https://stackoverflow.com/questions/5979086/sql-server-timeout-while-restoring-databases-with-smo

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!