Subscribe to Windows IT Pro

 

Get Newsletters

  • Get the Latest News
  • Product Updates
  • Helpful Tricks
  • Productivity Tips

Subscribe Now!

February 05, 2000 12:00 AM

My SQL Server database has been marked "suspect" - what can I do?

Windows IT Pro
InstantDoc ID #14047
Rating: (17)

A. A. In addition to these ideas, also check out support.microsoft.com/support for the Microsoft Knowledgebase. Specifically Q165918.

Firstly look in <sql>\LOG and look at all recent errorlog(s). There WILL be an indication here as to why the database has been marked suspect. You need to fix whatever the problem is first (i.e. missing file, permissions problem, hardware error etc.)

Then, when the problem has been fixed and you're either sure that the data is going to be ok, or you have no backup anyway, so you've nothing to lose, then change the database status to normal and restart SQL Server. To change the database status, and to get more information on recovery, look up the sp_resetstatus sp in the Books Online.

If you don't have access to sp_resetstatus information, then the short version of this is :-

UPDATE master..sysdatabases SET status = status ^ 256 WHERE name = <dbname>

If the database still goes back into suspect mode, and you can't fix the original problem, and you have no recent backup, then you can get information out of the database by putting it into emergency mode. If you do this, extract the data/objects out with bcp/transfer manager and then rebuild the database. Note that the data may be corrupt or transactionally inconsistent.

Issue the following command to put the database into emergency mode (you'll need to allow updates first)

UPDATE master..sysdatabases SET status=-32768 WHERE name='<dbname>'


Related Content:

ARTICLE TOOLS

Comments
  • Anonymous User
    7 years ago
    Jul 17, 2005


    Here is more details of this solution..
    http://www.spaceprogram.com/knowledge/sqlserver_recover_from_deleted_log.html

    enjoy,,
    cpdinesh@gmail.com

  • Hugo Walter Rodriguez
    11 years ago
    Jun 12, 2001

    i do not view databases for suspect source
    SQL Server Assertion: File: , line=2992
    Failed Assertion = 'spaceNeeded <= spaceContig && spaceNeeded <= space_usable'.
    I don't urdestend

  • Sören Schlegel
    11 years ago
    May 07, 2001

    The hint how to put the database in emergency mode is great. The way how to set a database in emergency mode is not mentioned at all in the SQL-Server documentation.

You must log on before posting a comment.

Are you a new visitor? Register Here

advertisement

advertisement

White Papers

Get your Windows 7 deployment off to the right start by implementing PC lockdown. A locked-down environment is easier and cheaper to support since users are less likely to make unnecessary changes to the core system configuration - read more here!

Essential Guides

Is your iSCSI "lossy"? The reality is that most off-the-shelf Ethernet hardware deployed for iSCSI can lose packets, resulting in slow performance or application downtime. Learn how to assess your current iSCSI infrastructure and engineer an advanced iSCSI SAN infrastructure.

Web Seminars

What's the best way to keep your network safe from malware? In this web seminar, security expert Greg Shields suggests an alternative method to the traditional blacklisting approach that is common with anti-virus and anti-malware solutions.

eLearning Series

We bring the experts direct to you to share their real-world perspective and expertise. During each event, three sessions stream in real time, so you can learn, ask questions, and get solutions.
Upcoming event: Getting the Most with Exchange 2010 with Paul Robichaux

Subscribe to Windows IT Pro!

Windows is a trademark of the Microsoft group of companies. Windows IT Pro is used by Penton Media Inc. under license from owner.