Skip to content
pvmehta.com

pvmehta.com

  • Home
  • About Me
  • Toggle search form
  • Oracle Metalink useful notes Oracle
  • Find_table_size.sql Oracle
  • Jai Shree Ram Oracle
  • Standby Database Behavior when a Datafile is Resized on the Primary Database Note:123883.1 Oracle
  • normal maintenance for exp-imp and renaming table Oracle
  • process id based files and processes Linux/Unix
  • SQLPLUS COPY command Precautions. Oracle
  • executing Function from SQLPLUS prompt Oracle
  • .profile Linux/Unix
  • How to find Unix server conguraiton including Server Model number and underlying disk sub-system ( On Solaris) Linux/Unix
  • How To Limit The Access To The Database So That Only One User Per Schema Are Connected (One Concurrent User Per Schema) Oracle
  • Jai Shree Ram Oracle
  • sql_plan9i.sql Oracle
  • Good link for LIO in Oracle ( Logical IOs) Oracle
  • Find Command Linux/Unix

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

  • Generate SSH without password authentication. Linux/Unix
  • runsql_once.ksh Linux/Unix
  • move_arch_files.ksh /* Good One */ Linux/Unix
  • Establishing trusted relationship between dbmonitor( central monitoring) and monitoring targets. Linux/Unix
  • Removing Ctrl-M from end of line using vi Linux/Unix
  • 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

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
  • sqlnet.ora paramters Oracle
  • create PLAN_TABLE command. Oracle
  • rm_backup_arch_file.ksh Linux/Unix
  • Find sort details from Db find_sort.sql Oracle
  • replace alphabets using sed Linux/Unix
  • executing Function from SQLPLUS prompt Oracle
  • find_open_cur.sql Find open cursorts per session Oracle
  • Jai Shree Ram Oracle

Copyright © 2025 pvmehta.com.

Powered by PressBook News WordPress theme