Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Most frequent used stored procedures without access to system tables Expand / Collapse
Author
Message
Posted Sunday, November 10, 2013 6:02 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Wednesday, May 7, 2014 6:28 AM
Points: 52, Visits: 156
Is there a way to determine the most frequently used stored procedures in a given database if you do not have access to system tables? In all of the searches I have done the solution uses the system tables. Unfortunately, I do not have access to those. Thank you
Post #1512960
Posted Sunday, November 10, 2013 8:25 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Thursday, September 18, 2014 7:50 PM
Points: 5,322, Visits: 25,235
From:

http://glennberrysqlperformance.spaces.live.com/default.aspx

Try this

SELECT TOP 100 qt.text AS 'SP Name', qs.execution_count AS 'Execution Count',
qs.execution_count/DATEDIFF(Second, qs.creation_time, GetDate()) AS 'Calls/Second',
qs.total_worker_time/qs.execution_count AS 'AvgWorkerTime',
qs.total_worker_time AS 'TotalWorkerTime',
qs.total_elapsed_time/qs.execution_count AS 'AvgElapsedTime',
qs.max_logical_reads, qs.max_logical_writes, qs.total_physical_reads,
DATEDIFF(Minute, qs.creation_time, GetDate()) AS 'Age in Cache'
FROM sys.dm_exec_query_stats AS qs
CROSS APPLY sys.dm_exec_sql_text(qs.sql_handle) AS qt
WHERE qt.dbid = db_id() -- Filter by current database
ORDER BY qs.execution_count DESC


If everything seems to be going well, you have obviously overlooked something.

Ron

Please help us, help you -before posting a question please read

Before posting a performance problem please read
Post #1512964
Posted Sunday, November 10, 2013 8:52 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Wednesday, May 7, 2014 6:28 AM
Points: 52, Visits: 156
Ron - thank you for replying so soon. However, because I do not have access to the system tables the query does not work for me. Here is the error message I receive when I try to run it.

Msg 297, Level 16, State 1, Line 1
The user does not have permission to perform this action.

Is there a way around not using system tables? Thank you
Post #1512967
Posted Sunday, November 10, 2013 12:19 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 7:36 AM
Points: 35,218, Visits: 31,677
bhutchin (11/10/2013)
Ron - thank you for replying so soon. However, because I do not have access to the system tables the query does not work for me. Here is the error message I receive when I try to run it.

Msg 297, Level 16, State 1, Line 1
The user does not have permission to perform this action.

Is there a way around not using system tables? Thank you


Yes there is. If you've been tasked with doing such a thing, you well know that it's near impossible to do without the correct privs. You need to petition for and get the right privs to do this or have the DBAs do this for you.

The alternative is to get each stored proc to do it's own logging. With a little imagination and forethough, that's not as difficult to do as you might think.


--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #1512980
Posted Monday, November 11, 2013 12:02 AM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 2:25 PM
Points: 39,910, Visits: 36,250
Jeff Moden (11/10/2013)
The alternative is to get each stored proc to do it's own logging. With a little imagination and forethough, that's not as difficult to do as you might think.


This. It'll be more reliable than using the DMVs too.



Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #1513008
Posted Monday, November 11, 2013 6:08 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Wednesday, May 7, 2014 6:28 AM
Points: 52, Visits: 156
Thank you all very much for your replies. You have confirmed for me what I had suspected. I need to have the privileges to the system tables if I am the one that is to find the data. We can consider this topic asked and answered.
Post #1513109
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse