Friday, August 19, 2011

OMS Grid Console - Exploring using SQL

The Grid Console hosts a repository of data collected from all the monitored databases and hosts. It has wealth of information and few of the areas are covered here. To explore this, logon to the OMS 10g Grid Console database 
  • To Find the Init Parameters for a monitored database use the following SQL
select host_name,  target_name, collection_timestamp,
             name, isdefault, value, datatype
      from   sysman.MGMT$DB_INIT_PARAMS 
      where  target_name like 'yourdbname%';
  • To find the number of data files configured and the actual number of data files for the monitored database.
	select a.target_name, db1.db_name, db2.db_files "Configured DB Files", count(*) "Actual # of Datafiles"
	from   MGMT$DB_DATAFILES a, ( select value db_name, target_name
	                               from  sysman.mgmt$db_init_params a1
	                               where a1.name        = 'db_name') db1 ,
	                            ( select value db_files, target_name
	                               from  sysman.mgmt$db_init_params a1
	                               where a1.name        = 'db_files') db2
	where  a.target_name = db1.target_name
	and    a.target_name = db2.target_name
	group by  a.target_name, db1.db_name, db2.db_files
	order by 4 desc;
  • To find the characterset used across all the monitored database
select * from sysman.MGMT$TARGET_PROPERTIES
      where  property_name = 'ConvertFromCharset';

      --  MGMT$TARGET_PROPERTIES corresponds to database_properties view
  • To find the SGA parameters for a monitored database use the following SQL
select host_name, target_name, collection_timestamp, sganame, sgasize
      from   sysman.mgmt$db_sga
      where  target_name like 'yourdbname%';
  • To find outstanding Alerts for a monitored database
	select t.type_display_name, t.target_name, t.host_name, m.metric_name, m.metric_column,
	       m.column_label, m.key_value, m.collection_timestamp,
	       m.message, m.alert_state
	from sysman.MGMT$ALERT_CURRENT m, sysman.mgmt$target  t
	where  t.target_guid = m.target_guid
	and   t.target_name like 'yourdbname%'
	order by  m.collection_timestamp desc;
  • To find out the Target up and down status
	select t.target_name, m.start_timestamp,
	       m.end_timestamp, m.availability_status
	from   sysman.MGMT$AVAILABILITY_HISTORY m, sysman.mgmt$target  t
	where  t.target_guid = m.target_guid
	and    t.target_name like 'yourdbname%'
	order by start_timestamp desc;
  • Other useful information from Grid
MGMT$OS_SUMMARY    - to find the OS patch, swap and version
      -- Issue this query to see several other tables that holds useful info and you can query against it to see what you get.
         select * 
         from   dba_objects 
         where  objecT_name like 'MGMT%' 
         and    owner = 'SYSMAN' 
         and    object_type in ('TABLE', 'VIEW');
  • To find out the Interconnect network details
select * 
     from sysman.MGMT$CLUSTER_INTERCONNECTS 
     where host_name = 'your agent host name fqdn';
  • Detailed Interconnect Traffic for RAC Instances (Past 7 Days)
select m.target_name, m.metric_name, m.metric_column, m.collection_timestamp,
             m.value*1024 "Traffic KB/s", m.key_value
      from   mgmt$metric_details m,
             mgmt$target t
      where  (t.target_type='rac_database' OR
             (t.target_type='oracle_database' AND t.TYPE_QUALIFIER3 = 'RACINST'))
      and     m.metric_column='interconnect_rate'
      and     m.target_guid  = t.target_guid
      and     m.collection_timestamp >= sysdate -7
      and     m.target_name like 'yourdbname%';
  • Historical Interconnet Traffic for RAC instances (Average, Min, Max)
	select m.target_name, m.metric_name, m.metric_column, m.rollup_timestamp,
	       round(m.average*1024,2) "Average Traffic KB/s",
	       round(m.minimum*1024,2) "Minimum Traffic KB/s",
	       round(m.maximum*1024,2) "Maximum Traffic KB/s"
	from   mgmt$metric_daily m,
	       mgmt$target t
	where  (t.target_type='rac_database' OR
	       (t.target_type='oracle_database' AND t.TYPE_QUALIFIER3 = 'RACINST'))
	and     m.metric_column='interconnect_rate'
	and     m.target_guid  = t.target_guid
	and     m.rollup_timestamp >= sysdate - 60
	and     m.target_name like 'yourdbname%';

The Grid Console stores bulk of its collected metrics in the following tables
MGMT$METRIC_DETAILS   -  Stores details upto 7 days
  MGMT$METRIC_CURRENT   -  Stores the current metrics from the past 24 hours
  MGMT$METRIC_HOURLY    -  Stores details upto 30 days in a hourly snapshot with AVG, MIN and MAX values.
  MGMT$METRIC_DAILY     -  Stores the metrics in a daily snapshot format with AVG, MIN and MAX values.

The following are the details captured in the metrics tables and you can use the above query appropriately as needed by replacing the metric_column WHERE clause.
1. Interconnect Traffic for RAC (metric_column = 'interconnect_rate')
   2. Archive Space Usage ( metric_column = 'archTotal' for Total Archive Space, metric_column = 'archUsed' for actual used space + 
                            metric_name='archFull')
   3. Tablespace Usage    ( metric_column = 'spaceAllocated', 'spaceUsed' +  metric_name='tbspAllocation')

This table covers the other metrics you can use for current and historical analysis.
COLUMN_LABEL METRIC_NAME METRIC_COLUMN
Number of Capture Processesstreams_processes_countCAPTURE_COUNT
Tablespace Allocated Space (MB)tbspAllocationspaceAllocated
Physical Writes Direct (per transaction)instance_throughputphyswritesdir_pt
Global Cache Blocks Corruptrac_global_cachecorrupt
Enqueue Deadlocks (per second)instance_throughputenqdeadlocks_ps
Physical Reads Direct Lobs (per transaction)instance_throughputphysreadslob_pt
Physical Writes Direct (per second)instance_throughputphyswritesdir_ps
Archive Area Used (KB)archFullarchUsed
Cursor Cache Hit (%)instance_efficiencycursorcachehit_pct
Redo Log Allocation Hit (%)instance_efficiencyredologalloc_hit_pct
Database CPU Time (%)instance_efficiencycpu_time_pct
Physical Reads Direct (per transaction)instance_throughputphysreadsdir_pt
User Limit Usage (%)Database_Resource_Usageuser_limit
Library Cache Miss (%)instance_efficiencylibcache_miss_pct
Physical Writes Direct Lobs (per transaction)instance_throughputphyswriteslob_pt
User Rollbacks (per transaction)instance_throughputrollbacks_pt
Total Archive Area (KB)archFullarchTotal
Physical Writes Direct Lobs (per second)instance_throughputphyswriteslob_ps
User Commits (per transaction)instance_throughputcommits_pt
Row Cache Miss Ratio (%)instance_efficiencydictionarymiss_pct
Parallel Execution Downgraded to Serial (per second)instance_efficiencypxdwngrdserial_ps
Data Block Corruption Alert Log ErroralertLogblockCorruptErrStack
Number of Propagation Jobsstreams_processes_countPROP_COUNT
Usable Flash Recovery Area (%)ha_flashrecoveryusable_area
Media Failure Alert Log Error StatusalertLogStatusmediaFailureErrors
PGA Cache Hit (%)instance_efficiencypgacachehit_pct
Enqueue Timeout (per transaction)instance_throughputenqtimeouts_pt
Parallel Execution Downgraded to Serial (per transaction)instance_efficiencypxdwngrdserial_pt
Service Response Time (per user call) (microseconds)serviceelapsed_cs
Session Limit Usage (%)Database_Resource_Usagesession_usage
Response Time (per transaction)instance_efficiencyresponse_time_pt
Total Index Scans (per second)instance_throughputindxscanstotal_ps
Session Logical Reads (per transaction)instance_throughputlogreads_pt
User Calls (%)instance_throughputusercall_pct
Database Block Changes (per second)instance_throughputdbblkchanges_ps
Redo Writes (per second)instance_throughputredowrites_ps
Open Cursors (per second)instance_throughputopncurs_ps
Average Instance CPU (%)wait_bottlenecksavg_user_cpu_time_pct
Network Bytes (per second)instance_throughputnetworkbytes_ps
Parse Failure Count (per transaction)instance_throughputfailedparses_pt
Consistent Read Blocks Created (per transaction)instance_throughputcrblks_pt
Enqueue Timeout (per second)instance_throughputenqtimeouts_ps
Connections Refused (per min)LoadrefConns
Tablespace Space Used (%)problemTbsppctUsed
Full Index Scans (per second)instance_throughputindxscansfull_ps
Free Archive Area (KB)archFullarchAvail
Enqueue Deadlocks (per transaction)instance_throughputenqdeadlocks_pt
User Rollback Undo Records Applied (per second)instance_throughputuserrollbackundorec_ps
Total Parses (per second)instance_throughputparses_ps
Database Block Gets (per second)instance_throughputdbblkgets_ps
Current Open Cursors CountDatabase_Resource_Usageopencursors
Active Sessions Waiting: I/Owait_bottlenecksuserio_wait_cnt
Library Cache Hit (%)instance_efficiencylibcache_hit_pct
Transfer Rate (MB/s)ha_rac_intrconn_trafficinterconnect_rate
Hard Parses (per transaction)instance_throughputhardparses_pt
Total Dump Area (KB)dumpFulldumpTotal
Total Table Scans (per second)instance_throughputtabscanstotal_ps
Global Cache Average CR Block Request Time (centi-seconds)rac_global_cachecr_request_cs
Process Limit Usage (%)Database_Resource_Usageprocess_usage
Active Sessions Waiting: Otherwait_bottlenecksother_wait_cnt
User Calls (per transaction)instance_throughputusercalls_pt
Session Terminated Alert Log Error StatusalertLogStatussessTerminateErrors
Java Pool Free (%)sga_pool_wastagejava_free_pct
Session Logical Reads (per second)instance_throughputlogreads_ps
Audited User Session CountUserAuditSession Count
Response Time (msec)ResponsetnsPing
Connections Established (per min)LoadestConns
Audited User HostUserAuditmachine
Total Table Scans (per transaction)instance_throughputtabscanstotal_pt
Physical Reads (per second)instance_throughputphysreads_ps
Leaf Node Splits (per second)instance_throughputleafnodesplits_ps
Redo Writes (per transaction)instance_throughputredowrites_pt
Recursive Calls (per second)instance_throughputrecurscalls_ps
Physical Writes (per second)instance_throughputphyswrites_ps
Consistent Read Changes (per transaction)instance_throughputconsistentreadchanges_pt
Global Cache Average Current Block Request Time (centi-seconds)rac_global_cachecurrentgets_cs
Host CPU Utilization (%)wait_bottleneckshost_cpu_usage_pct
Soft Parse (%)instance_throughputsoftparse_pct
Database Block Changes (per transaction)instance_throughputdbblkchanges_pt
Hard Parses (per second)instance_throughputhardparses_ps
Physical Reads Direct (per second)instance_throughputphysreadsdir_ps
Parse Failure Count (per second)instance_throughputfailedparses_ps
Scans on Long Tables (per second)instance_throughputtabscanslong_ps
Branch Node Splits (per second)instance_throughputbranchnodesplits_ps
Global Cache Blocks Lostrac_global_cachelost
Archiver Hung Alert Log Error StatusalertLogStatusarchiveHungErrors
Consistent Read Gets (per transaction)instance_throughputconsistentreadgets_pt
Data Dictionary Hit (%)instance_efficiencydictionaryhit_pct
Consistent Read Blocks Created (per second)instance_throughputcrblks_ps
Generic Alert Log ErroralertLoggenericErrStack
Number of recommendationssegment_advisor_countrecommendations
Flash Recovery Areaha_flashrecoveryflash_recovery_area
Number of Apply Processesstreams_processes_countAPPLY_COUNT
Tablespace Used Space (MB)tbspAllocationspaceUsed
Cumulative Logons (per transaction)instance_throughputlogons_pt
Dump Area Used (KB)dumpFulldumpUsed
Parallel Execution Downgraded 75% or more (per second)instance_efficiencypxdwngrd75_ps
Service CPU Time (per user call) (microseconds)servicecpu_cs
Full Index Scans (per transaction)instance_throughputindxscansfull_pt
Executes Performed without Parses (%)instance_throughputexecuteswoparse_pct
System Response Time (centi-seconds)system_response_time_per_calltime_cs
Data Block Corruption Alert Log Error StatusalertLogStatusblockCorruptErrors
CPU Usage (per transaction)instance_efficiencycpuusage_pt
Large Pool Free (%)sga_pool_wastagelarge_free_pct
User Rollback Undo Records Applied (per transaction)instance_throughputuserrollbackundorec_pt
Sorts in Memory (%)instance_efficiencyinmem_sort_pct
CPU Usage (per second)instance_efficiencycpuusage_ps
Consistent Read Gets (per second)instance_throughputconsistentreadgets_ps
Baseline SQL Response Timesql_responsebaselineTime
Active Sessions Using CPUwait_bottlenecksuser_cpu_time_cnt
Alert Log Error Trace FilealertLogtraceFileName
Media Failure Alert Log ErroralertLogmediaFailureErrStack
Capture Processes Having Errorsstreams_processes_countCAPTURE_ERROR_COUNT
Apply Processes Having Errorsstreams_processes_countAPPLY_ERROR_COUNT
Datafiles Need Media Recoveryha_recoverydatafiles_need_recovery
Enqueue Requests (per second)instance_throughputenqreqs_ps
Sorts to Disk (per second)instance_throughputsortsdisk_ps
Generic Alert Log Error StatusalertLogStatusgenericErrors
Redo Generated (per second)instance_throughputredosize_ps
Rows Processed (per sort)instance_throughputrows_psort
Redo Generated (per transaction)instance_throughputredosize_pt
Enqueue Waits (per transaction)instance_throughputenqwaits_pt
BG Checkpoints (per second)instance_throughputbgcheckpoints_ps
Enqueue Waits (per second)instance_throughputenqwaits_ps
Current SQL Response Timesql_responsecurrentTime
Current Logons CountDatabase_Resource_Usagelogons
Database Block Gets (per transaction)instance_throughputdbblkgets_pt
Physical Writes (per transaction)instance_throughputphyswrites_pt
Cumulative Logons (per second)instance_throughputlogons_ps
Executes (per second)instance_throughputexecutions_ps
Archiver Hung Alert Log ErroralertLogarchiveHungErrStack
Alert Log NamealertLogalertLogName
Tablespace Free Space (MB)problemTbspbytesFree
SQL Response Time (%)sql_responsetime
Leaf Node Splits (per transaction)instance_throughputleafnodesplits_pt
Open Cursors (per transaction)instance_throughputopncurs_pt
Consistent Read Undo Records Applied (per transaction)instance_throughputcrundorecs_pt
Parallel Execution Downgraded 25% or more (per second)instance_efficiencypxdwngrd25_ps
Branch Node Splits (per transaction)instance_throughputbranchnodesplits_pt
DBWR Checkpoints (per second)instance_throughputdbwrcheckpoints_ps
Free Dump Area (KB)dumpFulldumpAvail
Wait Time (%)wait_bottlenecksuser_wait_time_pct
Parallel Execution Downgraded 50% or more (per second)instance_efficiencypxdwngrd50_ps
Dump Area Used (%)dumpFulldumpUsedPercent
Consistent Read Changes (per second)instance_throughputconsistentreadchanges_ps
Session Terminated Alert Log ErroralertLogsessTerminateErrStack
Propagation Errorsstreams_processes_countPROP_ERROR_COUNT
Corrupt Data Blocksha_recoverycorrupt_data_blocks
Datafiles with Errorha_recoverymissing_media_files
Consistent Read Undo Records Applied (per second)instance_throughputcrundorecs_ps
User Commits (per second)instance_throughputcommits_ps
Shared Pool Free (%)sga_pool_wastageshared_free_pct
User Calls (per second)instance_throughputusercalls_ps
StatusResponseStatus
Recursive Calls (per transaction)instance_throughputrecurscalls_pt
Database Time (centiseconds per second)instance_throughputdbtime_ps
Total Index Scans (per transaction)instance_throughputindxscanstotal_pt
Average Users Waiting Countwait_sess_clsavg_users_waiting_on_class
User Rollbacks (per second)instance_throughputrollbacks_ps
Total Parses (per transaction)instance_throughputparses_pt
Physical Reads (per transaction)instance_throughputphysreads_pt
Scans on Long Tables (per transaction)instance_throughputtabscanslong_pt
Sorts to Disk (per transaction)instance_throughputsortsdisk_pt
Parallel Execution Downgraded (per second)instance_efficiencypxdwngrd_ps
Archive Area Used (%)archFullarchUsedPercent
Physical Reads Direct Lobs (per second)instance_throughputphysreadslob_ps
Buffer Cache Hit (%)instance_efficiencybufcachehit_pct
Number of Transactions (per second)instance_throughputtransactions_ps
Database Time Spent Waiting (%)wait_sess_clsdbtime_waitclass_pct
Enqueue Requests (per transaction)instance_throughputenqreqs_pt
User Logon Time (msec)ResponseuserLogon
Audited UserUserAuditusername

No comments:

Post a Comment