2012年3月19日星期一

disconnect users

Hi,
I was wondering if there is a stored procedure that could disconnect users.
I have job which does some integrity checks, but for one database it
always fails. There is always a connection open. That particular
useraccount is for the oracle applicationserver which should remain active.
How can i resolve this matter and still do maintenance?Do you want to disconnect the users, or not disconnect that user?
If you want to disconnect the users:
USE <databasename>
GO
ALTER DATABASE <databasename> SET SINGLE_USER WITH ROLLBACK IMMEDIATE
GO
(note, this will force all users out and cause any transactions they're in
to roll back -- immediately. There is also a time option; look up syntax in
BOL.)
To allow other users to connect once you're done:
ALTER DATABASE <databasename> SET MULTI_USER
GO
Adam Machanic
Pro SQL Server 2005, available now
http://www.apress.com/book/bookDisplay.html?bID=457
--
"Jason" <jasonlewis@.hotmail.com> wrote in message
news:%23Qqt7rkeGHA.4912@.TK2MSFTNGP05.phx.gbl...
> Hi,
> I was wondering if there is a stored procedure that could disconnect
> users.
> I have job which does some integrity checks, but for one database it
> always fails. There is always a connection open. That particular
> useraccount is for the oracle applicationserver which should remain
> active.
> How can i resolve this matter and still do maintenance?

没有评论:

发表评论