understand 11G clusterware logfile(保留策略及修改方式)
在分析一个问题时发现mDNS的LOG所有文件才只保留了几分钟的日志, 我们都知道CRS里的日志多数都是CRS自身滚动保存覆盖的,
我被问到能不能把mDNS日志多保留一段时间? 特意总结了一下CRS日志的保存规则.
CRS的日志是自动管理的,在12c的版本以前日志都在$GI_HOME/log/<node_name>,从12C的版本开始CRS的日志也转移到了ADR中,如同11G时的bdump等日志, 12c以后的log存在<ORACLE_BASE>/crsdata/<node>/output
和<ORACLE_BASE>/diag/crs/<node>/crs 目录中.这里我们内容还是关于11G版本(当前11.2.0.3)
1, 不是自动管理,需要DBA维护
<GRID_HOME>/log/$HOST (has alert$HOST.log) <GRID_HOME>/log/$HOST/client <GRID_HOME>/log/diag <GRID_HOME>/log/diag/asm/user_root/host_* <GRID_HOME>/log/diag/asmcmd/user_grid/$HOST <GRID_HOME>/log/diag/asmcmd/user_oracle/$HOST <GRID_HOME>/log/diag/asmcmd/user_root/$HOST <GRID_HOME>/log/diag/asmtool/user_root/host_* <GRID_HOME>/log/diag/clients/user_root/host_* <GRID_HOME>/log/diag/tnslsnr/$HOST/listener_scan1 <GRID_HOME>/log/diag/tnslsnr/$HOST/listener_scan2 <GRID_HOME>/log/$HOST/racg <GRID_HOME>/log/$HOST/racg/racgeut <GRID_HOME>/log/$HOST/racg/racgevtf <GRID_HOME>/log/$HOST/racg/racgmain <GRID_HOME>/log/$HOST/srvm <GRID_HOME>/rdbms/audit
2, 自动管理,当前日志和10份50M的历史日志归档,名称为xxxx.l(01-10),FIFO的方式保存,归档时文件名编号+1,被下一个替换.
<GRID_HOME>/log/$HOST/cssd:
3, 自动管理, 当前日志和10份10M的历史日志归档,名称为xxx.l(01-10),FIFO的方式保存,归档时文件名编号+1,被下一个替换.
<GRID_HOME>/log/$HOST/acfsrepl <GRID_HOME>/log/$HOST/acfsreplroot <GRID_HOME>/log/$HOST/acfssec <GRID_HOME>/log/$HOST/admin <GRID_HOME>/log/$HOST/agent <GRID_HOME>/log/$HOST/agent/crsd/ora_oc4j_type_oracle <GRID_HOME>/log/$HOST/agent/crsd/oraagent_grid <GRID_HOME>/log/$HOST/agent/crsd/oraagent_oracle <GRID_HOME>/log/$HOST/agent/crsd/orarootagent_root <GRID_HOME>/log/$HOST/agent/crsd/scriptagent_grid <GRID_HOME>/log/$HOST/agent/ohasd <GRID_HOME>/log/$HOST/agent/ohasd/oraagent_oracle <GRID_HOME>/log/$HOST/agent/ohasd/oraagent_grid <GRID_HOME>/log/$HOST/agent/ohasd/oracssdagent_root <GRID_HOME>/log/$HOST/agent/ohasd/oracssdmonitor_root <GRID_HOME>/log/$HOST/agent/ohasd/orarootagent_root <GRID_HOME>/log/$HOST/agent/crsd <GRID_HOME>/log/$HOST/crflogd <GRID_HOME>/log/$HOST/crfmond <GRID_HOME>/log/$HOST/crsd <GRID_HOME>/log/$HOST/ctssd <GRID_HOME>/log/$HOST/cvu <GRID_HOME>/log/$HOST/cvu/cvulog <GRID_HOME>/log/$HOST/cvu/cvutrc <GRID_HOME>/log/$HOST/diskmon <GRID_HOME>/log/$HOST/evmd <GRID_HOME>/log/$HOST/gipcd <GRID_HOME>/log/$HOST/gpnpd <GRID_HOME>/log/$HOST/gnsd <GRID_HOME>/log/$HOST/mdnsd <GRID_HOME>/log/$HOST/ohasd
当然滚动的日志大小不一定完全一样取决于最后一次写buffer size, 规则如下:
declare current size of the file = x buffer size to be written into the file in the current write call = y Maximum file size = z if (x+y > z) then rotate file else write to current file end if;
回到上面的问题, 能修改默认日志最大大小么?
在11g我发现只有CSSD log可以修改, 如从默认的50M修改成150M, 另外注意到Exadata环境中是建议加大的.
[anbob@root]# crsctl get css logfilesize CRS-4676: Successful get logfilesize 52428800 for Cluster Synchronization Services. [anbob@root]# crsctl set css logfilesize 152428800 CRS-4686: Successful set logfilesize 152428800 for Cluster Synchronization Services. [anbob@root]# crsctl get css logfilesize CRS-4676: Successful get logfilesize 152428800 for Cluster Synchronization Services.
在12c我发现增加了一个新的选项tracefileopts, 可以自定义其它日志大小.
Usage: crsctl set tracefileopts {mdns|gpnp|css|crf|crs|ctss|evm|gipc} -filesize <file_size>[K|k|M|m|G|g] -numsegments <num_of_segments> and crsctl get tracefileopts {mdns|gpnp|css|crf|crs|ctss|evm|gipc}
另外附之前写的清理日志的脚本:
Shell: To delete listener log file contains text and xml format
script: purge ADR file
对不起,这篇文章暂时关闭评论。