?
Solved

SQL sys.sysprocesses

Posted on 2012-03-28
3
Medium Priority
?
446 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 40

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 40

Accepted Solution

by:
lcohan earned 1500 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

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Audit has been really one of the more interesting, most useful, yet difficult to maintain topics in the history of SQL Server. In earlier versions of SQL people had very few options for auditing in SQL Server. It typically meant using SQL Trace …
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

777 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