Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL Server 2005 database stuck in single user mode

Tags:

sql-server

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?

like image 454
Gibbons Avatar asked Nov 25 '08 00:11

Gibbons


People also ask

How do I restart SQL Server in single user mode?

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.

How do I start SQL Server in multi user mode?

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.


2 Answers

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

like image 92
jerryhung Avatar answered Sep 30 '22 05:09

jerryhung


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".

like image 38
Robert Wagner Avatar answered Sep 30 '22 06:09

Robert Wagner