- 论坛徽章:
- 0
|
一个简单的脚本:
#!/bin/ksh
ORACLE_HOME=/oracle/gtprod/gtproddb/9.2.0
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_TIME=300
while true do
vmstat ${SAMPLE_TIME} 2 >; /tmp/msg$$
cat /tmp/msg$$ | sed 1,3d | awk '{printf("%s %s %s %s %s %s\n",$1, $8, $9, $20, $21, $22)}' | while read RUNQUE PAGE_IN PAGE
_OUT USER_CPU SYSTEM_CPU IDLE_CPU do
$ORACLE_HOME/bin/sqlplus -s perfstat/perfstat@gtprod<<!
insert into perfstat.stats\$vmstat values(sysdate, $SAMPLE_TIME, '$SERVER_NAME', $RUNQUE, $PAGE_IN, $PAGE_OU
T, $USER_CPU, $SYSTEM_CPU, $IDLE_CPU, 0 );
commit;
exit;
!
done
done
rm /tmp/msg$$
在执行时总报错:./get_vmstat.ksh[7]: syntax error at line 16 : `(' unexpected
可是也没有发现哪里有问题啊?请高手指教 |
|