Sunday, March 11, 2012

Database attach corrupt ndf file

I have a database with 8 files. 1 mdf, 1 ldf and 6 ndf files. One of the
ndf file has a torn page. It's a file the contains only indexes. I want to
attach to this db, excluding the bad ndf file. Any way to do that?
using sp_attach_db give me an error that there's an I/O torn page problem
and gives me the ndf file name.
Any way around this?I neglected to say that I really only needed read access to this db.
I managed to find a solution.
I renamed the 8 files (prefixing them with an A_)
I created a new DB with the name I wanted with 8 files named exactly like
the originals that I renamed.
Stopped Sql Server.
Deleted the 8 new DB files.
Renamed the original 8 files back to their original names
re-started sql server.
The DB came up suspect, as I would expect it to. I set the
sysdatabases.status = 32768 for the suspect DB, which put the DB in
emergency mode. I now have read access to the DB.
"Steve" <ss@.Mailinator.com> wrote in message
news:uhqM6ACrGHA.2464@.TK2MSFTNGP03.phx.gbl...
>I have a database with 8 files. 1 mdf, 1 ldf and 6 ndf files. One of the
>ndf file has a torn page. It's a file the contains only indexes. I want to
>attach to this db, excluding the bad ndf file. Any way to do that?
> using sp_attach_db give me an error that there's an I/O torn page problem
> and gives me the ndf file name.
> Any way around this?
>

No comments:

Post a Comment