Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
SQL Server 2005
»
Administering
»
sp_who2 - sp_lock
sp_who2 - sp_lock
Rate Topic
Display Mode
Topic Options
Author
Message
curious_sqldba
curious_sqldba
Posted Thursday, February 05, 2009 8:04 AM
Ten Centuries
Group: General Forum Members
Last Login: Wednesday, May 22, 2013 4:13 PM
Points: 1,172,
Visits: 2,687
Hello,
i read this so many times but keep getting confused between blocking and locking..now when i run sp_who2 i see some process id in the "blk" column...now does it mean that the process id in "blk" column is being locked?..when i run sp_lock..i see some information on the resources..from my understanding locks have to occur on resources..but when more than one lock occurs on the same resource then it is called block....there are tons of ways to find the block..but can anyone give me the most effecient way..this is how i plan to approach for determing blocks..
i)run sp_who2
ii)then run dashboard reports for locks( will this give which query is creating lock?)
i do not want to use profiler....suggestions will be appreciated..thansk..
Post #650894
Jack Corbett
Jack Corbett
Posted Thursday, February 05, 2009 8:22 AM
SSChampion
Group: General Forum Members
Last Login: Friday, May 17, 2013 12:22 PM
Points: 10,571,
Visits: 11,871
A block occurs when a resource has been locked by an process and another process with an incompatible lock type attempt to acquire a lock on the same resource.
Here
is the BOL article that has a the Lock Compatability Matrix.
This
article
includes code (near the bottom) that will show blocks using the DMV's which are the recommended way to find locking\blocking issues in 2005 and newer.
Jack Corbett
Applications Developer
Don't let the good be the enemy of the best. --
Paul Fleming
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
How to Post Performance Problems
Crosstabs and Pivots or How to turn rows into columns Part 1
Crosstabs and Pivots or How to turn rows into columns Part 2
Post #650921
jagadishrashmi
jagadishrashmi
Posted Thursday, February 05, 2009 8:26 AM
SSC-Enthusiastic
Group: General Forum Members
Last Login: Friday, November 11, 2011 12:01 PM
Points: 158,
Visits: 55
sp_who2 returns
SPID --> which is the process under consideration
BLK --> if it has a value represents the SPID of the blocking process
Ex. SPID =10 BLK=51 --> Process 10 is being blocked by process 51
sp_lock return all process request or in lock states unless the status is grant state.
-- Returns information about currently active lock manager resources.
select * from sys.dm_tran_locks
----
Live and Let Live!
----
Post #650926
curious_sqldba
curious_sqldba
Posted Friday, February 06, 2009 9:14 AM
Ten Centuries
Group: General Forum Members
Last Login: Wednesday, May 22, 2013 4:13 PM
Points: 1,172,
Visits: 2,687
thanks...it helps..
Post #651782
njeschel08
njeschel08
Posted Wednesday, September 05, 2012 2:29 PM
Forum Newbie
Group: General Forum Members
Last Login: Tuesday, October 23, 2012 9:11 AM
Points: 1,
Visits: 5
Very helpful with the procedure posted and explaining blk. Thanks!
Post #1354891
« Prev Topic
|
Next Topic »
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.