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

  • 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.

  • 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

  • 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
  • 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?

  • Even to get out the schema without the data would be a win at this point.

  • 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 🙂

  • 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
  • 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
  • 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?

Viewing 9 posts - 1 through 8 (of 8 total)

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