?
Solved

Locked out of my SQL Server.

Posted on 2007-04-09
3
Medium Priority
?
747 Views
Last Modified: 2012-06-27
I have MSSQL Server running on a Windows Server 2003 environment.  The main DB we use to run our entire business went to single user mode for some reason.  The fix should be simple, just switch back to multi-user mode.  However...when I try to do anything (view tables, users, go to properties) I get the following message:

Error 22285: [SQL-DMO]Database 'GM001' is already open and can only have one user at a time.

This is problematic since I need to get to properties to change back to multi-user mode.
0
Comment
Question by:magicspringsadmin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 32

Accepted Solution

by:
Daniel Wilson earned 2000 total points
ID: 18876561
You need to kill the process that is connected to it.

Open Query Analyzer & point to a different DB (master?).  type "Exec sp_who2" and press F5.

Scan the results to find the SPID that is using the DB in question -- GM001, I guess.

Then execute sp_kill using that SPID as a parameter.

After that, you should be able to go into the DB properties & take it out of single-user mode.
0
 
LVL 16

Expert Comment

by:rboyd56
ID: 18876586
This would indicate that there is already a open.

Here is a simple way to fix this.

Open Query Analyzer and enter these commands:

use GM001
go
sp_dboption 'single user', false
go

Do not execute it

Now in Enterprise Manager - right click on the database
Choose All Tasks
Detach database
Click the clear button to close all connections

Now run the query in Query Analuzer.

There should be no time lag between clicking the Clear button and running the query

0
 

Author Comment

by:magicspringsadmin
ID: 18876792
Well, I tried that, but I have software running on about 42 computers constantly trying to re-establish the connection.  I went around and shut down the software on all of them and now everything works just fine.  Thanks.
0

Featured Post

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
Ready to get certified? Check out some courses that help you prepare for third-party exams.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question