Tuesday, April 7, 2009

How to recover a database marked suspect?


SQL Server 2000/2005/2008
Recover database suspect sql server
The following script resets the status of the database and checks the database for integrity.

USE master;

GO

EXEC sp_resetstatus 'MYDATABASE';

GO

USE MYDATABASE;

DBCC CHECKDB WITH NO_INFOMSGS;

GO

SQL Server 2005/2008
Recover database marked suspect sql serve

USE master;

GO

ALTER DATABASE MYDATABASE SET EMERGENCY

GO

ALTER DATABASE MYDATABASE SET SINGLE_USER

GO

DBCC CHECKDB (MYDATABASE, REPAIR_ALLOW_DATA_LOSS) WITH NO_INFOMSGS;

GO

USE MYDATABASE;

DBCC CHECKDB WITH NO_INFOMSGS;

GO

No comments:

Post a Comment