Tuesday, February 8, 2022

How to fix database error in sql 2014 with DBCC

Tags

 

first we need to use below command to check what table error.

DBCC CHECKDB (UAT) WITH NO_INFOMSGS, ALL_ERRORMSGS

Next  we will see which table got error then we need to change database to single user mode in database properties or can use command below:

ALTER DATABASE UAT

SET SINGLE_USER;

 Then time to repair table :

DBCC CHECKTABLE('AT_INOUT', REPAIR_ALLOW_DATA_LOSS)

And then after repair all table error we need to use the first command again to make sure all table was repaired.

DBCC CHECKDB (UAT) WITH NO_INFOMSGS, ALL_ERRORMSGS

Then we need to check log database is it big or not.? if it big we can shrink it by below guide:

Right click -->Task-->Shrink-->File-->then click OK.