Pages

Wednesday, February 12, 2020

Trick to remove and trim alertlog file in oracle

Trick to remove and trim alertlog file in oracle


[root@rac1 trace]# du -sh alert_ORCL1.log
148K    alert_ORCL1.log
[root@rac1 trace]# pwd
/u02/app/oracle/diag/rdbms/orcl1/ORCL1/trace
[root@rac1 trace]# cat /dev/null > alert_ORCL1.log
[root@rac1 trace]# du -sh alert_ORCL1.log
0       alert_ORCL1.log

Below is the another terminal where i already opened the alertlog:

[root@rac1 trace]# tail -f alert_ORCL1.log

Wed Feb 12 23:07:24 2020
Begin automatic SQL Tuning Advisor run for special tuning task  "SYS_AUTO_SQL_TUNING_TASK"
End automatic SQL Tuning Advisor run for special tuning task  "SYS_AUTO_SQL_TUNING_TASK"
Wed Feb 12 23:12:48 2020
Resize operation completed for file# 3, old size 645120K, new size 655360K
tail: alert_ORCL1.log: file truncated
Wed Feb 12 23:16:17 2020
Thread 1 advanced to log sequence 22 (LGWR switch)
  Current log# 1 seq# 22 mem# 0: /u02/app/oracle/oradata/ORCL1/redo01.log
Wed Feb 12 23:16:17 2020
Archived Log entry 10 added for thread 1 sequence 21 ID 0x54684e49 dest 1:

If you remove the alertlogfile during the database up and running nothing will happen below are the commands after you removing the alertlog it will automatically created another except "alter system checkpoint" command.

alter system switch logfile;
alter database backup controlfile to trace;
alter database begin backup;

Note:

Before implementing on production, please test on development or UAT boxes.

No comments:

Post a Comment