Skip to content
pvmehta.com

pvmehta.com

  • Home
  • About Me
  • Toggle search form
  • Gathering statistics with DBMS_STATS Oracle
  • More info about /proc folder and its relation with processes. Linux/Unix
  • purge_trc.sh Linux/Unix
  • Oracle Recommended Patches — Oracle Database ID 756671.1 Oracle
  • Sample WW22 listener.ora Oracle
  • How does one overcome the Unix 2 Gig file limit? Linux/Unix
  • Debugging Shell FIles Linux/Unix
  • Display the top 5 salaries for each department using single SQL Oracle
  • import-export with multiple files Oracle
  • Good links for x$ tables in oracle. Oracle
  • Export Import with QUERY Oracle
  • How to find password change date for user Oracle
  • find_longsql.sql Oracle
  • Oracle Statspack survival Guide Oracle
  • find_cons.sql Oracle

pvm_metric.sql for gathering report from vmstat tables

Posted on 10-May-2008 By Admin No Comments on pvm_metric.sql for gathering report from vmstat tables

col AVG_ACTIVE_USR format 999999.99

col AVG_TOT_USR format 9999.99

col AVG_USR_CPU format 9999.99

col AVG_SYS_CPU format 99.99

col AVG_IDLE_CPU format 99.99

col AVG_WAIT_CPU format 99.99

col TOT_ODR format 99999999

col AVG_ACT_USR format 999999.99

col RUNQ format 999.99

col CSW format 99999.99

set lines 120 pages 2000

accept start1 prompt ‘Enter Start Dare in DD-MON-RRRR:HH24:MI format : ‘

accept stop1 prompt ‘Enter Stop Dare in DD-MON-RRRR:HH24:MI format : ‘

set echo off

set feedback off

set verify off

select to_char(measured_date,’DD-MON-RRRR:HH24′) “Hour”, min(a.total_users) “Min Tot Usr”,

max(a.total_users) “Max Tot Usr”, avg(a.total_users) AVG_TOT_USR,

min(b.user_cpu+system_CPU) “MIN USG CPU”, max((b.user_cpu+system_CPU)) “Max USG CPU”,

avg((b.user_cpu+system_CPU)) “Avg Usg CPU”

from stats$totalusers a,stats$vmstat2 b

where a.measured_date=b.start_date

and a.measured_date between to_date(‘&start1’, ‘DD-MON-RRRR:HH24:MI’) and to_date(‘&stop1’, ‘DD-MON-RRRR:HH24:MI’)

group by to_char(measured_date,’DD-MON-RRRR:HH24′)

/

select to_char(b1.start_date, ‘DD-MON-RRRR:HH24’) peak_hr, (b1.user_cpu+b1.system_CPU) peak_cpu

from stats$vmstat2 b1

where (b1.user_cpu+b1.system_CPU) = (select max((b.user_cpu+system_CPU)) max_cpu

from stats$vmstat2 b

where b.start_date between to_date(‘&start1’, ‘DD-MON-RRRR:HH24:MI’)

and to_date(‘&stop1’, ‘DD-MON-RRRR:HH24:MI’))

and b1.start_date between to_date(‘&start1’, ‘DD-MON-RRRR:HH24:MI’)

and to_date(‘&stop1’, ‘DD-MON-RRRR:HH24:MI’) ;

select avg(XXX.avg_cpu) “Average-CPU”

from

(select to_char(measured_date,’DD-MON-RRRR:HH24′) “Hour”, avg((b.user_cpu+system_CPU)) avg_cpu

from stats$totalusers a,stats$vmstat2 b

where a.measured_date=b.start_date

and a.measured_date between to_date(‘&start1’, ‘DD-MON-RRRR:HH24:MI’) and to_date(‘&stop1’, ‘DD-MON-RRRR:HH24:MI’)

group by to_char(measured_date,’DD-MON-RRRR:HH24′)) XXX

/

Oracle, SQL scripts

Post navigation

Previous Post: ORA-4031 issue and solution on 09-MAY-2008
Next Post: get_ratio.sql get the ratio of users from v$session and this uses CASE-WHEN-THEN clause

Related Posts

  • Generating XML from SQLPLUS Oracle
  • My Test Case On 21-OCT-2005 Oracle
  • Benefits and Usage of RMAN with Standby Databases Oracle
  • Set Role explaination. Oracle
  • Export Oracle data and Compress at same time Oracle
  • Processes Parameter decision Oracle

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Categories

  • Ansible (0)
  • AWS (2)
  • Azure (1)
  • Linux/Unix (149)
  • MYSQL (5)
  • Oracle (392)
  • PHP/MYSQL/Wordpress (10)
  • POSTGRESQL (0)
  • Power-BI (0)
  • Python/PySpark (7)
  • RAC (17)
  • rman-dataguard (26)
  • shell (149)
  • SQL scripts (341)
  • SQL Server (6)
  • Uncategorized (0)
  • Videos (0)

Recent Posts

  • SQL Server Vs Oracle Architecture difference25-Jul-2025
  • SQL Server: How to see historical transactions25-Jul-2025
  • SQL Server: How to see current transactions or requests25-Jul-2025
  • T-SQL Vs PL/SQL Syntax25-Jul-2025
  • Check SQL Server edition25-Jul-2025
  • Checking SQL Server Version25-Jul-2025
  • Oracle vs MYSQL Architecture differences (For DBAs)24-Jul-2025
  • V$INSTANCE of Oracle in MYSQL24-Jul-2025
  • Day to day MYSQL DBA operations (Compared with Oracle DBA)24-Jul-2025
  • MYSQL and Oracle Comparison for Oracle DBA24-Jul-2025

Archives

  • 2025
  • 2024
  • 2023
  • 2010
  • 2009
  • 2008
  • 2007
  • 2006
  • 2005
  • How to know Number of CPUs on Sun Box Linux/Unix
  • UTL_FILE test program Oracle
  • Find_table_size.sql Oracle
  • To find all disk io ( EMC as well as local) Linux/Unix
  • Disbaling DBA_SCHEDULER_JOBS Oracle
  • Reading parameter file and printing Linux/Unix
  • PLSQL Table Syntax 2 Oracle
  • sql_doing_fts.sql Oracle

Copyright © 2025 pvmehta.com.

Powered by PressBook News WordPress theme