Roberto Stefanetti Dynamics NAV & SQL Server Blog


Microsoft Edu & System Engineer @Altea Spa
Archivio Posts
Anno 2012

Anno 2011

Anno 2010

Anno 2009

Anno 2008

Anno 2007

How to repair a SQL Server 2005 Suspect database

  

How to repair a SQL Server 2005 Suspect database

Check DB

Sometimes when you connect to your database server, you may find it in suspect mode. 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 get the exact reason of a database going into suspect mode can be found using the following query,

DBCC CHECKDB (’YourDBname’) WITH NO_INFOMSGS, ALL_ERRORMSGS

Output of the above query will give the errors in the database.

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

Categoria: Sql Server ALL
venerdì, 20 feb 2009 Ore. 16.54

Messaggi collegati

Statistiche
  • Views Home Page: 48.722
  • Views Posts: 131.624
  • Views Gallerie: 4
  • n° Posts: 229
  • n° Commenti: 19
Blogs Amici
    Meteo
    Copyright © 2002-2007 - Blogs 2.0
    dotNetHell.it | Home Page Blogs
    ASP.NET 2.0 Windows 2003