Operating System - HP-UX
1748179 Members
4093 Online
108758 Solutions
New Discussion юеВ

Re: When does Oracle create a new alert log?

 
SOLVED
Go to solution
Tony Williams
Regular Advisor

When does Oracle create a new alert log?

Hi,

When does Oracle create a new alert log? Also how often does this happen?
8 REPLIES 8
Solution

Re: When does Oracle create a new alert log?

Oracle *never* creates a new alert log - it just keeps on writing to the same file.

If you want to trim the log you could do something like:

cp alert_MYDB.log alert_MYDB.log.old
>alert_MYDB.log

(can't remembet the exact format of the alert log name)

HTH

Duncan

I am an HPE Employee
Accept or Kudo
Hein van den Heuvel
Honored Contributor

Re: When does Oracle create a new alert log?

fwiw,

No need to copy.

Just rename (mv) to a dated version.
Oracle will create a fresh version when it needs it.

Regards,
Hein.

Frank de Vries
Respected Contributor

Re: When does Oracle create a new alert log?

I found the safest way to copy the alert_log
and then just empty the existing one

by

>alert.log

or

cat /dev/null > alert.log


Look before you leap
Carlos Zoller
Frequent Advisor

Re: When does Oracle create a new alert log?

Hello,

Every sugestions you have received are accurate.

To give more details about your question, Oracle will write new records to the alert_.log file everytime:

1. Database or instance is stopped/start
2. Log writer process switches to a new Redo Log file.
3. ARCn processes create a new archive log file (if you are using the archiver option).
4. The database structure is modified (datafile creation for example).
5. A database error condition is found.

I would suggest not to delete this file, but to keep at least a couple of months of history. This might be very useful by the time you need to get support from Oracle.

Hope this helps.
Tony Williams
Regular Advisor

Re: When does Oracle create a new alert log?

Thanks for all of the info. My answer was that the log should never be recreated. The problem was that one of our alert logs was brand new and we could not explain why. It turns out that someone wrote a script that was supposed to send the alert log to a .old and create a new one after 30 days. The script created the new one but failed to save the old one.
Tony Williams
Regular Advisor

Re: When does Oracle create a new alert log?

Thanks for all of the info. My answer was that the log should never be recreated. The problem was that one of our alert logs was brand new and we could not explain why. It turns out that someone wrote a script that was supposed to send the alert log to a .old and create a new one after 30 days. The script created the new one but failed to save the old one.
Hein van den Heuvel
Honored Contributor

Re: When does Oracle create a new alert log?

Frank>> I found the safest way to copy the alert_log and

Hmm... When you take a copy, bits might drop. Unlikely, but possible. Plus, now you have 2 copies for no good reason.

>> then just empty the existing one by

>alert.log
or
cat /dev/null > alert.log

Hmmm, that creates a time window between the copy and the 'emptying'. Not a big one, and unlikely to be relevant, but why take the risk when there is a no-effort, no-risk alternative ?

Rename ('mv', on the same disk) is pretty much a 1-disk-IO atomic operation.
It doesn't come any cleaner, faster or safer than that, does it now?!

After the rename you can copy the now idle file at your leisure. Leave it there to catch one more backup cycle and perhaps only delete it just before the next rename cycle.

2c,
Hein.
Frank de Vries
Respected Contributor

Re: When does Oracle create a new alert log?

Hein

Thanks for your input,
will certainly consider it.

Look before you leap