Repair Suspect mode

USE Master
GO

EXEC sp_configure ‘allow updates’, 1
RECONFIGURE WITH OVERRIDE
GO

BEGIN TRAN
UPDATE master..sysdatabases SET status = status | 32768 WHERE name = ‘YourDBName’
IF @@ROWCOUNT = 1
 BEGIN COMMIT TRAN
  RAISERROR(‘Emergency Mode Successfully Set’, 0, 1)
 END
ELSE
 BEGIN ROLLBACK
 RAISERROR(‘Setting Emergency Mode Failed’, 16, 1)
END
GO
–Stop mssql service

–Rename the existing LOG file for YourDBName database.

–Start mssql service

DBCC REBUILD_LOG(YourDBName,’C:program files….dataYourDBName_log.ldf’)
GO

DBCC checkdb (YourDBName)
GO

–If DBCC return errors then fix it
— BEGIN
 ALTER DATABASE YourDBName SET SINGLE_USER
 GO
 –Repair the consistency errors if found by above command
 DBCC checkdb (YourDBName,REPAIR_ALLOW_DATA_LOSS)
 GO
 –OR
 DBCC checkdb (YourDBName,REPAIR_FAST)
 GO
— END Fix errors finished

ALTER DATABASE YourDBName SET MULTI_USER

Article applies to SQL Server 2000

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s