Three ways To trim Alert logs in oracle



Oracle Alert logs contain chronological list of events in a database , there are times when you need to clean some contents of an alert log or to move it some where , to free up space , if you need more on Alert log please check ALert log. 

Here are three different ways to clean contents of Alert logs in Linux :-


1.Using ADRCI utility

ADRCI utility can be used to purge Alert logs and trace files , for example :


Deleting previous ALERT files created before 3600 minutes(1 day) in specified home directory:
  steps :-

    1. first show a list of home directories from which to delete logs

     2. set the directory from which you want to delete the logs
      

     3. run purge command 

2. CLEAR ALERT LOG FILE AND TRACE FILES MANUALLY

we may need to clear alert log file contents manually  in the following cases:
1.When size of Alert log size gets larger 
If alert log file gets too large you have different  options to handle it:    
A)Trim some contents from alert log file 
If you want to keep most recent entries in the alert log just trim obsolete records off the alert log file
      =>   Paste the last certain number of lines of the alert log onto a second file

   
=>  Copy the transitional file back to the alert log with force option



B) Clear all contents from the alert log file  

Whenever you want to clear alert log in a hurry, you can empty all content of alert  log
  Copy the alert log if you need for troubleshooting purpose
$ cp alert_vmsdb.log alert_vms.log.bak
Clear the log file(different options):
    i) $ cat /dev/null > alert_vmsdb.log1954398
    ii) $echo ""  > alert_vmsdb.log
    iii) truncate -s 0 alert_vmsdb.log
     vi) true > alert_vmsdb.log
C) Delete/remove the alert log file totally (oracle will create it again when needed) 



No comments:

Post a Comment