This issues may cause by:
- There is not enough space available for the SQL Server to recover the database during startup.
- The database cannot be opened due to inaccessible files or insufficient memory or disk space.
- The database files are being held by operating system, third party backup software etc.
- There was an unexpected SQL Server Shutdown, power failure or a hardware failure.
In order to resolve this problem, recovering is needed to access again the database. So first of all you may need a database administrator account login the MS SQL Management and click on new query button. And start the script as below:
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
Replace YourDatabaseName with your database name. In my example will be as follow.
EXEC
sp_resetstatus [test_dr];
ALTER
DATABASE
[test_dr]
SET
EMERGENCY
DBCC checkdb([test_dr])
ALTER
DATABASE
[test_dr]
SET
SINGLE_USER
WITH
ROLLBACK
IMMEDIATE
DBCC CheckDB ([test_dr], REPAIR_ALLOW_DATA_LOSS)
ALTER
DATABASE
[test_dr]
SET
MULTI_USER
Once you have done the script, click on execute query at the top. If for the first time is fail, double click again the make the script run. Then refresh your Object explorer and the (Suspect) will get rid and able to access the database again.
No comments:
Post a Comment