Monday, October 18, 2021

How to repair a DB using SSMS

Open SSMS and run the following command


GO  

ALTER DATABASE AxDB SET SINGLE_USER WITH ROLLBACK IMMEDIATE

GO

 DBCC CHECKDB('AxDB',REPAIR_REBUILD)

 GO  

ALTER DATABASE AxDB SET MULTI_USER

GO


If this didn't work then try this one


GO  

ALTER DATABASE AxDB SET SINGLE_USER WITH ROLLBACK IMMEDIATE

GO

DBCC CHECKDB ('AxDB', REPAIR_ALLOW_DATA_LOSS)

GO

ALTER DATABASE AxDB SET MULTI_USER

GO