1
0

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 1 year has passed since last update.

cronを設定してADR設定ホーム内の診断データを削除

Last updated at Posted at 2021-10-06

#はじめに
Oracle Database 11gから、ログファイルなどのデータベースの状況確認や診断に使用するデータは、ADR(Automatic Diagnostic Repository: 自動診断リポジトリ)で一括管理されるようになりました。
ADRには、データベースのすべての診断情報(ログ、トレース、インシデント、問題など)が含まれています。ただし、診断情報は肥大化し、ディスク容量を逼迫することがあります。その場合、DB正常の動作を保つために定期的に診断データをpurgeする必要があります。

#ADRCI
ADRを管理するために、ADRCIと呼ばれるコマンドラインインターフェイスもあります。ADRCIを使って診断データをpurgeすることができます。
ADRCIはバッチ・モードを使用することができます、バッチ・モードで実行した場合、入力を求めるプロンプトが表示されることなく、一連のADRCIコマンドを一度に実行できます。

例: 7日(10080分)より前のすべてのTRACEファイルを削除します。

adrci exec="set homepath diag/rdbms/dbpubse_nrt1fd/dbpubse;purge -age 10080 -type TRACE"

※homepath を環境に合わせて設定してください。

#定期的に診断データをpurge

1. 診断データを削除するshell作成
例:7日より前のすべてのTRACEファイルを削除するshell
ファイル名:/home/oracle/purgetrace.sh

#!/bin/bash
export ORACLE_SID=dbpubse
export ORAENV_ASK=NO
export PATH=/usr/local/bin:$PATH
. /usr/local/bin/oraenv
adrci exec="set homepath diag/rdbms/dbpubse_nrt1fd/dbpubse;purge -age 10080 -type TRACE"

※ORACLE_SIDとhomepath を環境に合わせて設定してください。

2.実行権限追加

 chmod u+x /home/oracle/purgetrace.sh 

3. Oracleユーザーcrontab設定
例:毎日1時上記のSHELL実行

0 1 * * * /home/oracle/purgetrace.sh

#参考資料
Simple cron job to purge Automatic Diagnostic Repository
cron(クロン)設定・書き方の基本
ADRCIコマンド・リファレンス
OCI DBインスタンスでADRCIユーティリティを使う

1
0
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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?