Saturday, September 14, 2019
Fixing the database state
Sometimes after rebooting the server, the database state might stick in "recovery". Waiting and waiting and rebooting might not change to the normal state.
In this case, we need to fix this issue manually.
To view the current database state:
SELECT name, state_desc from sys.databases
To fix the problematic database:
ALTER DATABASE test SET EMERGENCY;
GO
ALTER DATABASE test SET SINGLE_USER
GO
DBCC CHECKDB (test, REPAIR_ALLOW_DATA_LOSS) WITH ALL_ERRORMSGS;
GO
ALTER DATABASE test SET MULTI_USER
GO
Before running the above commands, please make sure you have done sufficient research on the Internet before executing it!
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment