How to enable SQL Statement tracing in SQL Server?
3 years ago
Originally Published: 2008-02-15
Article Number
000061875
Applies To
RSA Key Manager Server
Issue
How to enable SQL Statement tracing in SQL Server?
SQL Server statement tracing
Resolution

For RSA Key Manager 2.0.x

If you need to look at the SQL statements generated by Key Manager Server, use SQL Server Profiler.

Start Microsoft SQL Server SQL Profiler
Create a new trace
Click on the "Event Selection" tab
Check "Show all columns"
Select the event "Stored procedure -> RPC:Completed" and select only the columns "TextData", "DatabaseName" and "StartTime".
Click on "Column filters"
Select "DatabaseName"
Expand 'Like' and type (with no quote)
   "kmsDataStore" for 2.0.x Key Manager Server
   "RKM" for 2.1.x Key Manager Server
Select "TextData"
Expand 'Like' and type (with no quote)
   "declare%"
Click Ok
Click Run

Now all requests to the database will be logged. Use the pause and clear buttons to manage the trace.

If you have to view only GetKeyByID requests, use the following TextData Filter if you are using RKM Server 2.0.x:
  declare%FROM CryptoKeys, Ciphers, KeyClass, ApplicationGroup WHERE CryptoKeys.keyClass = @P0  AND CryptoKeys.keyID = @P1%


For RSA Key Manager 2.7

Start Microsoft SQL Server SQL Profiler
Create a new trace
Click on the "Event Selection" tab
Check "Show all columns"
Select the event "Stored procedure -> RPC:Completed" and select only the columns "TextData", "DatabaseName" and "SPID".
Click on "Column filters"
Select "DatabaseName"
Expand 'Like' and type (with no quote)
   "RKM"
Select "TextData"
Expand 'Like' and type (with no quote)
   "declare%"
Click Ok
Click Run