1. 程式人生 > >Oracle 每隔5分鐘產生2個clsc*.log文件

Oracle 每隔5分鐘產生2個clsc*.log文件

收集 目錄 min 這一 cls ins hp-unix div oracl

環境:

OS:HP-UNIX

數據庫:11.2.0.4 雙機RAC

(一)現象

在清理Oracle日誌的時候,發現在$ORACLE_HOME/log/{instance_id}/client下面存在大量的clsc*.log。經過觀察,發現每隔5分鐘產生2個日誌,具體如下:

...
-rw-r--r-- 1 oracle oinstall 244 Sep 25 15:55 clsc34691.log
-rw-r--r-- 1 oracle oinstall 244 Sep 25 15:55 clsc34692.log
-rw-r--r-- 1 oracle oinstall 244 Sep 25 16:00 clsc34693.log
-rw-r--r-- 1 oracle oinstall 244 Sep 25 16:00 clsc34694.log
-rw-r--r-- 1 oracle oinstall 244 Sep 25 16:05 clsc34695.log
-rw-r--r-- 1 oracle oinstall 244 Sep 25 16:05 clsc34696.log
-rw-r--r-- 1 oracle oinstall 244 Sep 25 16:10 clsc34697.log
-rw-r--r-- 1 oracle oinstall 244 Sep 25 16:10 clsc34698.log
-rw-r--r-- 1 oracle oinstall 244 Sep 25 16:15 clsc34699.log
-rw-r--r-- 1 oracle oinstall 244 Sep 25 16:15 clsc34700.log
-rw-r--r-- 1 oracle oinstall 244 Sep 25 16:20 clsc34701.log
-rw-r--r-- 1 oracle oinstall 244 Sep 25 16:25 clsc34702.log
-rw-r--r-- 1 oracle oinstall 244 Sep 25 16:30 clsc34703.log
-rw-r--r-- 1 oracle oinstall 244 Sep 25 16:35 clsc34704.log
-rw-r--r-- 1 oracle oinstall 244 Sep 25 16:40 clsc34705.log
...

查看日誌數量,發現已經有很多了

fabdb1$[/grid/11.2.0/grid/log/fabdb1/client]ll |wc -l
34709

(二)原因

發現這是Oracle在11.2中的bug,在開啟Oracle EM的情況下,EM會每隔5分鐘使用crs_stat去收集Oracle服務的狀態,導致日誌的產生。

(三)解決方案

以oracle用戶登錄,到目錄下:

$ORACLE_HOME/sysman/admin/scripts/

修改2個文件:

①  vim crs_resources.pl
# 找到這一行:
my $cmd = "$crs_home/bin/crs_stat
"; # 修改為: my $cmd = "$crs_home/bin/crsctl stat res";

② vim crs_vip.pl
# 找到這一行:
my $cmd = "$crs_home/bin/crs_stat"; 
# 修改為:
my $cmd = "$crs_home/bin/crsctl stat res"; 

重啟EM

emctl stop dbconsole
emctl start dbconsole

su - grid

cd $ORACLE_HOME/log/{instance_name}/client
ls -lrt --持續監控半小時,檢查是否有規律產生日誌文件。

Oracle 每隔5分鐘產生2個clsc*.log文件