March 15, 2011 at 5:12 am
Hi
Duds!!
Just sujest me
What steps to follow, If there is an open transaction on Database server?
Thanks in advance
Ali
MCTS SQL Server2k8
March 15, 2011 at 5:26 am
Step 1: Evaluate whether or not it is a problem. No sense in doing anything if there's no problem.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
March 15, 2011 at 5:28 am
well an open transaction is not a bad thing.
a running process could take a lot of time to finish; so in general, you do nothing at all when there is an open transaction.
now if you have a situation where it's friday night, a developer started a transaction in SSMS, ran something that is locking up some tables, and then went home without committing that offending transaction, you might want to do something.
1; if you were going to restore the database, so you have no problem kicking everyone out to do what you have to do,you can issue the command
ALTER DATABASE YourDataBase SET SINGLE_USER WITH ROLLBACK IMMEDIATE
2; if you want to just clear that one issue, and allow the rest of the users to continue, you want to run
exec sp_who2
/*
SPID Status Login HostName BlkBy DBName Command
57 SUSPENDED Stormdev\Lowell STORMDEV 56 SandBox SELECT
*/
your looking for any connections that are being blocked by open transactions...look for non-null values in the BlkBy column.
that is the specific spid that has the open transaction. in my example, you can see that spid [56]is blocking spid [57].
generally, you want to watch that for some period of time, by running the sp_who2 command multiple times.
you never want to kill a connection just because it is blocking someone...you need to make sure it's a real issue before you get the hammer out and treat every issue as if it were a nail.
if you are sure that the issue is real, you could then kill the connection for spid [56] which would automatically rollback that spids open transactions:
KILL 56
Lowell
March 15, 2011 at 5:50 am
Hi
Lowell, and All
It is what I was expecting From experts, thank you very much Lowell for a detail reply.
Ali
MCTS SQL Server2k8
March 15, 2011 at 9:58 pm
Ali Tailor (3/15/2011)
HiLowell, and All
It is what I was expecting From experts, thank you very much Lowell for a detail reply.
Ummm... they actually forgot to mention taking the offending user out for a nice pork chop dinner. 😛
--Jeff Moden
Change is inevitable... Change for the better is not.
March 15, 2011 at 11:49 pm
Jeff Moden (3/15/2011)
Ummm... they actually forgot to mention taking the offending user out for a nice pork chop dinner. 😛
Maybe, maybe not.
There's nothing intrinsically wrong with an open transaction. If it's open long enough to cause a problem, it could also be the developer who is to blame.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
March 17, 2011 at 7:29 am
I agree, as with all open transactions you should check to see what it is doing and if it is actually causing a blocking problem before deciding to kill it...
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply