bin/XEtemplates/Profiler TSQL Locks.xml

<event_sessions xmlns="http://schemas.microsoft.com/sqlserver/2008/07/extendedeventconfig">
  <event_session name="Profiler TSQL Locks" maxMemory="4" eventRetentionMode="allowSingleEventLoss" trackCausality="true" dispatchLatency="30" maxEventSize="0" memoryPartitionMode="none">
    <templateCategory>
      <!-- _locID_text="templateCategory" _locComment = "" -->Profiler Equivalents</templateCategory>
    <templateName>
      <!-- _locID_text = "templateName" _locComment = "" -->Profiler TSQL Locks</templateName>
    <templateDescription>
      <!-- _locID_text = "templateDescription" _locComment = "" -->Matches the 'TSQL_Locks' template in Profiler. Captures all of the Transact-SQL statements that are submitted to SQL Server by clients along with exceptional lock events. Use to troubleshoot deadlocks, lock time-out, and lock escalation events. </templateDescription>
    <event package="sqlserver" name="blocked_process_report">
      <action package="sqlserver" name="session_id" />
    </event>
    <event package="sqlserver" name="lock_cancel">
      <action package="sqlserver" name="client_app_name" />
      <action package="sqlserver" name="client_pid" />
      <action package="sqlserver" name="database_name" />
      <action package="sqlserver" name="nt_username" />
      <action package="sqlserver" name="server_principal_name" />
      <action package="sqlserver" name="session_id" />
    </event>
    <event package="sqlserver" name="lock_deadlock">
      <action package="sqlserver" name="client_app_name" />
      <action package="sqlserver" name="client_pid" />
      <action package="sqlserver" name="database_name" />
      <action package="sqlserver" name="nt_username" />
      <action package="sqlserver" name="server_principal_name" />
      <action package="sqlserver" name="session_id" />
    </event>
    <event package="sqlserver" name="lock_deadlock_chain">
      <action package="sqlserver" name="database_name" />
      <action package="sqlserver" name="session_id" />
    </event>
    <event package="sqlserver" name="lock_escalation">
      <action package="sqlserver" name="client_app_name" />
      <action package="sqlserver" name="client_pid" />
      <action package="sqlserver" name="database_name" />
      <action package="sqlserver" name="nt_username" />
      <action package="sqlserver" name="server_principal_name" />
      <action package="sqlserver" name="session_id" />
    </event>
    <event package="sqlserver" name="lock_timeout_greater_than_0">
      <action package="sqlserver" name="client_app_name" />
      <action package="sqlserver" name="client_pid" />
      <action package="sqlserver" name="database_name" />
      <action package="sqlserver" name="nt_username" />
      <action package="sqlserver" name="server_principal_name" />
      <action package="sqlserver" name="session_id" />
    </event>
    <event package="sqlserver" name="sp_statement_completed">
      <action package="sqlserver" name="client_app_name" />
      <action package="sqlserver" name="client_pid" />
      <action package="sqlserver" name="database_name" />
      <action package="sqlserver" name="nt_username" />
      <action package="sqlserver" name="server_principal_name" />
      <action package="sqlserver" name="session_id" />
      <parameter name="collect_statement" value="1" />
      <predicate>
        <and>
          <leaf>
            <comparator name="greater_than_uint64" package="package0"></comparator>
            <global name="database_id" package="sqlserver"></global>
            <value>4</value>
          </leaf>
          <leaf>
            <comparator name="equal_boolean" package="package0"></comparator>
            <global name="is_system" package="sqlserver"></global>
            <value>false</value>
          </leaf>
        </and>
      </predicate>
    </event>
    <event package="sqlserver" name="sp_statement_starting">
      <action package="sqlserver" name="client_app_name" />
      <action package="sqlserver" name="client_pid" />
      <action package="sqlserver" name="database_name" />
      <action package="sqlserver" name="nt_username" />
      <action package="sqlserver" name="server_principal_name" />
      <action package="sqlserver" name="session_id" />
      <parameter name="collect_statement" value="1" />
      <predicate>
        <and>
          <leaf>
            <comparator name="greater_than_uint64" package="package0"></comparator>
            <global name="database_id" package="sqlserver"></global>
            <value>4</value>
          </leaf>
          <leaf>
            <comparator name="equal_boolean" package="package0"></comparator>
            <global name="is_system" package="sqlserver"></global>
            <value>false</value>
          </leaf>
        </and>
      </predicate>
    </event>
    <event package="sqlserver" name="sql_statement_completed">
      <action package="sqlserver" name="client_app_name" />
      <action package="sqlserver" name="client_pid" />
      <action package="sqlserver" name="database_name" />
      <action package="sqlserver" name="nt_username" />
      <action package="sqlserver" name="server_principal_name" />
      <action package="sqlserver" name="session_id" />
      <predicate>
        <and>
          <leaf>
            <comparator name="greater_than_uint64" package="package0"></comparator>
            <global name="database_id" package="sqlserver"></global>
            <value>4</value>
          </leaf>
          <leaf>
            <comparator name="equal_boolean" package="package0"></comparator>
            <global name="is_system" package="sqlserver"></global>
            <value>false</value>
          </leaf>
        </and>
      </predicate>
    </event>
    <event package="sqlserver" name="sql_statement_starting">
      <action package="sqlserver" name="client_app_name" />
      <action package="sqlserver" name="database_id" />
      <action package="sqlserver" name="query_hash" />
      <action package="sqlserver" name="query_plan_hash" />
      <action package="sqlserver" name="session_id" />
      <predicate>
        <and>
          <and>
            <leaf>
              <comparator name="divides_by_uint64" package="package0"></comparator>
              <global name="session_id" package="sqlserver"></global>
              <value>5</value>
            </leaf>
            <leaf>
              <comparator name="greater_than_uint64" package="package0"></comparator>
              <global name="database_id" package="sqlserver"></global>
              <value>4</value>
            </leaf>
          </and>
          <leaf>
            <comparator name="equal_boolean" package="package0"></comparator>
            <global name="is_system" package="sqlserver"></global>
            <value>false</value>
          </leaf>
        </and>
      </predicate>
    </event>
    <event package="sqlserver" name="xml_deadlock_report">
      <action package="sqlserver" name="server_principal_name" />
      <action package="sqlserver" name="session_id" />
    </event>
  </event_session>
</event_sessions>