torn page error when trying to attach mdf

  • Here is my question (you can read the rest of the post for background):

    Is there any way to fix a torn page in a detached mdf? I have tried sp_attach_db and sp_attach_single_file_db. I do not have another SQL 2000 instance currently

    Fortunately in my 8 years of SQL Server I have not encountered any of the problems I am currently dealing with, but unfortunately this means I can't fix them. We have product that runs on SQL Server and was purchased by the finance department without consulting IT. The application and the SQL Server run on 1 box and no one from IT has ever checked the box out. Until I came on board in June there was no one on staff with SQL Server experience and as far as I knew there was nothing using SQL Server on site, so I did not go looking for any SQL Servers. Now this box has crashed (drive failure) and while it was able to be restored from an image there is a full week of missing financial data. When they brought me in last night it was because the hardware guys were able to get the mdf's and ldf's for the user db's off the failed drive and they should have the missing data. Compounding the problem is that there are no backups since August because in August a power failure caused msdb to be marked as suspect (still is as I have been focusing on trying to get the data back and no there are no backups of msdb so I have to recreate it). Needless to say I am now sysadmin on the SQL Server and once running again will be dealing with it.

  • Simple answer - no. You need to attach the database and then run repair (as you don't have a backup). Are you having problems attaching the database?

    A torn-page is basically where a page was only partially written to its location on the drive - so on-disk there's part of the old page and part of the new page. There's no way to get back the overwritten data, or the part of the new page that wasn't written so the only way out is to restore from a backup or deallocate the page as part of repair.

    Let me know how you get on.

    Paul Randal
    CEO, SQLskills.com: Check out SQLskills online training!
    Blog:www.SQLskills.com/blogs/paul Twitter: @PaulRandal
    SQL MVP, Microsoft RD, Contributing Editor of TechNet Magazine
    Author of DBCC CHECKDB/repair (and other Storage Engine) code of SQL Server 2005

  • Thanks for the reply Paul. I didn't think there was anything I could do to a detached database file.

    Yes I am having a problem attaching the database. I found out about the torn page when running sp_attach_db and sp_attach_single_file_db.

    Unfortunately I do not have another SQL Server 2000 to play with this on. I may get one built so I can hopefully solve these problems in the future.

    Fortunately the organization can work without restoring the missing data.

Viewing 3 posts - 1 through 2 (of 2 total)

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