Showing posts with label sp_who2. Show all posts
Showing posts with label sp_who2. Show all posts

Sunday, March 11, 2012

Blocking issue

Dear Sir/Madam,
I have run the sp_who2, and found that a process is blocking others processes.
But after I checked the blocker process, it is a SELECT query, which suppose
wouldn't lock any pages/tables, am I right? So, what is happening?
Many thanks!
Yours sincerely,
Henry
SELECT query needs to get read locks in SQL Server unless you are in read
uncommitted isolation. Please read the "Understanding Locking in SQL Server"
section in the Books Online.
Wei Xiao
Microsoft SQL Server Storage Engine
This posting is provided "AS IS" with no warranties, and confers no rights.
"Henry" <Henry@.discussions.microsoft.com> wrote in message
news:3C18EC8B-1573-4BB3-8EB0-EFD74AAEB4D1@.microsoft.com...
> Dear Sir/Madam,
> I have run the sp_who2, and found that a process is blocking others
processes.
> But after I checked the blocker process, it is a SELECT query, which
suppose
> wouldn't lock any pages/tables, am I right? So, what is happening?
> Many thanks!
> Yours sincerely,
> Henry
|||To add more details, using the default settings for SQLServer, Select
statements get a short read lock. This lock lasts a very short time unless
the select is in a trasaction with Holdlock. In that case the read locks (
called shared locks) are held for the duration of the transaction. These
shared locks will prevent anyone from updating the rows.
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Henry" <Henry@.discussions.microsoft.com> wrote in message
news:3C18EC8B-1573-4BB3-8EB0-EFD74AAEB4D1@.microsoft.com...
> Dear Sir/Madam,
> I have run the sp_who2, and found that a process is blocking others
processes.
> But after I checked the blocker process, it is a SELECT query, which
suppose
> wouldn't lock any pages/tables, am I right? So, what is happening?
> Many thanks!
> Yours sincerely,
> Henry
|||Also, again with the defaults, is to check whether or not you have IMPLICIT
TRANSACTIONs on. If so, you do not need to explicitly specify a BEGIN
TRANSACTION statement to initiate one and one is usually initiated with most
statements, including READ operations.
Sincerely,
Anthony Thomas

"Henry" <Henry@.discussions.microsoft.com> wrote in message
news:3C18EC8B-1573-4BB3-8EB0-EFD74AAEB4D1@.microsoft.com...
Dear Sir/Madam,
I have run the sp_who2, and found that a process is blocking others
processes.
But after I checked the blocker process, it is a SELECT query, which suppose
wouldn't lock any pages/tables, am I right? So, what is happening?
Many thanks!
Yours sincerely,
Henry
|||It depends upon what transaction isolation level you are running under. The
transaction isolation level will determine what types of locks are issued
and how long the locks are held. If you are running under serializable, this
is what I would expect. See the BOL for the transaction isolation level
topics.
If these queries are being issued from an object managed by COM+, you may be
going down into the wormhole where all queries are issued under the
serializable transaction isolation level, regardless of what level you
specify in your query. Microsoft has several KB articles about this. It
depends upon how the object is written, whether transactions are used, ad
nauseum. I don't remember the exact rules off the top of my head, but it
essentially dumbs down everything so that you are assured of not hurting
yourself with concurrency issues.
"Henry" <Henry@.discussions.microsoft.com> wrote in message
news:3C18EC8B-1573-4BB3-8EB0-EFD74AAEB4D1@.microsoft.com...
> Dear Sir/Madam,
> I have run the sp_who2, and found that a process is blocking others
> processes.
> But after I checked the blocker process, it is a SELECT query, which
> suppose
> wouldn't lock any pages/tables, am I right? So, what is happening?
> Many thanks!
> Yours sincerely,
> Henry

Blocking issue

Dear Sir/Madam,
I have run the sp_who2, and found that a process is blocking others processes.
But after I checked the blocker process, it is a SELECT query, which suppose
wouldn't lock any pages/tables, am I right? So, what is happening?
Many thanks!
Yours sincerely,
Henry :)SELECT query needs to get read locks in SQL Server unless you are in read
uncommitted isolation. Please read the "Understanding Locking in SQL Server"
section in the Books Online.
--
Wei Xiao
Microsoft SQL Server Storage Engine
This posting is provided "AS IS" with no warranties, and confers no rights.
"Henry" <Henry@.discussions.microsoft.com> wrote in message
news:3C18EC8B-1573-4BB3-8EB0-EFD74AAEB4D1@.microsoft.com...
> Dear Sir/Madam,
> I have run the sp_who2, and found that a process is blocking others
processes.
> But after I checked the blocker process, it is a SELECT query, which
suppose
> wouldn't lock any pages/tables, am I right? So, what is happening?
> Many thanks!
> Yours sincerely,
> Henry :)|||To add more details, using the default settings for SQLServer, Select
statements get a short read lock. This lock lasts a very short time unless
the select is in a trasaction with Holdlock. In that case the read locks (
called shared locks) are held for the duration of the transaction. These
shared locks will prevent anyone from updating the rows.
--
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Henry" <Henry@.discussions.microsoft.com> wrote in message
news:3C18EC8B-1573-4BB3-8EB0-EFD74AAEB4D1@.microsoft.com...
> Dear Sir/Madam,
> I have run the sp_who2, and found that a process is blocking others
processes.
> But after I checked the blocker process, it is a SELECT query, which
suppose
> wouldn't lock any pages/tables, am I right? So, what is happening?
> Many thanks!
> Yours sincerely,
> Henry :)|||Also, again with the defaults, is to check whether or not you have IMPLICIT
TRANSACTIONs on. If so, you do not need to explicitly specify a BEGIN
TRANSACTION statement to initiate one and one is usually initiated with most
statements, including READ operations.
Sincerely,
Anthony Thomas
"Henry" <Henry@.discussions.microsoft.com> wrote in message
news:3C18EC8B-1573-4BB3-8EB0-EFD74AAEB4D1@.microsoft.com...
Dear Sir/Madam,
I have run the sp_who2, and found that a process is blocking others
processes.
But after I checked the blocker process, it is a SELECT query, which suppose
wouldn't lock any pages/tables, am I right? So, what is happening?
Many thanks!
Yours sincerely,
Henry :)|||It depends upon what transaction isolation level you are running under. The
transaction isolation level will determine what types of locks are issued
and how long the locks are held. If you are running under serializable, this
is what I would expect. See the BOL for the transaction isolation level
topics.
If these queries are being issued from an object managed by COM+, you may be
going down into the wormhole where all queries are issued under the
serializable transaction isolation level, regardless of what level you
specify in your query. Microsoft has several KB articles about this. It
depends upon how the object is written, whether transactions are used, ad
nauseum. I don't remember the exact rules off the top of my head, but it
essentially dumbs down everything so that you are assured of not hurting
yourself with concurrency issues.
"Henry" <Henry@.discussions.microsoft.com> wrote in message
news:3C18EC8B-1573-4BB3-8EB0-EFD74AAEB4D1@.microsoft.com...
> Dear Sir/Madam,
> I have run the sp_who2, and found that a process is blocking others
> processes.
> But after I checked the blocker process, it is a SELECT query, which
> suppose
> wouldn't lock any pages/tables, am I right? So, what is happening?
> Many thanks!
> Yours sincerely,
> Henry :)

Thursday, March 8, 2012

Blocking in Distribution Database

I noticed that the distribution agents are blocking themselves in the
distribution database.
It looks like this when i do a sp_who2 spid/blocked By:
80/Not blocked
80/80
80/80
80/80
80/80
Is this normal?
Probably not. Check to see what the process is doing which is doing the
blocking and being blocked. You may need to use DBCC inputbuffer(spid) to do
this. You will get locking when some of the replication agents are running,
and even EM will cause locking. It is also possible that if your server is
really under substaintial load the log reader and distribution agents will
lock themselves.
Hilary Cotter
Director of Text Mining and Database Strategy
RelevantNOISE.Com - Dedicated to mining blogs for business intelligence.
This posting is my own and doesn't necessarily represent RelevantNoise's
positions, strategies or opinions.
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"Jeff B" <JeffB@.discussions.microsoft.com> wrote in message
news:B25E48D1-6AC8-4D59-892C-AA7E92D7A95A@.microsoft.com...
>I noticed that the distribution agents are blocking themselves in the
> distribution database.
> It looks like this when i do a sp_who2 spid/blocked By:
> 80/Not blocked
> 80/80
> 80/80
> 80/80
> 80/80
> Is this normal?

blocking

Frequently when I run sp_who2, I see a spid blocked by itself. Why/How does
this happen? Is there anything I can do about it?
Thanks, Andre
Hi
New feature in SP4.
http://groups.google.com/group/micro...513ab281?hl=en
Regards
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"Andre" <no@.spam.com> wrote in message
news:eODlWin6FHA.2608@.tk2msftngp13.phx.gbl...
> Frequently when I run sp_who2, I see a spid blocked by itself. Why/How
> does
> this happen? Is there anything I can do about it?
> Thanks, Andre
>
|||Interesting - thank you.
Andre

Wednesday, March 7, 2012

blocking

Frequently when I run sp_who2, I see a spid blocked by itself. Why/How does
this happen? Is there anything I can do about it?
Thanks, AndreHi
New feature in SP4.
http://groups.google.com/group/micr...r />
281?hl=en
Regards
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"Andre" <no@.spam.com> wrote in message
news:eODlWin6FHA.2608@.tk2msftngp13.phx.gbl...
> Frequently when I run sp_who2, I see a spid blocked by itself. Why/How
> does
> this happen? Is there anything I can do about it?
> Thanks, Andre
>|||Interesting - thank you.
Andre

blocking

Frequently when I run sp_who2, I see a spid blocked by itself. Why/How does
this happen? Is there anything I can do about it?
Thanks, AndreHi
New feature in SP4.
http://groups.google.com/group/microsoft.public.sqlserver.server/msg/b86e343e513ab281?hl=en
Regards
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"Andre" <no@.spam.com> wrote in message
news:eODlWin6FHA.2608@.tk2msftngp13.phx.gbl...
> Frequently when I run sp_who2, I see a spid blocked by itself. Why/How
> does
> this happen? Is there anything I can do about it?
> Thanks, Andre
>|||Interesting - thank you.
Andre

Blocked sleeping active connections

Hi

We just installed SQL service pack 4. I am now finding that when doing a sp_who2 active, there are a lot of connections that are blocked by itself. The common factor is they all have a status of 'sleeping'. The strange thing is that even though it shows the connection is blocked, it is in fact not and will still return results. Below is a snapshot of a portion of what the sp_who2 active returns:

SPID Status Login HostName BlkBy DBName
53 sleeping sa TRACKER 53 dbABC
58 sleeping sa TRACKER 58 dbCDE
64 sleeping sa TRACKER 64 dbSTA
66 RUNNABLE User12 PC24 . master
70 sleeping User5 ANALYSIS 70 dbBML
74 sleeping sa TRACKER 74 dbCDE
76 sleeping sa TRACKER 76 dbPTS
83 sleeping User5 ANALYSIS 83 dbANA
86 DORMANT User11 CPTDB . NULL

Has anyone seen this? Is it related to the installation of service pack 4? (We have installed the services pack on many other SQL servers, but have not come accross this before.

Tx,
TessZAThe "self-blocking spid" is a new feature of SP4. In short, it is not actual blocking. If a spid is waiting on a latch, it shows as blocking itself. I have not seen it on this scale, though. Do you happen to know if you are suffering a lot of disk activity around the times that a lot of self-blocking spids are showing up?