Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7541375
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T07:52:32+00:00 2026-05-30T07:52:32+00:00

I’m looking at sp_who2 and it appears as though all processes are in a

  • 0

I’m looking at sp_who2 and it appears as though all processes are in a sleep mode and our website is extremely slow. I was wandering if sp_who2 looks at only the current database, or is it looking at another database can be causing the problem and sp_who2 only looks at the current database.

Also is there a way to detect if a sql process is running at a higher priority and blocking other processes. When I ran sp_who2 we had several processes that are normally in a runnable state, but they were all in a sleeping state and I was trying to figure out what was blocking them. It would nice to detect if a process was blocking other sql processes out.

There is also a BlkBy column where we set to the same process ID of 77 which I think means block all other processes but am not sure. Does anyone know what BlkBy means?

I placed asterics ** ** around what I think is the culprit. Is there a way to change priority or blocking so it no longer blocks. thx

SPID    Status                          Login       HostName        BlkBy   DBName  Command CPUTime DiskIO  LastBatch   ProgramName SPID
76      sleeping                        db\uname    UNAME             .     db  AWAITING COMMAND    0   0   02/24 09:15:54  srv / db                                        76   
77      sleeping                        db\uname    UNAME             .     db  SELECT              705422  0   02/24 09:25:49  srv / db                                        77   
77      sleeping                        db\uname    UNAME             .     db  SELECT              16  0   02/24 09:25:49  srv / db                                        77   
77      sleeping                        db\uname    UNAME           **77**      db  SELECT              32  0   02/24 09:25:49  srv / db                                        77   
77      sleeping                        db\uname    UNAME           **77**      db  SELECT              31  0   02/24 09:25:49  srv / db                                        77   
77      sleeping                        db\uname    UNAME             .     db  SELECT              16  0   02/24 09:25:49  srv / db                                        77   

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T07:52:34+00:00Added an answer on May 30, 2026 at 7:52 am

    sp_who2 showl the entire server’s connections if you not specified spid explicitly

    For locks see

    exec sp_locks
    

    To see in details who blocks who:

    set nocount on
    
    create table #t_sql (EventType text, Parameters int,EventInfo text, spid smallint default(0))
    declare @qs_blocking_list table (
        spid int,
        blocked int,
        loginame sysname,
        nt_username sysname,
        lastwaittype sysname,
        waitresource sysname,
        status sysname,
        waittime bigint,
        program_name sysname,
        cmd sysname,
        cpu bigint,
        physical_io bigint,
        hostname sysname,
        dbid int
    )   
        insert into @qs_blocking_list (
            spid ,
            blocked ,
            loginame, 
            nt_username ,
            lastwaittype ,
            waitresource ,
            status ,
            waittime ,
            program_name ,
            cmd ,
            cpu ,
            physical_io ,
            hostname ,
            dbid 
        )
        select  
            spid ,
            blocked ,
            loginame, 
            nt_username ,
            lastwaittype ,
            waitresource ,
            status ,
            waittime ,
            program_name ,
            cmd ,
            cpu ,
            physical_io ,
            hostname ,
            dbid 
        from master.dbo.sysprocesses
    delete from @qs_blocking_list
    where not ( blocked <> 0 or (spid in (select blocked from @qs_blocking_list)) )
    declare @spid   smallint
    declare @sql    nvarchar(255)
    set @spid = 0
    while 1=1
    begin
        select @spid = min(spid) from @qs_blocking_list where @spid<spid
        if @spid is null
            break 
        set @sql = 'dbcc inputbuffer ('+convert(nvarchar(20),@spid)+')'
        insert into #t_sql (EventType, Parameters, EventInfo)
        exec (@sql)
        update #t_sql set spid = @spid where spid = 0
    end
    set nocount off
    select  b.spid              as 'spid'
        ,   blocked             as 'BlockedBySPID'
        ,   rtrim(loginame)     as 'SQLUser'
        ,   rtrim(nt_username)  as 'NTUser'
        ,   rtrim(lastwaittype) as 'Type'
        ,   rtrim(waitresource) as 'Resource'
        ,   rtrim(status) + 
                case when blocked > 0 then ' and blocked' else '' end +
                case when b.spid in (select blocked from @qs_blocking_list) then ' and blocking' else '' end as 'Status'
        ,   waittime            as 'WaitTimeMS'
        ,   rtrim(program_name) as 'Program'
        ,   rtrim(cmd)          as 'Command'
        ,   cpu                 as 'CPU'
        ,   physical_io         as 'PhysicalIO'
        ,   rtrim(hostname)     as 'HostName'
        ,   case
                when dbid = 0 then ''
            else
                db_name(dbid)       
            end                 as 'DBName'
        ,   isnull(sql.EventInfo,'/* SQL Text not available */')    as 'sql_text'
    from @qs_blocking_list b
    left outer join #t_sql sql on b.spid = sql.spid
    
    drop table #t_sql
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I used javascript for loading a picture on my website depending on which small
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I have a text area in my form which accepts all possible characters from
I would like to count the length of a string with PHP. The string

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.