Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 Those little (*^)(^....

Author  Topic 

jholovacs
Posting Yak Master

163 Posts

Posted - 2009-07-14 : 11:23:25
I'm trying to do maintenance on a database where a bunch of developers and applications with a bunch of different credentials are connecting to it all the time, and this interferes with the work I'm doing. So I stick it into single user mode, I'm about to start... and someone's already taken the connection! Now I can't even see who has it because the Activity monitor can't access the database.

How do I find out who's in the database, kick his butt out, and inject myself so nobody else can get in?



SELECT TOP 1
w.[name]
FROM
dbo.women w
INNER JOIN
dbo.inlaws i
ON
i.inlaw_id = w.parent_id
WHERE
i.net_worth > 10000000
AND
i.status IN ('dead', 'dying')
AND
w.husband_id IS NULL
ORDER BY
w.hotness_factor DESC

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-07-14 : 11:39:56
Maybe that is a good tip:
http://statisticsio.com/Home/tabid/36/articleType/ArticleView/articleId/369/Connecting-to-SQL-Server-in-Single-User-Mode.aspx


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

jholovacs
Posting Yak Master

163 Posts

Posted - 2009-07-14 : 12:58:50
meh... that requires me to use SQLCMD. I want to make a connection to the database in Management Studio so I can query and run procs as needed.



SELECT TOP 1
w.[name]
FROM
dbo.women w
INNER JOIN
dbo.inlaws i
ON
i.inlaw_id = w.parent_id
WHERE
i.net_worth > 10000000
AND
i.status IN ('dead', 'dying')
AND
w.husband_id IS NULL
ORDER BY
w.hotness_factor DESC
Go to Top of Page

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2009-07-14 : 14:30:17
should use restricted_user instead of single_user
Go to Top of Page
   

- Advertisement -