Hello,
I am attempting to restore the database from within VB.NET application I am making the following 3 calls:
RESTORE FileListOnly FROM DISK = 'C:\MyDatabase.dat'
USE Master RESTORE DATABASE MyDatabase FROM DISK = 'C:\MyDatabase.dat' WITH NORECOVERY, MOVE 'MyDatabase' TO 'C:\Program Files\Microsoft SQL Server\MSSQL\Data\MyDatabase.mdf', MOVE 'MyDatabase_log' TO 'C:\Program Files\Microsoft SQL Server\MSSQL\Data\LDF\MyDatabase.ldf', REPLACE
RESTORE DATABASE MyDatabase FROM DISK = 'C:\MyDatabase.dat'
using SMO. This logic works fine with small *.dat files, however when using *.dat file of about 4Gb I get an error on the 3d restore database call:
ExecuteNonQuery failed for Database 'master'.
An exception occurred while executing a Transact-SQL statement or batch.
Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
Operator aborted backup or restore. See the error messages returned to the console for more details.
ExecuteNonQuery failed for Database 'master'.
An exception occurred while executing a Transact-SQL statement or batch.
Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
Operator aborted backup or restore. See the error messages returned to the console for more details.
The same program/logic also works fine when I use MS SQL 2005 and it runs fine from MS SQL 2005 Query Analyzer for both 2005 and 2000 databases. There seem to be only problem with MS SQL 2000 from within VB.NET. Anybody has any idea? I'd appreciate any response. Thanks
Eugene
Have you tried changing the timeout setting of the ADO.NET Command?WesleyB
Visit my SQL Server weblog @. http://dis4ea.blogspot.com
|||As Wesley indicated you should change the query timeout.
SQL 2000 does not have fast file initialization so it can take awhile to create and initialize the files.
|||Yes I forgot to mention. The object which executes query is SMO.Database and it runs
Smo.Database.ExecuteNonQuery(sSQL)
So I set the timeout on the Smo.Server.Connection = 0.
I've also tried to set it to Smo.Server.Connection=3600 but the timeout occure in about 12 min so
sorry It did not help...
|||For those of you who might be looking for answer to the similar problem - I found the solution. SMO has StatementTimeout property. This is different from the one I was trying to change - which was a Connection timeout.
That is the one which needed to be increased.
I do appreciate the responses to my post though. It helped. Thanks
sql
No comments:
Post a Comment