·
Check what is blocking the database
recovery which can be done by inspecting below query.
SELECT DB_NAME(dbid),* FROM dbo.sysprocesses WHERE
spid > 50 and spid <> @@SPID
|
·
Try to kill the blocking SPIDs but got the
error message “Only user processes
can be killed”.
·
Try to delete the database by putting it to
single user mode but the execution was just going on and on inspecting the
query in first step found that drop database was waiting on recovery to finish.
·
Try to make the database offline but it was
also waiting on recovery to finish.
·
Lastly we decided to
a.
Stop the server because anyway the application
was already down.
b.
Then we cut and pasted the ldf, mdf and ndf
files to another folder (Actually cut-paste
is very fast option as it just changes the pointer in the disk).
c.
Start the SQL Server service again the
recovery mode was gone.
·
Delete the database and restored the latest
backups.
The
query to find the file path of a database is as below.
SELECT D.dbid, D.name, F.physical_name
FROM sys.master_files F
JOIN dbo.sysdatabases D on F.database_id = D.dbid
|
This
may not be a perfect way to deal with the situation but it worked very quick and nicely because recovery is done
through files and when there are no files no recovery can be done. Moreover we were
having liberty to restart the SQL Server service as well which others may not
have on these scenarios.
No comments:
Post a Comment