I have a database that is stuck in single-user mode. I kill the process that obtains the "lock" on the db but when I kill it another one spawns automatically, (using the sa account). This happens even with SQL Server agent disabled. Any ideas?
Under certain circumstances, you may have to start an instance of SQL Server in single-user mode by using the startup option -m . For example, you may want to change server configuration options or recover a damaged master database or other system database.
All the users who are part of the Local Administrator group can connect to SQL Server with privileges of sysadmin server-level role. To start SQL Server in multi-user mode, remove the added -m start parameter from properties of the SQL Server service and restart the SQL Server service.
Can you login into the server/database?
If not, try the ADMIN:ServerName and it should open an emergency admin session
Then you can go into the SQL Server to ALTER DATABASE [name] SET MULTI_USER
It's probably your SQL Management Studio (or similar) connection. Your killing your own connection, then re-connecting to see if anyone else is on it, resulting in another connection.
If that is not it, check out the properties (username, status, Application) of the connection in the "Activity Monitor" (under the "Management" folder).
If you want to move it out of single user mode, right click on the database and go to the properties. Select the "Options", and right down the bottom is a property called "Restrict Access".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With