分类: Oracle
2010-10-21 14:08:59
sharepoll.sh:
#!/bin/sh
# Oracle specific environment settings
export ORACLE_BASE=/ora01
export ORACLE_HOME=$ORACLE_BASE/9i
export ORACLE_SID=srm
# User specific environment and startup programs
PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin:.
datadate=`date +%D`
datatime=`date +%R`
datapath=/backup/scrīpt/tunning/sharepool
data=sharepool.data-`date +%Y-%m`
#/ora01/9i/bin/sqlplus /nolog @/backup/scrīpt/tunning/sharepool/sharepool.sql
sqlplus '/as sysdba' @$datapath/sharepool.sql >$datapath/sharepool.log
values=`/bin/cat $datapath/sharepool.log |egrep -v "SQL|Oracle|JServer|With|Disconnect|Connect|Total|-"|awk '{print $3}'|sed '/^$/d'`
echo $datadate $datatime $values >> $datapath/$data
cat $datapath/$data
sharepool.sql:
select sum(pins) "Total Pins", sum(reloads) "Total Reloads",
(1-sum(reloads)/sum(pins) *100) libcache
from v$librarycache;
exit;