Skip to content

Instantly share code, notes, and snippets.

@joker1007
Created October 26, 2010 03:43
Show Gist options
  • Save joker1007/646271 to your computer and use it in GitHub Desktop.
Save joker1007/646271 to your computer and use it in GitHub Desktop.
#!/bin/sh
# cd
cd /var/tmp
# 環境変数
ORACLE_HOME=*******
ORACLE_SID=********
NLS_LANG=*******
# PATH
PATH=$ORACLE_HOME/bin:PATH
sqlplus id/pass@connect_id @${ORACLE_HOME}/rdbms/admin/utlbstat.sql
if [ $? -ne 0 ]; then
# エラー発生時の処理
echo "Error"
exit 0
else
# 正常終了時の処理
echo "Start Bstat"
fi
#1時間の30秒前で停止
sleep 3570
sqlplus id/pass@connect_id @${ORACLE_HOME}/rdbms/admin/utlestat.sql
if [ $? -ne 0 ]; then
# エラー発生時の処理
echo "Error"
exit 0
else
# 正常終了時の処理
echo "End Bstat"
fi
# Rename to report_dd-hh.txt
mv report.txt report_`date +%d-%H`.txt
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment