Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

MDF-Can't Get Out Of Suspect Mode....Need Some Help Please Expand / Collapse
Author
Message
Posted Sunday, May 30, 2010 5:54 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, June 01, 2010 11:45 AM
Points: 4, 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.
Post #930198
Posted Sunday, May 30, 2010 7:42 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, June 01, 2010 11:45 AM
Points: 4, 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
Post #930203
Posted Sunday, May 30, 2010 11:12 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 12:01 PM
Points: 30,217, Visits: 23,017
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
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

Post #930228
Posted Monday, May 31, 2010 2:43 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, June 01, 2010 11:45 AM
Points: 4, 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?
Post #930278
Posted Monday, May 31, 2010 2:47 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, June 01, 2010 11:45 AM
Points: 4, Visits: 11
Even to get out the schema without the data would be a win at this point.
Post #930281
Posted Monday, May 31, 2010 3:02 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Monday, May 31, 2010 2:57 AM
Points: 2, 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
Post #930285
Posted Monday, May 31, 2010 3:23 AM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 12:01 PM
Points: 30,217, Visits: 23,017
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
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

Post #930291
Posted Monday, May 31, 2010 3:27 AM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 12:01 PM
Points: 30,217, Visits: 23,017
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
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

Post #930295
Posted Tuesday, June 01, 2010 2:45 AM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Today @ 9:44 AM
Points: 810, Visits: 2,772
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?
Post #930580
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse