Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I have a database that is stuck in recovery mode for few days already. There are multiple threads about this, but the solutions there don't work for me.

Here is what I tried already:

Error: Exclusive access could not be obtained because the database is in use.

Error: ALTER DATABASE failed because a lock could not be placed on database 'DBNAME'  
I get the same error when trying to set the db to SINGLE_USER

exec sp_who2 --> nothing that contains my database, so nothing that I can kill  
(Or I need to look for something else ??)

I can't just stop the SQL-service, because it contains too many databases that can't go down.

Who knows what I can do to get the database out of recovery mode? At both the primary and mirror location is the database state 'In recovery'.


I found a process in sp_who2 with command DB STARTUP.

At sys.dm_tran_locks, I see this session has a resource_database_id for the database that is in recovery, so this keeps the database locked. Anyone knows how to fix this without stopping SQL Server?

share|improve this question
add comment

2 Answers 2

Do you mind restoring from a backup?

You could try to use KILL on the session, but that might mess up the database integrity.

share|improve this answer
I agree with Nabil. You probably need to KILL the session on the Primary database set the database to SINGLE_USER and then restore using backups. Do the samething on the mirror and then setup your mirroring session again. –  KenWilson Jan 31 at 16:28
Already tried that, but I can't kill the process, error: "Only user processes can be killed." –  Erik Dekker Jan 31 at 16:30
Have you tried ALTER DATABASE <database_name> SET PARTNER OFF to turn off mirroring? –  KenWilson Jan 31 at 16:37
add comment

You might just be at that point where you need to failover and schedule an outage/wait it out.

Not the ideal solution, but it happens :/

share|improve this answer
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.