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


MDF-Can't Get Out Of Suspect Mode....Need Some Help Please


MDF-Can't Get Out Of Suspect Mode....Need Some Help Please

Author
Message
jpage01
jpage01
SSC-Enthusiastic
SSC-Enthusiastic (166 reputation)SSC-Enthusiastic (166 reputation)SSC-Enthusiastic (166 reputation)SSC-Enthusiastic (166 reputation)SSC-Enthusiastic (166 reputation)SSC-Enthusiastic (166 reputation)SSC-Enthusiastic (166 reputation)SSC-Enthusiastic (166 reputation)

Group: General Forum Members
Points: 166 Visits: 11
I have a 90 gig MDF file .. originally a .BAK file from a SQL 2005 backup.

I can sometimes get the MDF file to load in SQL 2005/2008 but only in "suspect" mode due to the errors. All my attempts to get the DB out of suspect mode (emergency mode, alter systables, etc) have failed.... the DB never comes online.

Here is the basic error trying to attach the MDF (copied from SQL error):


TITLE: Microsoft SQL Server Management Studio
------------------------------
Attach database failed for Server 'WIN-4PG10YJGS2J'. (Microsoft.SqlServer.Smo)

SQL Server detected a logical consistency-based I/O error: incorrect pageid (expected 1:511232; actual 0:0). It occurred during a read of page (1:511232) in database ID 7 at offset 0x000000f9a00000 in file 'E:\ZDDB1.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.
Could not open new database 'ZDDB1'. CREATE DATABASE is aborted. (Microsoft SQL Server, Error: 824)

Any help you guys can offer would be very much appreciated. Any tips that prove to be a solution I have no problem sending paypal as this is critical data for us.
jpage01
jpage01
SSC-Enthusiastic
SSC-Enthusiastic (166 reputation)SSC-Enthusiastic (166 reputation)SSC-Enthusiastic (166 reputation)SSC-Enthusiastic (166 reputation)SSC-Enthusiastic (166 reputation)SSC-Enthusiastic (166 reputation)SSC-Enthusiastic (166 reputation)SSC-Enthusiastic (166 reputation)

Group: General Forum Members
Points: 166 Visits: 11
Here are the results of

DBCC CheckDB ('DBNAME', REPAIR_ALLOW_DATA_LOSS)


DBCC results for 'DBNAME'.
CHECKDB found 0 allocation errors and 0 consistency errors in database 'DBNAME'.
Msg 824, Level 24, State 2, Line 1
SQL Server detected a logical consistency-based I/O error: incorrect pageid (expected 1:776; actual 0:0). It occurred during a read of page (1:776) in database ID 5 at offset 0x00000000610000 in file 'E:\DBNAME2005.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.
Msg 824, Level 24, State 2, Line 1
SQL Server detected a logical consistency-based I/O error: incorrect pageid (expected 1:776; actual 0:0). It occurred during a read of page (1:776) in database ID 5 at offset 0x00000000610000 in file 'E:\DBNAME2005.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.
Msg 824, Level 24, State 2, Line 1
SQL Server detected a logical consistency-based I/O error: incorrect pageid (expected 1:776; actual 0:0). It occurred during a read of page (1:776) in database ID 5 at offset 0x00000000610000 in file 'E:\DBNAME2005.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.
Msg 824, Level 24, State 2, Line 1
SQL Server detected a logical consistency-based I/O error: incorrect pageid (expected 1:776; actual 0:0). It occurred during a read of page (1:776) in database ID 5 at offset 0x00000000610000 in file 'E:\DBNAME2005.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.
Msg 7909, Level 20, State 1, Line 1
The emergency-mode repair failed.You must restore from backup.DBNAME
GilaMonster
GilaMonster
SSC Guru
SSC Guru (469K reputation)SSC Guru (469K reputation)SSC Guru (469K reputation)SSC Guru (469K reputation)SSC Guru (469K reputation)SSC Guru (469K reputation)SSC Guru (469K reputation)SSC Guru (469K reputation)

Group: General Forum Members
Points: 469650 Visits: 47358
jpage01 (5/30/2010)

Msg 7909, Level 20, State 1, Line 1
The emergency-mode repair failed.You must restore from backup.DBNAME


That says it all. Emergency mode is the very last resort, if it fails, there's nothing else that can be done. I hope you have a backup somewhere. If not, why the hell not if the DB is so critical?

p.s. You shouldn't even be considering modifying the system tables. It's a near guarantee of further further damage, especially on SQL 2005+ where 'tables' like systables aren't tables but views and the system tables are hidden, completely undocumented and reasonably complex

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


jpage01
jpage01
SSC-Enthusiastic
SSC-Enthusiastic (166 reputation)SSC-Enthusiastic (166 reputation)SSC-Enthusiastic (166 reputation)SSC-Enthusiastic (166 reputation)SSC-Enthusiastic (166 reputation)SSC-Enthusiastic (166 reputation)SSC-Enthusiastic (166 reputation)SSC-Enthusiastic (166 reputation)

Group: General Forum Members
Points: 166 Visits: 11
Gail,
Thank you for responding. I am walking into this project late. I am not the programmer and haven't touched this before this week. The db is from an old project that had been archived. However, we had this backup of the db both in bak and mdf and are trying to restore. So, am I totally without options here?
jpage01
jpage01
SSC-Enthusiastic
SSC-Enthusiastic (166 reputation)SSC-Enthusiastic (166 reputation)SSC-Enthusiastic (166 reputation)SSC-Enthusiastic (166 reputation)SSC-Enthusiastic (166 reputation)SSC-Enthusiastic (166 reputation)SSC-Enthusiastic (166 reputation)SSC-Enthusiastic (166 reputation)

Group: General Forum Members
Points: 166 Visits: 11
Even to get out the schema without the data would be a win at this point.
smratisharma
smratisharma
Valued Member
Valued Member (72 reputation)Valued Member (72 reputation)Valued Member (72 reputation)Valued Member (72 reputation)Valued Member (72 reputation)Valued Member (72 reputation)Valued Member (72 reputation)Valued Member (72 reputation)

Group: General Forum Members
Points: 72 Visits: 0
I want to share this across as I recently faced issue. Today in morning when I tried to connect to database server, I find it in suspect mode. At this point your database server won’t allow you to perform any operation on that database until the database is repaired.

A database can go in suspect mode for many reasons like improper shutdown of the database server, corruption of the database files etc.


To repair the database, run the following queries in Query Analyzer


EXEC sp_resetstatus ‘yourDBname’;
ALTER DATABASE yourDBname SET EMERGENCY
DBCC checkdb(‘yourDBname’)
ALTER DATABASE yourDBname SET SINGLE_USER WITH ROLLBACK IMMEDIATE
DBCC CheckDB (‘yourDBname’, REPAIR_ALLOW_DATA_LOSS)
ALTER DATABASE yourDBname SET MULTI_USER


And It Repairs the Database. It Works for Me :-)
GilaMonster
GilaMonster
SSC Guru
SSC Guru (469K reputation)SSC Guru (469K reputation)SSC Guru (469K reputation)SSC Guru (469K reputation)SSC Guru (469K reputation)SSC Guru (469K reputation)SSC Guru (469K reputation)SSC Guru (469K reputation)

Group: General Forum Members
Points: 469650 Visits: 47358
smratisharma (5/31/2010)
To repair the database, run the following queries in Query Analyzer

EXEC sp_resetstatus ‘yourDBname’;
ALTER DATABASE yourDBname SET EMERGENCY
DBCC checkdb(‘yourDBname’)
ALTER DATABASE yourDBname SET SINGLE_USER WITH ROLLBACK IMMEDIATE
DBCC CheckDB (‘yourDBname’, REPAIR_ALLOW_DATA_LOSS)
ALTER DATABASE yourDBname SET MULTI_USER

And It Repairs the Database. It Works for Me :-)


If you had bothered to read the initial post completely, you would have noticed that the OP tried this and the emergency mode repair failed. Hence, this advice is completely useless in this case. It is also not the recommended first approach to dealing with corruption.

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


GilaMonster
GilaMonster
SSC Guru
SSC Guru (469K reputation)SSC Guru (469K reputation)SSC Guru (469K reputation)SSC Guru (469K reputation)SSC Guru (469K reputation)SSC Guru (469K reputation)SSC Guru (469K reputation)SSC Guru (469K reputation)

Group: General Forum Members
Points: 469650 Visits: 47358
jpage01 (5/31/2010)
So, am I totally without options here?


Pretty much, yes. This is not repairable.

After setting the DB to emergency mode (but before trying the repair), can you access the DB? If you can, you may be able to script some objects and extract some of the data.

If you can, great, script out what you can, some stuff may fail. If you can't, you are SOL (So Outa Luck)

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


paul.knibbs
paul.knibbs
SSCertifiable
SSCertifiable (7.1K reputation)SSCertifiable (7.1K reputation)SSCertifiable (7.1K reputation)SSCertifiable (7.1K reputation)SSCertifiable (7.1K reputation)SSCertifiable (7.1K reputation)SSCertifiable (7.1K reputation)SSCertifiable (7.1K reputation)

Group: General Forum Members
Points: 7054 Visits: 6240
You say you have both a BAK and an MDF, but you've only talked about re-attaching the MDF file. I assume you've tried to restore the BAK and that failed?
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