Skip to main content

Repair statement not processed. Database needs to be in single user mode.

When I try to run DBCC repair I get the below the errors .Database needs to

DBCC CHECKTABLE('Person.Address', REPAIR_REBUILD )

Msg 7919, Level 16, State 3, Line 1
Repair statement not processed. Database needs to be in single user mode.

The correct way to run a DBCC CHECKDB or DBCC CHECKTABLE statement with valid REPAIR options is to start SQL Server normally and then explicitly set the database in single user mode. You can do this from either the Enterprise Manager or the Query Analyzer.

When single user mode set to true only one user can connect to the server.

From Enterprise Manager:
  1. Right-click the database name, and then click Properties.
  2. In the Properties dialog box, click Options.
  3. Select the single user option, and then click OK.




      



From Query Analyzer:

   SP_DBOPTION 'AdventureWorks', SINGLE, TRUE

Run DBCC command CHECKDB:


DBCC CHECKTABLE('Person.Address', REPAIR_REBUILD )


Comments