February 16, 2007 at 9:25 am
When running the restore log command I get 2 error messages. Sadly the value of @@error is set to 3013 immediately following the restore log command. However I wish to allow the process to continue if the first error is 4326 (ie shift out that log and try the next one).
Msg 4326, Sev 16: The log in this backup set terminates at LSN 8268000000018300001, which is too early to apply to the database. A more recent log backup that includes LSN 8270000000038600001 can be restored. [SQLSTATE 42000]
Msg 3013, Sev 16: RESTORE LOG is terminating abnormally. [SQLSTATE 42000]
How the ^^^& do I get the first error numer out of this?
Cheers for any assistance!
February 19, 2007 at 7:35 am
if you have them in a loop it should carry on regardless, the other way is to work out which is the next log to be restored thus avoiding the error message.
[font="Comic Sans MS"]The GrumpyOldDBA[/font]
www.grumpyolddba.co.uk
http://sqlblogcasts.com/blogs/grumpyolddba/
February 19, 2007 at 7:48 am
It carries on, fine. But the plan was to have it stop if it was too late, but if the file was too early to simply move that file and continue on.
All I need is to access the first error that it throws, rather than the later more general failure error.
February 20, 2007 at 12:16 pm
Did you do anything that could mess with the sequence.
February 20, 2007 at 12:53 pm
I query the underlying tables and grab the dates to avoid these errors .. it takes some querying but isn't impossible!
[font="Comic Sans MS"]The GrumpyOldDBA[/font]
www.grumpyolddba.co.uk
http://sqlblogcasts.com/blogs/grumpyolddba/
February 21, 2007 at 9:44 am
Yeah, the difficulty is that the databases are effectively isolated (different continents for a start) so thats not hugely viable.
Just seems like another microsoft wtf (like ado error handling, data type mapping, parts of the 'Enterprise' Library, and lets face it the entirety of the user interface for 2005...) returning a precise error that you can't catch and can't use, followed by a general purpose error that you can catch but is so vague there's not a lot you can usefully do with it.
Cheers anyway.
February 21, 2007 at 12:23 pm
umm .. I can't post the code as there's too much to explain, but my log shipping copes with this, it doesn't require the ability to query the source server for it's restores. It can be done, you just have to think a way around it. < grin >
[font="Comic Sans MS"]The GrumpyOldDBA[/font]
www.grumpyolddba.co.uk
http://sqlblogcasts.com/blogs/grumpyolddba/
February 22, 2007 at 6:46 am
Yeah, its easy enough to do in code, I just wanted to grab that error. it seems so odd that ms would do that.
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply