shell 指令碼讀多個oracle_sid

pentium發表於2013-03-15
shell 指令碼讀多個oracle_sid, 並連線資料庫的指令碼[@more@]#! /bin/ksh
set -x
export oratab_file=/var/opt/oracle/oratab
export ORACLE_HOME=/u01/app/oracle/product/11.1.0
export PATH=$ORACLE_HOME/bin:$PATH
export SHL_DIR=/u01/app/oracle/dba/ora_shells
awk -F: '/^[^#].*:.*:*/ {print $1}' ${oratab_file} |
while read sid_line
do
echo $ORACLE_SID
export ORACLE_SID=${sid_line}
sqlplus /nolog > ca.log << EOF
connect / as sysdba
insert into system.db_growth
(select owner,sum(bytes)/1024/1024,sysdate,'${ORACLE_SID}' from dba_segments group by owner);
exit
EOF
done

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/14377/viewspace-1060301/,如需轉載,請註明出處,否則將追究法律責任。

相關文章