Repair MS SQL Corrupted or Suspected Database

1 post / 0 new
#1 20 April, 2017 - 18:31
Divya
Divya's picture

Repair MS SQL Corrupted or Suspected Database

Execute the below query by replacing the 'test' with the database name.
  1. EXEC sp_resetstatus 'test'
  2.  
  3. ALTER DATABASE test SET EMERGENCY
  4.  
  5. DBCC CheckDB ('test')
  6.  
  7. ALTER DATABASE test SET SINGLE_USER WITH ROLLBACK IMMEDIATE
  8.  
  9. DBCC CheckDB ('test', REPAIR_ALLOW_DATA_LOSS)
  10.  
  11. ALTER DATABASE test SET MULTI_USER