If you happen to notice that your MSSQL database/s are stuck in
suspect mode, you can easily run a query that will process the database
and restore it for you (restore the status, not the actual database).
To do this, you simply need to run the following query. Keep in mind you will need to change our “your database name” for the actual database name.
EXEC sp_resetstatus yourdatabasename;
ALTER DATABASE yourdatabasename SET EMERGENCY
DBCC checkdb(yourdatabasename)
ALTER DATABASE yourdatabasename SET SINGLE_USER WITH ROLLBACK IMMEDIATE
DBCC CheckDB (yourdatabasename, REPAIR_ALLOW_DATA_LOSS)
ALTER DATABASE yourdatabasename SET MULTI_USER
This will correct the issue and you can continue using the database.
To do this, you simply need to run the following query. Keep in mind you will need to change our “your database name” for the actual database name.
EXEC sp_resetstatus yourdatabasename;
ALTER DATABASE yourdatabasename SET EMERGENCY
DBCC checkdb(yourdatabasename)
ALTER DATABASE yourdatabasename SET SINGLE_USER WITH ROLLBACK IMMEDIATE
DBCC CheckDB (yourdatabasename, REPAIR_ALLOW_DATA_LOSS)
ALTER DATABASE yourdatabasename SET MULTI_USER
This will correct the issue and you can continue using the database.
No comments:
Post a Comment