LoginSignup
2
1

More than 5 years have passed since last update.

Oracleのalert.logを直近のstartup以降の分だけ出力するスクリプト

Posted at

直近の起動を探すのが面倒なのでスクリプト化した。
環境変数は以下を設定する。

  • ORACLE_BASE
  • ORACLE_SID
  • ORACLE_UNQNAME
show_alert.sh
#!/bin/bash -x
MARKERWD="Starting ORACLE instance"
ALERTLOG=$ORACLE_BASE/diag/rdbms/$ORACLE_UNQNAME/$ORACLE_SID/trace/alert_$ORACLE_SID.log

LOGLENGTH=`wc -l $ALERTLOG | cut -f1 -d\ `
LASTSTART=`grep "$MARKERWD" $ALERTLOG -n | cut -f1 -d : | tail -n 1`
TAILCOUNT=`expr $LOGLENGTH - $LASTSTART + 1`

#echo $TAILCOUNT
#echo $LOGLENGTH
#echo $TAILCOUNT
echo $ALERTLOG
echo "----------------------------------------------------"
tail -n $TAILCOUNT $ALERTLOG

わざわざシェル化しなくとも
多分他にももっといい方法あるとおもう。

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1