Solved

single user mode - list connections

Posted on 2007-11-30
2
1,017 Views
Last Modified: 2010-08-05
I am trying to move the location of my 'msdb' database.  I stopped the Agent service, Analysis service, reporting service and Fulltext service for this instance.

I started up my default instance of sql server 2005 instance in single user mode using the following:
net stop mssqlserver
net start mssqlserver /c /m /T3608

I then type SQLCMD at the prompt and get the following:
Msg 18461, Level 14, State 1, Server XXXXX, Line 1
Login failed for user 'yyyy\xxxx'. Reason: Server is in single user mode. Only one administrator can connect at this time.

I assume that something is connecting to this instance automatically.  How can i list / determine what it is?

thanks
0
Comment
Question by:jlingg
[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
2 Comments
 
LVL 1

Accepted Solution

by:
nbraasch earned 500 total points
ID: 20384099
Look under your processes under current activity, process info in EM.  You will see what is using msdb there.

Here is how you can kill all connections - I use it all the time for moving dbs.

Call it by installing it in master, then run  EXEC USP_KILLPROCESS "msdb"

CREATE procedure usp_killprocess @dbname varchar(128) as
set nocount on
set quoted_identifier off
declare @kill_id int
declare @query varchar(320)
declare killprocess_cursor cursor for
select a.spid from sysprocesses a join
sysdatabases b on a.dbid=b.dbid where b.name=@dbname
open killprocess_cursor
fetch next from killprocess_cursor into @kill_id
while(@@fetch_status =0)
begin
set @query = 'kill ' + convert(varchar,@kill_id)
exec (@query)
fetch next from killprocess_cursor into @kill_id
end
close killprocess_cursor
deallocate killprocess_cursor
GO
0
 
LVL 1

Author Closing Comment

by:jlingg
ID: 31411954
I appreciate the procedure to kill connections.  Very helpful.
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

There are some very powerful Data Management Views (DMV's) introduced with SQL 2005. The two in particular that we are going to discuss are sys.dm_db_index_usage_stats and sys.dm_db_index_operational_stats.   Recently, I was involved in a discu…
I am showing a way to read/import the excel data in table using SQL server 2005... Suppose there is an Excel file "Book1" at location "C:\temp" with column "First Name" and "Last Name". Now to import this Excel data into the table, we will use…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

751 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