Showing posts with label explain. Show all posts
Showing posts with label explain. Show all posts

Wednesday, March 28, 2012

How can I clear active connections without disabling the database?

To better explain the question let me build a scenario.
If someone is connected to the database there is an active connection, which does appear in Management Studio. If we try to do a restore of the database, SQL gives us a message saying that it cannot gain exclusive access to the database and the restore fails. To gain exclusive access to the database we need to clear the active connections.
Currently in Management Studio the only ways that I have found to clear the connections are to take the database offline or detach the database completely. What I would like to know is if there is another way to clear the active connections without have to take the database offline or detach it?
In SQL 2000 I could right-click the database, select all tasks, and then select detach database and click clear connections. Of course I would then have to make sure I clicked cancel otherwise I would mistakenly detach the database. This would clear the connections without taking the database offline.
If the only option in Management Studio to clear the connections is to disable the database I would like to request an option under tasks called clear connections. This way the server administrator could click on this to see the current active connections and clear them, either individually, or all of them without having to take the database offline or detach it.
Thanks in advance!

There are several ways you can do this without having to detach the database.
1. run sp_who2 to see all the SPIDs connected to your database. For each SPID, execute kill <spid #>

2. In Object Explorer, Click on Management -> Activity Monitor. RIght-click, select View Processes. From there, you can filter the proccesses any way you want, even by database. After that, you can right-click on each process and select Kill Process.
While it's not a one-shot command, you do have much more control over who gets disconnected.
|||I tried what you suggested and it works. I was curious still though if there are any plans to add a clear connections options that will allow us to clear all connections to a database with one click of a button, similar to SQL 2000.
sql

Friday, February 24, 2012

Hot Standby/Warm Standby

Hi...can someone please explain the difference between a hot standby and
warm standby...and how replication is a hot standby and log shipping is a
warm standbyIn the way that these terms are generally used, a warm standby is a solution
where you can lose a number of modifications (transaction), where a hot
standby is where you don't lose any transactions at all. I'm talking about
committed transactions, btw. Log shipping is warm as you do the log backup
perhaps every 5 minutes, so you can lose 5 minutes worth of data. Cluster is
hot, as both nodes work against the same data. Replication is rather hot, as
the replication latency is in the vicinity of a few seconds.
--
Tibor Karaszi, SQL Server MVP
Archive at:
http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sqlserver
"Terry" <spankme@.nospam.com> wrote in message
news:e4sKB1UrDHA.2584@.TK2MSFTNGP09.phx.gbl...
> Hi...can someone please explain the difference between a hot standby and
> warm standby...and how replication is a hot standby and log shipping is a
> warm standby
>|||This is a multi-part message in MIME format.
--=_NextPart_000_06CC_01C3AD24.2B5C8F20
Content-Type: text/plain;
charset="Windows-1252"
Content-Transfer-Encoding: 7bit
A hot standby will take over from the failed server automatically and in a
short time without human intervention. A clustered install of SQL Server is
an example of a hot standby.
A warm standby takes longer and does require human intervention. Both
methods you described are warm standby's. However, it can be debated as to
whether replication is a standby or not.
--
Tom
---
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinnaclepublishing.com/sql
"Terry" <spankme@.nospam.com> wrote in message
news:e4sKB1UrDHA.2584@.TK2MSFTNGP09.phx.gbl...
Hi...can someone please explain the difference between a hot standby and
warm standby...and how replication is a hot standby and log shipping is a
warm standby
--=_NextPart_000_06CC_01C3AD24.2B5C8F20
Content-Type: text/html;
charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
&

A hot standby will take over from the =failed server automatically and in a short time without human =intervention. A clustered install of SQL Server is an example of a hot =standby.
A warm standby takes longer and does =require human intervention. Both methods you described are warm standby's. =However, it can be debated as to whether replication is a standby or not.
-- Tom
---T=homas A. Moreau, BSc, PhD, MCSE, MCDBASQL Server MVPColumnist, SQL =Server ProfessionalToronto, ON Canadahttp://www.pinnaclepublishing.com/sql">www.pinnaclepublishing.com=/sql
"Terry" wrote in message news:e4sKB1UrDHA.2584=@.TK2MSFTNGP09.phx.gbl...Hi...can someone please explain the difference between a hot standby andwarm standby...and how replication is a hot standby and log shipping is =awarm standby

--=_NextPart_000_06CC_01C3AD24.2B5C8F20--|||I might add that hardware level replications (not SQL replication) such as
EMC SRDF in the synchronous mode can also be considered as a hot standby
solution.
--
Linchi Shea
linchi_shea@.NOSPAMml.com
"Terry" <spankme@.nospam.com> wrote in message
news:e4sKB1UrDHA.2584@.TK2MSFTNGP09.phx.gbl...
> Hi...can someone please explain the difference between a hot standby and
> warm standby...and how replication is a hot standby and log shipping is a
> warm standby
>