Showing posts with label active. Show all posts
Showing posts with label active. Show all posts

Monday, March 26, 2012

Killing an active connection

Is there any stored procedure to kill an active database connection?
Thanks
use sp_who to find out what sessions are running.
use kill <spid> to kill the session you want.
|||Sorry forgot to mention - if it is a long running transaction, you need
to be aware. As if you kill that, it may even take LONGER to finish
off and you cannot kill a rollback transaction.
|||Thanks so much!
"MSLam" <MelodySLam@.googlemail.com> escreveu na mensagem
news:1143580695.100118.311230@.e56g2000cwe.googlegr oups.com...
> Sorry forgot to mention - if it is a long running transaction, you need
> to be aware. As if you kill that, it may even take LONGER to finish
> off and you cannot kill a rollback transaction.
>

Killing an active connection

Is there any stored procedure to kill an active database connection?
Thanksuse sp_who to find out what sessions are running.
use kill <spid> to kill the session you want.|||Sorry forgot to mention - if it is a long running transaction, you need
to be aware. As if you kill that, it may even take LONGER to finish
off and you cannot kill a rollback transaction.|||Thanks so much!
"MSLam" <MelodySLam@.googlemail.com> escreveu na mensagem
news:1143580695.100118.311230@.e56g2000cwe.googlegroups.com...
> Sorry forgot to mention - if it is a long running transaction, you need
> to be aware. As if you kill that, it may even take LONGER to finish
> off and you cannot kill a rollback transaction.
>sql

Killing an active connection

Is there any stored procedure to kill an active database connection?
Thanksuse sp_who to find out what sessions are running.
use kill <spid> to kill the session you want.|||Sorry forgot to mention - if it is a long running transaction, you need
to be aware. As if you kill that, it may even take LONGER to finish
off and you cannot kill a rollback transaction.|||Thanks so much!
"MSLam" <MelodySLam@.googlemail.com> escreveu na mensagem
news:1143580695.100118.311230@.e56g2000cwe.googlegroups.com...
> Sorry forgot to mention - if it is a long running transaction, you need
> to be aware. As if you kill that, it may even take LONGER to finish
> off and you cannot kill a rollback transaction.
>

Killing active connections before detaching a database

How can I kill all active connections to a database before detaching it?
I am calling sp_detach_db from an application but I keep getting the error
"Cannot detach because there are one or more active connections."
Thanks,
RonKill spid
Madhivanan|||2 ways
1
--loop through the sysprocesses
DECLARE @.sysDbName SYSNAME
SELECT @.sysDbName = 'northwind'
SELECT IDENTITY(int, 1,1)AS ID,spid
INTO #LoopProcess
FROM master..sysprocesses
WHERE dbid = DB_ID(@.sysDbName)
DECLARE @.SPID SMALLINT
DECLARE @.SQL VARCHAR(255)
DECLARE @.MaxID INT, @.LoopID INT
SELECT @.LoopID =1,@.MaxID = MAX(ID) FROM #LoopProcess
WHILE @.LoopID <= @.MaxID
BEGIN
SELECT @.SPID = spid FROM #LoopProcess WHERE ID = @.LoopID
SELECT @.SQL = 'KILL ' + CONVERT(VARCHAR, @.SPID)
EXEC( @.SQL )
SELECT @.LoopID = @.LoopID +1
END
DROP TABLE #LoopProcess
2
--alter the DB by making it single user (all transaction will be rolled
back)
ALTER DATABASE northwind SET SINGLE_USER WITH ROLLBACK IMMEDIATE
--do your restore here
-- Make the DB multi user again
ALTER DATABASE northwind SET MULTI_USER
http://sqlservercode.blogspot.com/|||That won't stop them from "crawling" back. ;)
Use:
use master
alter database <database name>
set single_user
with rollback immediate
...to kill all users immediately, or:
alter database <database name>
set single_user
with rollback after <number> seconds
...to give them time to finish their work.
ML
http://milambda.blogspot.com/|||That's what I call the "nuclear option". ;-)
"ML" <ML@.discussions.microsoft.com> wrote in message
news:15E4ACA2-392A-4986-B4A5-7E52EA9DDB33@.microsoft.com...
> That won't stop them from "crawling" back. ;)
> Use:
> use master
> alter database <database name>
> set single_user
> with rollback immediate
> ...to kill all users immediately, or:
> alter database <database name>
> set single_user
> with rollback after <number> seconds
> ...to give them time to finish their work.
>
> ML
> --
> http://milambda.blogspot.com/|||THANKS!
No problem, the databases that will be called by this procedure are only
used under controlled circustances.
Ron
"JT" <someone@.microsoft.com> wrote in message
news:OkmBFzUOGHA.3100@.TK2MSFTNGP11.phx.gbl...
> That's what I call the "nuclear option". ;-)
> "ML" <ML@.discussions.microsoft.com> wrote in message
> news:15E4ACA2-392A-4986-B4A5-7E52EA9DDB33@.microsoft.com...
>|||When you gotta nuke'em, you gotta nuke'em. :)
ML
http://milambda.blogspot.com/

Kill user connection from database

I am trying out the detaching of the database and found that there are active user connection to it. The connection has lead to the failed in detaching the database. Can I know how do I kill that user connection? Thanks.

Quote:

Originally Posted by Edwintanst

I am trying out the detaching of the database and found that there are active user connection to it. The connection has lead to the failed in detaching the database. Can I know how do I kill that user connection? Thanks.


Go to Enterprise Manager, expand "Management" in the left pane, expand "Current Activity", then "Locks/Object". Click on your object, then in the right pane double-click the lock, then "Kill process".|||Thank you. I will give it a try.

Friday, March 23, 2012

Kill Processes

Can you kill processes in SQL Server 2K without stopping SQL Server and restarting it? I am using sp_who2 to get a list of active users and I see some accounts that are logged off but still showing up and I am trying to find a way to Kill these accounts and the processes they are doing.you can use
1) KILL 53(spid)
Or
Enterprise Manager-->Management-->current Activity-->Process Info
you can pick specific spid and kill it from here..
SS|||What do you mean logged off?

Sleeping?

How many connections are we talking about?

Do you see the Login?

Can you NET SEND them a message?

Better off to leave them alone...It takes resources to reestablish them...

Anyway you'll love this...

It's KILL <spid>|||Do I just do this in the Query Analyer?

kill logged in processes to a database

How do kill all the processes in a database? Here is my situation; I copy a
database called “Active” into a database called “Training” once a we
ek. If
there are still students logged into the Training database the job fails and
I have to go and kill all the processes related to the Training databases so
that I can restart the job that copies that Active database to the training
database. Is there a t-sql script that I can use to kill all (1 – 500) the
users logged into Training database as a first step in a job before the copy
process?
Thanks
JosephSur you can do that by looping through the process and kill them by a cursor
basis, but the best thing would be to use ALTER DATABASE statement to set
the database to a "restricted" mode where you can do your maintainance. More
information in BOL under ALTER DATABASE e.g.
ALTER DATABASE <Nameofthedb> SET
SINGLE_USER with rollback immediate
Setting back after the maintainance:
ALTER DATABASE <Nameofthedb> SET
READWRITE with rollback immediate
HTH, Jens Suessmeyer.
http://www.sqlserver2005.de
--
"Joseph" <Joseph@.discussions.microsoft.com> schrieb im Newsbeitrag
news:C44DC59D-FD66-4491-9620-84DB1A59CC0E@.microsoft.com...
> How do kill all the processes in a database? Here is my situation; I copy
> a
> database called "Active" into a database called "Training" once a w.
> If
> there are still students logged into the Training database the job fails
> and
> I have to go and kill all the processes related to the Training databases
> so
> that I can restart the job that copies that Active database to the
> training
> database. Is there a t-sql script that I can use to kill all (1 - 500) the
> users logged into Training database as a first step in a job before the
> copy
> process?
> Thanks
> Joseph
>sql

Wednesday, March 21, 2012

kill all processes

Hello
I am looking for a command that would kill all sessions (active or not) on a
database or server.
Is there such command?
thanks for your help
WilfridIt is easy at the database level. Use ALTER DATABASE ... SET SINGLE_USER WITH ROLLBACK IMMEDIATE. At
the server level, you could loop sysprocesses and for each connection, execute the KILL command.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Wilfrid" <grille11@.yahoo.com> wrote in message news:442d4094$0$479$626a54ce@.news.free.fr...
> Hello
> I am looking for a command that would kill all sessions (active or not) on a database or server.
> Is there such command?
> thanks for your help
> Wilfrid
>

kill all processes

Hello
I am looking for a command that would kill all sessions (active or not) on a
database or server.
Is there such command?
thanks for your help
Wilfrid
It is easy at the database level. Use ALTER DATABASE ... SET SINGLE_USER WITH ROLLBACK IMMEDIATE. At
the server level, you could loop sysprocesses and for each connection, execute the KILL command.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Wilfrid" <grille11@.yahoo.com> wrote in message news:442d4094$0$479$626a54ce@.news.free.fr...
> Hello
> I am looking for a command that would kill all sessions (active or not) on a database or server.
> Is there such command?
> thanks for your help
> Wilfrid
>
sql

kill all processes

Hello
I am looking for a command that would kill all sessions (active or not) on a
database or server.
Is there such command?
thanks for your help
WilfridIt is easy at the database level. Use ALTER DATABASE ... SET SINGLE_USER WIT
H ROLLBACK IMMEDIATE. At
the server level, you could loop sysprocesses and for each connection, execu
te the KILL command.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Wilfrid" <grille11@.yahoo.com> wrote in message news:442d4094$0$479$626a54ce@.news.free.fr...

> Hello
> I am looking for a command that would kill all sessions (active or not) on
a database or server.
> Is there such command?
> thanks for your help
> Wilfrid
>

Friday, February 24, 2012

Keep Same Virtual Name

Hello,
We have a 2 node Sql 2000 cluster running on Legato Cluster. We are
planning to move it to MSCS 2 node Active/Passive Cluster. I am trying
to migrate to have less downtime which allows me to backout if any
problems.
Questions:
1. Can we keep same Virtual Server Name when we move to MSCS ...
2. Using DNS Alias is that recommended and is their any performance
issues?
3. Can we Change Virtual IP address of MSCS cluster node to the old IP
that the legato cluster used...
In order:
1) Only if you do an in-place upgrade. No bailout without an uninstall and
a reinstall.
2) No performance issues with DNS alias. DNs is very efficient and client
cached.
3) You can use any IP address on the same subnet as long as it is not
already in use.
Geoff N. Hiten
Senior Database Administrator
Microsoft SQL Server MVP
<imsajil@.gmail.com> wrote in message
news:1165249946.641878.318150@.f1g2000cwa.googlegro ups.com...
> Hello,
> We have a 2 node Sql 2000 cluster running on Legato Cluster. We are
> planning to move it to MSCS 2 node Active/Passive Cluster. I am trying
> to migrate to have less downtime which allows me to backout if any
> problems.
> Questions:
> 1. Can we keep same Virtual Server Name when we move to MSCS ...
> 2. Using DNS Alias is that recommended and is their any performance
> issues?
> 3. Can we Change Virtual IP address of MSCS cluster node to the old IP
> that the legato cluster used...
>