Skip to content
pvmehta.com

pvmehta.com

  • Home
  • About Me
  • Toggle search form
  • PHP code to add WordPress posts in bulk programmatically PHP/MYSQL/Wordpress
  • fkwoindex.sql /* Find FK without Index */ Oracle
  • How to stop OCSSD Daemon Oracle
  • tuning commmand for cpu, ip and memory stats Linux/Unix
  • Find execution plan from dba_hist_sql_plan for a specific SQL_ID and PLAN_HASH_VALUE fplan.sql Oracle
  • My Test Case On 21-OCT-2005 Oracle
  • move_arch_files.ksh Linux/Unix
  • column level grant syntax Oracle
  • crontab syntax Linux/Unix
  • How to know current SID Oracle
  • Establishing trusted relationship between dbmonitor( central monitoring) and monitoring targets. Linux/Unix
  • catall.sh Linux/Unix
  • Display the top 5 salaries for each department using single SQL Oracle
  • Standby Database File Management in 10g with STANDBY_FILE_MANAGEMENT Oracle
  • good note for shared pool tunnig Oracle

get_vmstat.ksh

Posted on 23-Nov-2005 By Admin No Comments on get_vmstat.ksh

select a.measured_date, a.total_users, a.active_users, b.user_cpu, b.system_cpu, b.idle_cpu, b.wait_cpu from stats$totalusers a, stats$vmstat2 b

where a.measured_date = b.start_date

and to_char(measured_date,’DD-MON-YY’)=’22-NOV-05′

and to_char(measured_date,’HH24′) > ’14’

and to_char(measured_date,’HH24′) < '19' order by measured_date desc
Script that populates stats$vmstat2 table is dbblkabva01:/export/home/oracle/oraprocs/get_vmstat2.ksh

——– vmstats.ksh ————-

#!/bin/ksh

# First, we must set the environment . . . .

ORACLE_SID=BLINKT

export ORACLE_SID

#ORACLE_HOME=`cat /var/opt/oracle/oratab|grep ^$ORACLE_SID:|cut -f2 -d’:’`

ORACLE_HOME=/oracle/app/oracle/product/8.1.7

export ORACLE_HOME

PATH=$ORACLE_HOME/bin:$PATH

export PATH

SERVER_NAME=`uname -a|awk ‘{print $2}’`

typeset -u SERVER_NAME

export SERVER_NAME

# sample every five minutes (300 seconds) . . . .

SAMPLE_TIME=300

while true

do

vmstat ${SAMPLE_TIME} 2 > /tmp/msg$$

# Note that Solaris does not have a wait CPU column

cat /tmp/msg$$|sed 1,3d | awk ‘{ printf(“%s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %sn”, $1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12,

$17, $18, $19, $20, $21, $22) }’ | while read RUNQUE BUSY_WAITS RUNNABLE_WAITS SWAP FREE PAGE_RECLAIMS MINOR_FAULTS PAGE_IN PAGE_OUT PAGE_FREE DESTROYE

D SCAN_RATE DEVICE_INTERRUPT SYSTEM_CALLS CONTEXT_SWITCHES USER_CPU SYSTEM_CPU IDLE_CPU

do

echo $RUNQUE

echo $BUSY_WAITS

echo $RUNNABLE_WAITS

echo $SWAP

echo $FREE

echo $PAGE_RECLAIMS

echo $MINOR_FAULTS

echo $PAGE_IN

echo $PAGE_OUT

echo $PAGE_FREE

echo $DESTROYED

echo $SCAN_RATE

echo $DEVICE_INTERRUPT

echo $SYSTEM_CALLS

echo $CONTEXT_SWITCHES

echo $USER_CPU

echo $SYSTEM_CPU

echo $IDLE_CPU

$ORACLE_HOME/bin/sqlplus -s / < execute PERFSTAT.VMSTAT3(SYSDATE,$SAMPLE_TIME,’$SERVER_NAME’,$RUNQUE,$BUSY_WAITS,$RUNNABLE_WAITS,$SWAP,$FREE,$PAGE_RECLAIMS,$MINOR_FAULTS,$PAGE_IN,$

PAGE_OUT,$PAGE_FREE,$DESTROYED,$SCAN_RATE,$DEVICE_INTERRUPT,$SYSTEM_CALLS,$CONTEXT_SWITCHES,$USER_CPU,$SYSTEM_CPU,$IDLE_CPU,0);

EXIT

EOF

done

done

rm /tmp/msg$$

Linux/Unix, shell

Post navigation

Previous Post: DBMS_UTILITY PACKAGE
Next Post: Windows based Command line mailing program like mailx (Sednmail for windows)

Related Posts

  • find checksum of a file. Linux/Unix
  • Zip and unzip with tar Linux/Unix
  • check_copy_progress.sh Linux/Unix
  • Check_recovery.sh program to run sqlplus and return its values remotely. Linux/Unix
  • set_env_dba Linux/Unix
  • Some OS level threshold for performance. Linux/Unix

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 (388)
  • PHP/MYSQL/Wordpress (10)
  • Power-BI (0)
  • Python/PySpark (7)
  • RAC (17)
  • rman-dataguard (26)
  • shell (149)
  • SQL scripts (337)
  • Uncategorized (0)
  • Videos (0)

Recent Posts

  • 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
  • Reading config file from other folder inside class24-Sep-2024
  • Python class import from different folders22-Sep-2024
  • Transfer SQL Profiles from One database to other database.05-Sep-2024
  • Load testing on Oracle 19C RAC with HammerDB18-Jan-2024

Archives

  • 2025
  • 2024
  • 2023
  • 2010
  • 2009
  • 2008
  • 2007
  • 2006
  • 2005
  • Read CSV File using Python Python/PySpark
  • Alter procedure auditing Oracle
  • Does DBMS_JOB recompute the NEXT_DATE interval after or before Oracle
  • longtx.sql Oracle
  • v$event_name Oracle
  • findobj.sql Oracle
  • chk_space_SID.ksh Linux/Unix
  • How to analyze statspack or AWR report. Oracle

Copyright © 2025 pvmehta.com.

Powered by PressBook News WordPress theme