Submit a ticketCall us

Solarwinds & Cisco Live! Barcelona
Join us from the 29th of January to the 2nd of February at Cisco Live 2018 in Barcelona, where we will continue to show how monitoring the network with SolarWinds will keep you ahead of the game. At our booth (WEP 1A), we will demonstrate how SolarWinds network solutions can help. As a bonus, we are also hosting a pre-event webinar - Blame the Network, Hybrid IT Edition with our SolarWinds Head Geek™, Patrick Hubbard on January 24th - GMT (UTC+0): 10:00 a.m. to 11:00 a.m. There's still time to RSVP.

Home > Success Center > Network Performance Monitor (NPM) > Get execution count of a Stored Procedure

Get execution count of a Stored Procedure

Table of contents
Created by Wendell Bazile, last modified by Aileen de Lara_ret on Sep 01, 2016

Views: 846 Votes: 0 Revisions: 3

Overview

Steps to get the Execution Count of a Stored Procedure.

Environment

All Orion Core products

Steps

Attach to the database via database manager or sql management studio and run the following query:

SELECT DB_NAME(st.dbid) DBName

      ,OBJECT_SCHEMA_NAME(st.objectid,dbid) SchemaName

      ,OBJECT_NAME(st.objectid,dbid) StoredProcedure

      ,max(cp.usecounts) Execution_count

 FROM sys.dm_exec_cached_plans cp

         CROSS APPLY sys.dm_exec_sql_text(cp.plan_handle) st

 where DB_NAME(st.dbid) is not null and cp.objtype = 'proc'

   group by cp.plan_handle, DB_NAME(st.dbid),

            OBJECT_SCHEMA_NAME(objectid,st.dbid),

   OBJECT_NAME(objectid,st.dbid)

 order by max(cp.usecounts)

 

 

 

 

Last modified

Tags

Classifications

Public