Showing posts with label killing. Show all posts
Showing posts with label killing. Show all posts

Wednesday, March 7, 2012

Programmatic killing connections

We want to create canned database restore jobs - possibly
as DTS packages.
We believe we need a way to find and kill database
connections, so that the actual restore can proceed.
Anyone done this ?
TIA
Hi Jim
Killing connections is one way. Another is to put the database into single
user mode, using the rollback immediate option, eg:
alter database [dbname] set single_user with rollback immediate
Check out ALTER DATABASE in Books Online for more info:
http://msdn.microsoft.com/library/en...aa-az_4e5h.asp
HTH
Regards,
Greg Linwood
SQL Server MVP
"Jim Trowbridge" <jtrowbridge@.adelaidebank.com.au> wrote in message
news:ba1001c479c2$5c468bc0$a601280a@.phx.gbl...
> We want to create canned database restore jobs - possibly
> as DTS packages.
> We believe we need a way to find and kill database
> connections, so that the actual restore can proceed.
> Anyone done this ?
> TIA
|||I found a sample script to close all connections on:
http://khsw.blogspot.com/2004/08/sto...nnect-all.html
"Jim Trowbridge" <jtrowbridge@.adelaidebank.com.au> wrote in message news:<ba1001c479c2$5c468bc0$a601280a@.phx.gbl>...
> We want to create canned database restore jobs - possibly
> as DTS packages.
> We believe we need a way to find and kill database
> connections, so that the actual restore can proceed.
> Anyone done this ?
> TIA

Programmatic killing connections

We want to create canned database restore jobs - possibly
as DTS packages.
We believe we need a way to find and kill database
connections, so that the actual restore can proceed.
Anyone done this ?
TIAHi Jim
Killing connections is one way. Another is to put the database into single
user mode, using the rollback immediate option, eg:
alter database [dbname] set single_user with rollback immediate
Check out ALTER DATABASE in Books Online for more info:
http://msdn.microsoft.com/library/e..._aa-az_4e5h.asp
HTH
Regards,
Greg Linwood
SQL Server MVP
"Jim Trowbridge" <jtrowbridge@.adelaidebank.com.au> wrote in message
news:ba1001c479c2$5c468bc0$a601280a@.phx.gbl...
> We want to create canned database restore jobs - possibly
> as DTS packages.
> We believe we need a way to find and kill database
> connections, so that the actual restore can proceed.
> Anyone done this ?
> TIA|||I found a sample script to close all connections on:
http://khsw.blogspot.com/2004/08/st...onnect-all.html
"Jim Trowbridge" <jtrowbridge@.adelaidebank.com.au> wrote in message news:<ba1001c479c2$5c468
bc0$a601280a@.phx.gbl>...
> We want to create canned database restore jobs - possibly
> as DTS packages.
> We believe we need a way to find and kill database
> connections, so that the actual restore can proceed.
> Anyone done this ?
> TIA

Programmatic killing connections

We want to create canned database restore jobs - possibly
as DTS packages.
We believe we need a way to find and kill database
connections, so that the actual restore can proceed.
Anyone done this ?
TIAHi Jim
Killing connections is one way. Another is to put the database into single
user mode, using the rollback immediate option, eg:
alter database [dbname] set single_user with rollback immediate
Check out ALTER DATABASE in Books Online for more info:
http://msdn.microsoft.com/library/en-us/tsqlref/ts_aa-az_4e5h.asp
HTH
Regards,
Greg Linwood
SQL Server MVP
"Jim Trowbridge" <jtrowbridge@.adelaidebank.com.au> wrote in message
news:ba1001c479c2$5c468bc0$a601280a@.phx.gbl...
> We want to create canned database restore jobs - possibly
> as DTS packages.
> We believe we need a way to find and kill database
> connections, so that the actual restore can proceed.
> Anyone done this ?
> TIA|||I found a sample script to close all connections on:
http://khsw.blogspot.com/2004/08/stored-procedure-to-disconnect-all.html
"Jim Trowbridge" <jtrowbridge@.adelaidebank.com.au> wrote in message news:<ba1001c479c2$5c468bc0$a601280a@.phx.gbl>...
> We want to create canned database restore jobs - possibly
> as DTS packages.
> We believe we need a way to find and kill database
> connections, so that the actual restore can proceed.
> Anyone done this ?
> TIA