snippetsqlMinor
how to repair suspect db
Viewed 0 times
suspectrepairhow
Problem
I am trying to repair a suspect database.
The problem is that when I run:
it gives me this response:
when I try this:
it also fails:
what do I do next?
Thanks.
The problem is that when I run:
EXEC sp_resetstatus property;it gives me this response:
Warning: You must recover this database prior to access.when I try this:
ALTER DATABASE property SET EMERGENCY;it also fails:
Msg 5011, Level 14, State 7, Line 1
User does not have permission to alter database 'property', the database does not exist, or the database is not in a state that allows access checks.
Msg 5069, Level 16, State 1, Line 1
ALTER DATABASE statement failed.what do I do next?
Thanks.
Solution
Try This:
EXEC sp_resetstatus [YourDatabase];
ALTER DATABASE [YourDatabase] SET EMERGENCY
DBCC checkdb([YourDatabase])
ALTER DATABASE [YourDatabase] SET SINGLE_USER WITH ROLLBACK IMMEDIATE
DBCC CheckDB ([YourDatabase], REPAIR_ALLOW_DATA_LOSS)
ALTER DATABASE [YourDatabase] SET MULTI_USERCode Snippets
EXEC sp_resetstatus [YourDatabase];
ALTER DATABASE [YourDatabase] SET EMERGENCY
DBCC checkdb([YourDatabase])
ALTER DATABASE [YourDatabase] SET SINGLE_USER WITH ROLLBACK IMMEDIATE
DBCC CheckDB ([YourDatabase], REPAIR_ALLOW_DATA_LOSS)
ALTER DATABASE [YourDatabase] SET MULTI_USERContext
StackExchange Database Administrators Q#175844, answer score: 4
Revisions (0)
No revisions yet.