Skip to content
pvmehta.com

pvmehta.com

  • Home
  • About Me
  • Toggle search form
  • longtx.sql with the flag whether session is blocking any DML locks or not. Oracle
  • How to know current SID Oracle
  • Session_info.ksh Linux/Unix
  • Rownum with Order by Oracle
  • My Test Case On 21-OCT-2005 Oracle
  • tblwopk.sql tablewopk.sql Oracle
  • Goog notes on X$ tables Oracle
  • ipcs -l Linux/Unix
  • SQL Tracker by SID sqltrackerbysid.sql Oracle
  • fkwoind.sql fkwoindex.sql Oracle
  • newupload.html PHP/MYSQL/Wordpress
  • How do I get Oracle to automatically start when my server boots up? Oracle
  • create database link syntax Oracle
  • Follwoing korn shell is used to move files from source folder to destination folder and gzip it in destination folder. mv_iotto.ksh Linux/Unix
  • How to Decide upto what level you can decrement your datafile size. ( Shrink Datafile) 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

  • create trigger syntax Oracle
  • login.sql Oracle
  • Find average Row Length and other table size calculation. metalink notes Oracle
  • Renaming the column name Oracle
  • create database link syntax Oracle
  • PLSQL Table Syntax 1 Oracle

Leave a Reply Cancel reply

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

Categories

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

Recent Posts

  • load SPM baseline from cursor cache05-Jun-2025
  • Drop all SPM baselines for SQL handle05-Jun-2025
  • Load SPM baseline from AWR05-Jun-2025
  • Drop specific SQL plan baseline – spm05-Jun-2025
  • findinfo.sql (SQL for getting CPU and Active session info)27-May-2025
  • SQL Tracker by SID sqltrackerbysid.sql22-Apr-2025
  • How to connect to Oracle Database with Wallet with Python.21-Mar-2025
  • JSON/XML Types in Oracle18-Mar-2025
  • CPU Core related projections12-Mar-2025
  • Exadata Basics10-Dec-2024

Archives

  • 2025
  • 2024
  • 2023
  • 2010
  • 2009
  • 2008
  • 2007
  • 2006
  • 2005
  • Good Oracle Architecture In Short and point to point Oracle
  • V$ROLLSTAT status is Full Oracle
  • remove archfiles only when it is applied to DR rm_archfiles.sh Linux/Unix
  • Restoring a user’s original password 1051962.101 Oracle
  • Order by with ROWNUM Oracle
  • How to sort list of files on basis of their sizes. Linux/Unix
  • Multiple listeners Oracle
  • Roles and Stored Procs II Oracle

Copyright © 2025 pvmehta.com.

Powered by PressBook News WordPress theme