SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Corrupt Database


Corrupt Database

Author
Message
Plaice
Plaice
SSC Rookie
SSC Rookie (31 reputation)SSC Rookie (31 reputation)SSC Rookie (31 reputation)SSC Rookie (31 reputation)SSC Rookie (31 reputation)SSC Rookie (31 reputation)SSC Rookie (31 reputation)SSC Rookie (31 reputation)

Group: General Forum Members
Points: 31 Visits: 7
Hi All,

Having an issue with a corrupt SQL 2005 database. Event log is giving a lot of I/O errors. Running the following command:

DBCC CHECKDB('database') WITH TABLERESULTS, NO_INFOMSGS, ALL_ERRORMSGS

Gives the following output:

CREATE FILE encountered operating system error 665(error not found) while attempting to open or create the physical file 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\database.mdf:MSSQL_DBCC15'.
Msg 7928, Level 16, State 1, Line 1
The database snapshot for online checks could not be created. Either the reason is given in a previous error or one of the underlying volumes does not support sparse files or alternate streams. Attempting to get exclusive access to run checks offline.
Msg 824, Level 24, State 2, Line 1
SQL Server detected a logical consistency-based I/O error: incorrect pageid (expected 1:4033984; actual 0:0). It occurred during a read of page (1:4033984) in database ID 7 at offset 0x000007b1b80000 in file 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\database.mdf'. Additional messages in the SQL Server error log or system event log may provide more detail. This is a severe error condition that threatens database integrity and must be corrected immediately. Complete a full database consistency check (DBCC CHECKDB). This error can be caused by many factors; for more information, see SQL Server Books Online.

Any help on the next steps would be appreciated.
GilaMonster
GilaMonster
SSC Guru
SSC Guru (228K reputation)SSC Guru (228K reputation)SSC Guru (228K reputation)SSC Guru (228K reputation)SSC Guru (228K reputation)SSC Guru (228K reputation)SSC Guru (228K reputation)SSC Guru (228K reputation)

Group: General Forum Members
Points: 228665 Visits: 46343
First problem there, the database snapshot for CheckDB can't be created. Is that an NTFS drive, does the SQL Server service account have full permissions to the folder with the data files?
Is it Enterprise edition?
Are you running any disk-related filter drives (eg DiskKeeper, etc)

Second problem is the corruption, but need to see a full list to help there. Can you take the DB into single user mode and run the following?

DBCC CheckDB (<database name>Wink WITH NO_INFOMSGS, ALL_ERRORMSGS, TABLOCK



Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass


Plaice
Plaice
SSC Rookie
SSC Rookie (31 reputation)SSC Rookie (31 reputation)SSC Rookie (31 reputation)SSC Rookie (31 reputation)SSC Rookie (31 reputation)SSC Rookie (31 reputation)SSC Rookie (31 reputation)SSC Rookie (31 reputation)

Group: General Forum Members
Points: 31 Visits: 7
Yes the drive is an NTFS drive.
SQL Server service account has full permissions to the folder with the data files.
It's Standard edition.

Have run the query and received the following output:

Msg 8921, Level 16, State 1, Line 1
Check terminated. A failure was detected while collecting facts. Possibly tempdb out of space or a system table is inconsistent. Check previous errors.
Msg 824, Level 24, State 2, Line 1
SQL Server detected a logical consistency-based I/O error: incorrect pageid (expected 1:4033984; actual 0:0). It occurred during a read of page (1:4033984) in database ID 7 at offset 0x000007b1b80000 in file 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\database.mdf'. Additional messages in the SQL Server error log or system event log may provide more detail. This is a severe error condition that threatens database integrity and must be corrected immediately. Complete a full database consistency check (DBCC CHECKDB). This error can be caused by many factors; for more information, see SQL Server Books Online.
GilaMonster
GilaMonster
SSC Guru
SSC Guru (228K reputation)SSC Guru (228K reputation)SSC Guru (228K reputation)SSC Guru (228K reputation)SSC Guru (228K reputation)SSC Guru (228K reputation)SSC Guru (228K reputation)SSC Guru (228K reputation)

Group: General Forum Members
Points: 228665 Visits: 46343
Restore from a clean backup. That's not repairable.

If you have an unbroken log chain from the clean backup then you won't lose any data (you can take a tail-log backup before starting the restore)

Edit: Oh, and have a very good look at that IO subsystem. Databases don't corrupt themselves, that looks like a section of the disk has been zeroed out. Misbehaving IO subsystem.

Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass


Plaice
Plaice
SSC Rookie
SSC Rookie (31 reputation)SSC Rookie (31 reputation)SSC Rookie (31 reputation)SSC Rookie (31 reputation)SSC Rookie (31 reputation)SSC Rookie (31 reputation)SSC Rookie (31 reputation)SSC Rookie (31 reputation)

Group: General Forum Members
Points: 31 Visits: 7
Thanks for the confirmation. Will go ahead with the restore.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search