3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Oracleのstatspack取るだけのシェルスクリプト

Posted at

環境

やること

スナップショットの採取。sqlplus起動してヒアドキュメントでコマンド流し込む。

createSnapshotOfStatspack.sh
# !/bin/sh
sqlplus perfstat/xxxx << EOF
  execute statspack.snap
  exit
EOF

レポートの作成。引数にsnapshot idのbeginとendを渡す。idは、一度下記スクリプトを引数無しで実行すればspreport.sqlがエラーで終了する直前にidのリストを出力されるのでそっから選ぶ。ぶっちゃけ雑仕様。

createReportOfStatspack.sh
# !/bin/sh

# ./createReportOfStatspack.sh 84 85 -> create sp_84_85.lst
sqlplus perfstat/xxxx << EOF
  @$ORACLE_HOME/rdbms/admin/spreport.sql
  $1
  $2
  sp_$1_$2.lst
  EXIT
EOF
3
2
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
3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?