Solved

SQL sys.sysprocesses

Posted on 2012-03-28
3
431 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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Long way back, we had to take help from third party tools in order to encrypt and decrypt data.  Gradually Microsoft understood the need for this feature and started to implement it by building functionality into SQL Server. Finally, with SQL 2008, …
Hi all, It is important and often overlooked to understand “Database properties”. Often we see questions about "log files" or "where is the database" and one of the easiest ways to get general information about your database is to use “Database p…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

839 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