Skip to content
pvmehta.com

pvmehta.com

  • Home
  • About Me
  • Toggle search form
  • Rman Notes -1 Oracle
  • Identical Dblink Issue… Oracle
  • scripts to take listener.log backup Linux/Unix
  • Convert multiple rows to single column Oracle
  • Changing default shell Linux/Unix
  • shutdown linux Linux/Unix
  • How can I tell if ASO is installed ? Oracle
  • Find all users who have DML privileges Oracle
  • In Addition to previous note, following grants needed on PERFSTAT user. Oracle
  • For Perl DBI installation and testing program PHP/MYSQL/Wordpress
  • SQLPLUS COPY command Precautions. Oracle
  • Oracle 11g Environment Setup Oracle
  • Oracle vs MYSQL Architecture differences (For DBAs) MYSQL
  • perf_today.sql Oracle
  • 556976.1 Oracle Clusterware: Components installed 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

  • Find execution plan from dba_hist_sql_plan for a specific SQL_ID and PLAN_HASH_VALUE fplan.sql Oracle
  • DBMS_STATS Metalinks Notes Oracle
  • initUOCIOTTO.ora Oracle
  • DBMS_PROFILER for tuning PLSQL programs. Oracle
  • AWR settings- MMON is not taking snapshot. Oracle
  • Wait.sql 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 (393)
  • PHP/MYSQL/Wordpress (10)
  • POSTGRESQL (0)
  • Power-BI (0)
  • Python/PySpark (7)
  • RAC (17)
  • rman-dataguard (26)
  • shell (149)
  • SQL scripts (342)
  • SQL Server (6)
  • Uncategorized (0)
  • Videos (0)

Recent Posts

  • Trace a SQL session from another session using ORADEBUG30-Sep-2025
  • 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

Archives

  • 2025
  • 2024
  • 2023
  • 2010
  • 2009
  • 2008
  • 2007
  • 2006
  • 2005
  • Good RAC & Standby Notes Oracle
  • USER_TABLES.Freelists Oracle
  • Find Plan Hash value fphv.sql Oracle
  • Roles and Stored Procs II Oracle
  • get_ratio.sql get the ratio of users from v$session and this uses CASE-WHEN-THEN clause Oracle
  • process id based files and processes Linux/Unix
  • Privileges Required to Create Procedures and Functions that uses objects from other schema. Oracle
  • sbind.sql Find Bind variable from sql_id sqlid Oracle

Copyright © 2025 pvmehta.com.

Powered by PressBook News WordPress theme