Quantcast
Channel: Forum SQL Server Database Engine
Viewing all articles
Browse latest Browse all 15889

RESTORE DATABASE fails, but only if run from within TRY/CATCH block.

$
0
0

Hi everybody,

I'm trying to restore a DB using the following script:

BEGIN TRY RESTORE DATABASE [20130717_SERVER4_NS_dat] FROM DISK = N'c:\NS.bak' WITH FILE =1, REPLACE, MOVE N'NS_dat' TO N'c:\20130717_SERVER4_NS_dat.mdf', MOVE N'NS_log' TO N'c:\20130717_SERVER4_NS_log.ldf'END TRY BEGIN CATCH DECLARE @ERROR nvarchar(max)= ERROR_MESSAGE() RAISERROR (@ERROR,11,1)END CATCH;

The restore fails on a specific instance of SQL Server Standard x64 10.50.2500, but succeeds on numerous other instances on different servers. Here are all the relevant details that I could think of:

1) RESTORE succeeds if run without TRY/CATCH

2) The problem only appears to manifest when trying to restore SQL Server 2005 user DBs (I've tried multiple DBs from multiple servers), system DBs are restored flawlessly.

3) Here's the actual error message (the DB remains pending recovery afterwards):

Processed 3256 pages fordatabase'20130717_SERVER4_NS_dat',file'NS_dat'onfile1.
Processed 1 pages fordatabase'20130717_SERVER4_NS_dat',file'NS_log'onfile1.
Converting database'20130717_SERVER4_NS_dat'from version 611to the current version 661.Database'20130717_SERVER4_NS_dat' running the upgrade step from version 611to version 621.Database'20130717_SERVER4_NS_dat' running the upgrade step from version 621to version 622.Database'20130717_SERVER4_NS_dat' running the upgrade step from version 622to version 625.Database'20130717_SERVER4_NS_dat' running the upgrade step from version 625to version 626.Database'20130717_SERVER4_NS_dat' running the upgrade step from version 626to version 627.Database'20130717_SERVER4_NS_dat' running the upgrade step from version 627to version 628.Database'20130717_SERVER4_NS_dat' running the upgrade step from version 628to version 629.
Msg 50000, Level 11, State 1, Line 1RESTOREDATABASEis terminating abnormally.

4) Here's the error message from the SQL Server Log:

07/18/201307:08:21,spid56,Unknown,During upgrade, database raised exception 137, severity 25, state, address 000000000067497F.Use the exception number to determine the cause.07/18/201307:08:21,spid56,Unknown,Error:928,Severity:20,State:1.

The issue has been already extensively discussed on the Israeli SQL Server forum, here's the suggestions that I received:

1) Install SP2 for 2008R2 (which I did and it didn't help).

2) Reinstall SQL Server.

3) Open a support ticket at Microsoft and/or report the bug at Connect.

Before I do that, however, I decided to post here, just in case. :) Thanks in advance!


Viewing all articles
Browse latest Browse all 15889

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>