Learn how I resolved an interesting use case of a database stuck in Single-User mode after restoring from a backup. Read my latest blog post to find out more!
In this blog post, I share my experience resolving an interesting use case where a customer reported that one of their databases got stuck in “Single-User” mode after restoring from a backup. I tried various methods involving the “ALTER DATABASE” command, setting transaction isolation level and deadlock priority, and even force-killing anyone currently connected to the database, but none of them worked. Eventually, I came up with a script that would “clear the way” for the first session and kill any rogue sessions that barge into the database and block the first session before it can change the database state. This approach worked, and I was able to successfully change the database state back to MULTI_USER, making the database accessible again.