Solved

SQL sys.sysprocesses

Posted on 2012-03-28
3
414 Views
Last Modified: 2013-02-15
Hello
We have a process to monitoring the access to database.
Why exist processes without query command (sys.dm_exec_sql_text) that sql_handle value of the sys.sysprocesses is 0x000000000000000000000000000000000000000000000000 ?
What types of access are?
0
Comment
Question by:Jaimesastre
  • 2
3 Comments
 
LVL 39

Expert Comment

by:lcohan
ID: 37778936
That is the query handle like:


sql_handle
 

binary(20)
 

Represents the currently executing batch or object.

Note   This value is derived from the batch or memory address of the object. This value is not calculated by using the SQL Server hash-based algorithm.
 
http://msdn.microsoft.com/en-us/library/ms179881.aspx

You need a cross apply to find the actual statement if that's what you need.
0
 

Author Comment

by:Jaimesastre
ID: 37780676
Thanks.

We need know in real time all runing  process in the sql server with the query sys.sysprocesses.

We can know what is the query or process description of the row with SQL_Handle value 0x000000000000000000000000000000000000000000000000.

Is possible know it?

Regards
0
 
LVL 39

Accepted Solution

by:
lcohan earned 500 total points
ID: 37806340
You need to run a query like below to get all details and you could include a where clause as well:



SELECT
      BatchText            = SQLText.text ,
      BatchPlan            = QueryPlan.query_plan ,
      ExecutionCount      = CachedPlans.usecounts ,
      ObjectType            = CachedPlans.objtype ,
      Size_KB                  = CachedPlans.size_in_bytes / 1024
FROM
      sys.dm_exec_cached_plans AS CachedPlans
CROSS APPLY
      sys.dm_exec_query_plan (CachedPlans.plan_handle) AS QueryPlan
CROSS APPLY
      sys.dm_exec_sql_text (CachedPlans.plan_handle) AS SQLText
--WHERE ....
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

After restoring a Microsoft SQL Server database (.bak) from backup or attaching .mdf file, you may run into "Error '15023' User or role already exists in the current database" when you use the "User Mapping" SQL Management Studio functionality to al…
How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now