|
Author : James F. Koopmann More at : www.jameskoopmann.com
|
· In Part I we learned how to set the CLIENT_IDENTIFIER session variable to more accurately pinpoint resource consumption for an individual user or group of users.
· In Part II we learned how to set the ACTION and MODULE name so that we could track where in our code transactions where being executed and track the use of resources by transaction type or section of code.
· In Part III we focused on enabling tracing of statistics through the DBMS_MONITOR package.
· Now in part IV of this series we will take a look at the internal views within Oracle that keep track of the enabled statistics gathering enabled in Part III.
In Part III we left off displaying the enabled traces and statistic gatherings we enabled through the DBMS_MONITOR package. Recall that in Part III we queried the DBA_ENABLED_AGGREGATIONS view and had a listing such as in Listing 1. Table 1 gives a breakdown of the DBA_ENABLED_AGGREGATIONS view as I have renamed some of the columns for Listing 1.
DBA_ENABLED_AGGREGATIONS
SQL> SELECT * FROM DBA_ENABLED_AGGREGATIONS ;
AGGREGATION SERVICE MODULE ACTION
-------------------- -------------------- -------------------- --------------------
CLIENT_ID webclient
SERVICE_MODULE ACCT PAYROLL
DBA_ENABLED_AGGREGATIONS
|
Column |
Description |
|
|
This is the type of statistical aggregation being done. This relates to the actual procedure called in the DBMS_MONITOR package. In Listing 1 I we have called the CLIENT_ID_STAT_ENABLE and SERV_MOD_ACT_STAT_ENABLE procedures |
|
|
This is the CLIENT_IDENTIFIER or SERVICE_NAME in the call |
|
|
The module name |
|
|
The action name |
In the last three parts of this series we have also zeroed in on setting different session environment variables. Those variables were CLIENT_IDENTIFIER, ACTION, and MODULE. We have also tracked some of the sessions by SID, SESSION_ID, SERVICE_NAME, and SERIAL#. I thought it might be interesting to take a look at where within Oracle’s internal views these columns might be defined as this could help us in our future needs of investigation. Instead of searching through the endless documentation of Oracle, I instead decided to produce a query (Listing 2) in which I queried the DBA_TAB_COLUMNS view to take a look at what internal Oracle views or objects have these columns in common. I can then from the output take a look at the definitions of those named objects that intrigue me. Listing 2 is only a partial listing and I encourage you to execute the query and see the total output. That way if you are ever interested in searching for a singe column or combination of columns you will know where within the Oracle internal views this information is stored. Do not take this output too lightly. If you remember that we were enabling statistics gathering and tracing in the previous parts to this article for combinations of these columns, you can quickly see where in this listing the information is kept and where aggregates on columns are stored. Be also warned that most of the output you will see are for Oracle’s workload repository, advisories, and snapshots mechanisms and are not of any real use unless you are using those utilities. For us I have only left the objects we will be concerned with for looking at the gathered statistics we have enabled. Table 2 gives a brief explanation of these views, how you might use them, and some things to look out for.
Query to investigate Oracle Views that contain our statistical information
select table_name
,sum(decode(column_name,'SID',1,'SESSION_ID',1,0)) SID
,sum(decode(column_name,'CLIENT_ID',1,'CLIENT_IDENTIFIER',1,0)) CLIENT_ID
,sum(decode(column_name,'SERVICE_NAME',1,0)) SERVICE_NAME
,sum(decode(column_name,'ACTION',1,0)) ACTION
,sum(decode(column_name,'MODULE',1,0)) MODULE
,sum(decode(column_name,'SERIAL#',1,0)) SERIAL#
from (select owner,table_name,column_name
from dba_tab_columns
where owner = 'SYS'
and column_name in ('SID', 'SESSION_ID',
'CLIENT_ID', 'CLIENT_IDENTIFIER',
'SERVICE_NAME', 'ACTION', 'MODULE', 'SERIAL#'))
group by table_name
/
CLIENT SERVICE
TABLE_NAME SID ID NAME ACTION MODULE SERIAL#
------------------------------ --- ------ ------- ------ ------ -------
DBA_HIST_ACTIVE_SESS_HISTORY 1 1 0 1 1 0
V_$ACTIVE_SESSION_HISTORY 1 1 0 1 1 0
V_$CLIENT_STATS 0 1 0 0 0 0
V_$SERVICE_STATS 0 0 1 0 0 0
V_$SERV_MOD_ACT_STATS 0 0 1 1 1 0
|
Table |
Description |
|
V_$ACTIVE_SESSION_HISTORY |
·
· Use this view in conjunction with setting the CLIENT_IDENTIFIER, ACTION, and MODULE to aggregate (GROUP BY) and find the largest consumers of resources within your system. · Take a look at another article I wrote entitled “True Session Wait Activity in Oracle 10g” for how to use this view. This article is at http://www.databasejournal.com/features/oracle/article.php/3388861 |
|
DBA_HIST_ACTIVE_SESS_HISTORY |
·
|
|
V_$CLIENT_STATS
|
·
|
|
V_$SERVICE_STATS |
·
|
|
V_$SERV_MOD_ACT_STATS |
|
The use of these views is quite straight forward. You need only query them for the statistical aggregation you have set up through the DBMS_MONITOR package. The real difficulty lies in setting up those aggregations stepped through in earlier Parts of this series. Next time we will get into the new reporting options available for traces in Oracle 10g.