Backup failed - detached database won't reattach

  • I have accidentally wiped out lots of content from my database, and will wake up tomorrow with angry clients who are ready to kill me. I was about to restore the database but found out the scheduled job had backed up every other database but not mine...I can't for the life of me figure out why, but here I am.

    I have the MDF and the LDF files, and when I try to attach the database the files verify OK, but when I click OK I get the following error message:

    "Error 9003: The LSN (2015:4758:6) passed to log scan in database 'deskbase35' is invalid".

    Anyone - please, please help - I am not an SQL wiz but have managed fine until now. I have a RAID installed and backup everything...that it did not work is so embarrassing that I am ready to jump out the window.

    BTW, I use SQL Server 2K on Win2K.

    Is there any way to ask SQL server to just accept the MDF file and throw away the LDF file? Is there any software out there which might help?

  • Yes you can. Take a look at sp_attach_single_file_db. I'd recommend you make a copy of the mdf and ldf in a separate folder before you try - just in case! Using this sp will attach the db and create a new log (ldf) file. As soon as you get it attached figure out why the backup didnt happen and get it going!

    Andy

  • Here's what I try in Query Analyser:

    sp_attach_single_file_db

    @dbname = 'deskbase35',

    @physname='g:\data\databases\deskbase35_Data.MDF'

    But it gives me the exact same error.

  • I zipped the file and moved it tto my laptop, installed SQL 2K trial - and it attached at once!

    Now how come I can't get it to work on my production server? Is there a trick I can do to make it work?

  • All I had to do was move it into a different folder! IT works great. Still lost lots of data but none of the client stuff...only my own...thank you very very very much!

  • Glad we were able to help a little!

    Andy

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply