Hello,
I'm running a program that creates new databases on the fly by restoring from a master.bak file. When I use this script against an unloaded database (empty tables) the script runs just fine. However, I now need it to restore a database that has some data in the tables. When I do this I get this error:
Encountered error while Creating Database Structure : Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. RESTORE DATABASE is terminating abnormally. 10 percent processed. 20 percent processed. 30 percent processed. 41 percent processed. 51 percent processed. 60 percent processed. 70 percent processed. 80 percent processed. 90 percent processed.
Here is the code that creates the restore sql code:
string populateDb = "RESTORE DATABASE [" + txtDbName.Text.Trim() + "] " +
"FROM DISK = N'C:\\Program Files\\Microsoft SQL Server\\" +
"MSSQL.1\\MSSQL\\Masters\\msf_school.bak' " +
"WITH FILE = 1, " +
"MOVE N'msf_school' TO N" +
"'C:\\Program Files\\Microsoft SQL Server\\MSSQL.1\\MSSQL\\DATA\\" + txtDbName.Text.Trim() + ".mdf', " +
"MOVE N'msf_school_log' TO N" +
"'C:\\Program Files\\Microsoft SQL Server\\MSSQL.1\\MSSQL\\DATA\\" + txtDbName.Text.Trim() + ".ldf', " +
"NOUNLOAD, REPLACE, STATS = 10";