Article Title: using Oracle storage to analyze Unix system performance (2 ). Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
4. Create the get_vmstat.ksh script
The script is used to regularly execute the vmstat command and save the result to the database.
# Get_vmstat.ksh
#! /Bin/ksh
#----------------------------------------
# First set the environment variable and modify it according to the actual environment ....
#----------------------------------------
ORACLE_SID = kamusdb
Export ORACLE_SID
ORACLE_HOME = 'cat/var/opt/oracle/oratab | grep
^ $ ORACLE_SID: | cut-f2-d ':''
Export ORACLE_HOME
PATH = $ ORACLE_HOME/bin: $ PATH
Export PATH
SERVER_NAME = 'uname-a | awk '{print $2 }''
Typeset-u SERVER_NAME
Export SERVER_NAME
#----------------------------------------
# Run vmstat every 5 minutes (300 seconds). You can modify it according to the actual situation ....
#----------------------------------------
SAMPLE_TIME = 300.
#----------------------------------------
# Once the script is run, it will not stop unless the operating system is closed ....
# The-S parameter indicates the condition of monitoring the swap space and reports the si and so columns.
# $ In msg $ indicates an arbitrary 2-digit number, which is automatically generated by the system.
#----------------------------------------
While true
Do
Vmstat? S $ {SAMPLE_TIME} 2>/tmp/msg $
[1] [2] [3] Next page