Search This Blog

Total Pageviews

Friday, 18 November 2022

Oracle Logrotate


 Oracle Logrotate 

logrotate  grid -s /tmp/ostatus

If below error  

error: skipping  because parent directory has insecure permissions (It's world writable or writable by group which is not "root") Set "su" directive in config file to tell logrotate which user/group should be used for rotation.


Do following !!!

[root@rac02 logrotate.d]# ls -ltr /u01/app/grid/diag/tnslsnr/rac02/start/trace/start.log
-rwxrwxr-x 1 grid oinstall 670 Nov 20  2020 /u01/app/grid/diag/tnslsnr/rac02/start/trace/start.log

[root@rac02 logrotate.d]# vi grid
[root@rac02 logrotate.d]# logrotate  grid -s /tmp/ostatus



 pwd
/etc/logrotate.d



 cat grid
/u01/app/grid/diag/*/*/*/trace/*.log
    {
su grid oinstall   <<<<< user name and group name for files 
      daily
      rotate 7
      compress
      copytruncate
      missingok
      nodateext
      size 20M
   }


to test !!!!
logrotate  grid -s /tmp/ostatus






now no error 

 cat /tmp/ostatus
logrotate state -- version 2
"/u01/app/grid/diag/tnslsnr/rac02/listener_scan3/trace/listener_scan3.log" 2022-11-18-6:0:0
"/u01/app/grid/diag/tnslsnr/rac02/listener_scan2/trace/listener_scan2.log" 2022-11-18-6:0:0
"/u01/app/grid/diag/tnslsnr/rac02/mgmtlsnr/trace/mgmtlsnr.log" 2022-11-18-6:4:49
"/u01/app/grid/diag/tnslsnr/rac02/listener_scan1/trace/listener_scan1.log" 2022-11-18-6:4:49
"/u01/app/grid/diag/tnslsnr/rac02/asmnet1lsnr_asm/trace/asmnet1lsnr_asm_321.log" 2022-11-18-6:4:49
"/u01/app/grid/diag/tnslsnr/rac02/asmnet1lsnr_asm/trace/asmnet1lsnr_asm_325.log" 2022-11-18-6:4:49
"/u01/app/grid/diag/apx/+apx/+APX2/trace/drc+APX2.log" 2022-11-18-6:0:0
"/u01/app/grid/diag/asmtool/user_root/host_2670455502_107/trace/alert_+ASM2.log" 2022-11-18-6:0:0
"/u01/app/grid/diag/clients/user_oracle/host_2670455502_107/trace/sqlnet.log" 2022-11-18-6:0:0
"/u01/app/grid/diag/tnslsnr/rac02/listener_test/trace/listener_test.log" 2022-11-18-6:4:49
"/u01/app/grid/diag/tnslsnr/rac02/listener/trace/listener_193.log" 2022-11-18-6:4:49
"/u01/app/grid/diag/tnslsnr/rac02/start/trace/start.log" 2022-11-18-6:0:0
"/u01/app/grid/diag/tnslsnr/rac02/asmnet1lsnr_asm/trace/asmnet1lsnr_asm.log" 2022-11-18-6:4:49
"/u01/app/grid/diag/tnslsnr/rac02/asmnet1lsnr_asm/trace/asmnet1lsnr_asm_322.log" 2022-11-18-6:4:49
"/u01/app/grid/diag/tnslsnr/rac02/asmnet1lsnr_asm/trace/asmnet1lsnr_asm_326.log" 2022-11-18-6:4:49
"/u01/app/grid/diag/kfod/rac02/kfod/trace/alert_+ASM2.log" 2022-11-18-6:0:0
"/u01/app/grid/diag/crs/rac02/crs/trace/alert.log" 2022-11-18-6:4:49
"/u01/app/grid/diag/tnslsnr/rac02/listener/trace/listener_194.log" 2022-11-18-6:4:49
"/u01/app/grid/diag/tnslsnr/rac02/listener/trace/listener.log" 2022-11-18-6:4:49
"/u01/app/grid/diag/clients/user_grid/host_2670455502_107/trace/sqlnet.log" 2022-11-18-6:0:0
"/u01/app/grid/diag/tnslsnr/rac02/asmnet1lsnr_asm/trace/asmnet1lsnr_asm_323.log" 2022-11-18-6:4:49
"/u01/app/grid/diag/rdbms/_mgmtdb/-MGMTDB/trace/alert_-MGMTDB.log" 2022-11-18-6:4:49
"/u01/app/grid/diag/clients/user_grid/host_2670455502_82/trace/sqlnet.log" 2022-11-18-6:0:0
"/u01/app/grid/diag/asmtool/user_root/host_2670455502_110/trace/alert.log" 2022-11-18-6:0:0
"/u01/app/grid/diag/asmtool/user_grid/host_2670455502_107/trace/alert_+ASM2.log" 2022-11-18-6:0:0
"/u01/app/grid/diag/clients/user_grid/host_2670455502_110/trace/sqlnet.log" 2022-11-18-6:0:0
"/u01/app/grid/diag/rdbms/_mgmtdb/-MGMTDB/trace/drc-MGMTDB.log" 2022-11-18-6:0:0
"/u01/app/grid/diag/apx/+apx/+APX2/trace/alert_+APX2.log" 2022-11-18-6:0:0
"/u01/app/grid/diag/asm/+asm/+ASM2/trace/alert_+ASM2.log" 2022-11-18-6:0:0
"/u01/app/grid/diag/tnslsnr/rac02/asmnet1lsnr_asm/trace/asmnet1lsnr_asm_324.log" 2022-11-18-6:4:49
"/u01/app/grid/diag/asm/+asm/+ASM2/trace/drc+ASM2.log" 2022-11-18-6:0:0
[root@rac02 logrotate.d]#

Oracle DBA

anuj blog Archive