Thread: How often should a database archive its logs


Permlink Replies: 26 - Pages: 2 [ 1 2 | Next ] - Last Post: May 20, 2008 5:54 PM Last Post By: jreidy
olu

Posts: 391
Registered: 06/16/05
How often should a database archive its logs
Posted: Oct 9, 2007 8:47 AM
Click to report abuse...   Click to reply to this thread Reply
Oracle 9i, Windows 2003

Our production database archives logs every 2mins and retaining those logs is becoming a problem, I was wondering if its healthy for a database to archive log evry 2mins and if not what do i need to do.

thanks in advance
sybrandb

Posts: 5,205
Registered: 08/04/98
Re: How often should a database archive its logs
Posted: Oct 9, 2007 8:50 AM   in response to: olu in response to: olu
Click to report abuse...   Click to reply to this thread Reply
The guideline from Oracle is every 15 minutes.
You should enlarge your online redologs by a factor 7

--
Sybrand Bakker
Senior Oracle DBA
Justin Cave

Posts: 24,001
Registered: 10/11/99
Re: How often should a database archive its logs
Posted: Oct 9, 2007 8:53 AM   in response to: olu in response to: olu
Click to report abuse...   Click to reply to this thread Reply
Unless there is some recovery/ availability requirement behind generating logs this frequently, no, it's probably not a healthy thing. You probably want to resize your redo logs so that log switches happen more like every 15-30 minutes (roughly, depending on your architecture and recovery requirements) for performance reasons.

If the concern with "retaining those logs" is a disk space issue, though, archiving larger logs less frequently isn't going to help. You'd either have to buy more disk or tune whatever process(es) generate so much REDO in order to generate less REDO.

Justin
olu

Posts: 391
Registered: 06/16/05
Re: How often should a database archive its logs
Posted: Oct 9, 2007 9:01 AM   in response to: Justin Cave in response to: Justin Cave
Click to report abuse...   Click to reply to this thread Reply
But what aspect do you suggest I tune because every aspect of the database looks o.k apart from logging. Basically i don't know where to start from.
nitinpai

Posts: 9
Registered: 02/16/00
Re: How often should a database archive its logs
Posted: Oct 9, 2007 9:01 AM   in response to: Justin Cave in response to: Justin Cave
Click to report abuse...   Click to reply to this thread Reply
Ensure that none of your datafiles are in hot backup mode. Keeping them in hot backup mode can generate additional logs.

Thanks
Nitin
Simar

Posts: 664
Registered: 08/28/06
Re: How often should a database archive its logs
Posted: Oct 9, 2007 9:17 AM   in response to: olu in response to: olu
Click to report abuse...   Click to reply to this thread Reply
I will suggest you to buy extra disk or Tape Drives to backup the logs (if your oraganistion can). And use RMAN to backup and delete the archivelogs.

The other method is to use nologging clause but then it can be harmful in situations to completely recover the database. As after every nologging load it is recomended to take full backup. But if you can reload the data and can recover completely upto the point where you want with nologging clause then this may be a better option.

Hope this Helps

Regards
yingkuan

Posts: 10,896
Registered: 10/08/98
Re: How often should a database archive its logs
Posted: Oct 9, 2007 9:57 AM   in response to: olu in response to: olu
Click to report abuse...   Click to reply to this thread Reply
In a nutshell you achieve this by Sizing Redo Log Files.
Quote,
A rough guide is to switch logs at most once every twenty minutes.

The smaller your redo logfile is, the quicker it get filled and the frequent log switchs.

What's your current redo logfile size? For example, if you observe a log switch every 2min constantly, consider increase your redo logfiles 10 time in size.

Remember however, increase the size of redo logfiles will not reduce the amount of redo generated. It will help improve your database performance because every 2min log switch is not healthy for your system.

Disk storage shouldn't be a big concern nowadays, because all the cheap disks you can get. If you have problem retaining these archive logfiles, consider do more frequence backup and remove them from disk. Depends on what's your backup method.
jarneil

Posts: 241
Registered: 01/27/00
Re: How often should a database archive its logs
Posted: Oct 9, 2007 11:30 AM   in response to: olu in response to: olu
Click to report abuse...   Click to reply to this thread Reply
I'd suggest looking at archive_lag_target - this parameter forces a log switch after the time interval specified by the parameter has elapsed.

what you do is create huge redo logfiles that you know wont be switched in normal operation all that often (GB in size if you need to). You then specify how often you want to switch be that 15mins, 30mins, 1hour whatever via archive_lag_target and you are pretty much guaranteed to switch only when you want to
sybrandb

Posts: 5,205
Registered: 08/04/98
Re: How often should a database archive its logs
Posted: Oct 9, 2007 11:57 AM   in response to: jarneil in response to: jarneil
Click to report abuse...   Click to reply to this thread Reply
Your explanation is incorrect.
Archive_lag_target ensures, you have at least 1 switch per archive_lag_target minutes. If a redolog file fills up, it still switches, whatever you set archive_lag_target at.

--
Sybrand Bakker
Senior Oracle DBA
Simar

Posts: 664
Registered: 08/28/06
Re: How often should a database archive its logs
Posted: Oct 9, 2007 11:59 AM   in response to: sybrandb in response to: sybrandb
Click to report abuse...   Click to reply to this thread Reply
But is good when it doesn't fill up during off peak hours and keep the standby in synchronisation

Regards
yingkuan

Posts: 10,896
Registered: 10/08/98
Re: How often should a database archive its logs
Posted: Oct 9, 2007 1:39 PM   in response to: Simar in response to: Simar
Click to report abuse...   Click to reply to this thread Reply
But is good when it doesn't fill up during off peak
hours and keep the standby in synchronisation

Regards


True, but this thread is not about Standby/DG situation.

I don't see any benefit to force periodic log switch on stand alone instance.
jarneil

Posts: 241
Registered: 01/27/00
Re: How often should a database archive its logs
Posted: Oct 9, 2007 6:34 PM   in response to: yingkuan in response to: yingkuan
Click to report abuse...   Click to reply to this thread Reply
I would say predictability.
archive_lag_target can be used in a standalone db. If you guarantee you switch a certain frequency you can also bound the amount of data lost through media failure of your online redo logs.
howardjr

Posts: 741
Registered: 03/21/00
Re: How often should a database archive its logs
Posted: Oct 9, 2007 6:46 PM   in response to: jarneil in response to: jarneil
Click to report abuse...   Click to reply to this thread Reply
I'll second that. All my databases have very large logs which are intended not to fill up under normal operation for ages and ages. They are actually big enough to cope with a peak load we get every week: previously, we had two or three log switches recorded under the one alert log timestamp! Now, they switch every 10 minutes or so, even under the heaviest load.

So big logs are good for slowing things own under load. But I don't want to sit there with 5 hours of redo sitting in my current log during non-peak-load normal running. Therefore, I set archive_lag_target to 1800 (seconds = 30 minutes), and I know that in the worst possible case, I will only lose 30 minutes of redo.

In short, I see LOADS of advantages for using archive_lag_target even for standalone instances. Actually ESPECIALLY for standalone instances. It allows you to have extremely large logs to cope with peaks and yet STILL have a manageable amount of redo at risk in the current log under normal running conditions. And, as Jarneil said, it gives you a nice, steady and very predictable "pulse" for the database.

Highly recommended, in short. I wouldn't run a database these days WITHOUT setting it.
yingkuan

Posts: 10,896
Registered: 10/08/98
Re: How often should a database archive its logs
Posted: Oct 9, 2007 8:50 PM   in response to: howardjr in response to: howardjr
Click to report abuse...   Click to reply to this thread Reply
Well, I reserve my opinion of setting logfile size following Oracle document, see the link I posted earlier. Use FAST_START_MTTR_TARGET to control the frequency of checkpoint if recovery time is concern.

100M redo entries are 100M redo entries, I don't really care it's generated in 30mins or 30hours. It's going to take same amount of time to reapply.

If you think about it, in Standby situation time matters, you don't want a big time lag between Standby and Primary servers. That's what this parameter designed for.

Frankly, I don't see LOADS of advantages setting this in standalone. In short, it's only one advantage that you know there's at least one log switch every archive_lag_target.
howardjr

Posts: 741
Registered: 03/21/00
Re: How often should a database archive its logs
Posted: Oct 9, 2007 10:12 PM   in response to: yingkuan in response to: yingkuan
Click to report abuse...   Click to reply to this thread Reply
I did see the link you posted earlier and it doesn't say very much, does it? Apart from

(1) big logs don't affect LGWR performance
(2) small logs will cause extra checkpoints to take place apart from those you wanted to take place by setting FAST_START_MTTR_TARGET

Well, taken together, both those points mean big logs are good news and small ones aren't. Which is exactly what I said above!

Unfortunately, you've completely missed the actual point I was making. It had nothing to do with "recovery time being a concern" nor with 100M being 100M and taking the same amount of time to apply.

It was actually point (2) above. I want logs big enough not to cause rapid log switching. But I have bulk loads. Therefore, I have to have ENORMOUS logs to prevent rapid log switching during those times. In fact, on one database I am connected to right now, I have 2GB redo logs which nevertheless manage to switch every 8 minutes on a Friday night. You can imagine the frequency of log switches we had when those logs were originally created at 5MB each! And the number of redo allocation retries...

Personally, I'd like 8GB logs to get it down to a log switch every 30 minutes or so on a Friday night, but with multiple members and groups, that's just getting silly.

But now I have an enormous log that will take forever and a day to fill up and switch when I'm NOT doing bulk loads. Ordinarily, without a forced log switch, my 2GB log takes 3 days to fill up.

If I were to have a catastrophic hardware failure, I could lose my current redo log. FAST_START_MTTR_TARGET can't do anything to ameliorate that loss: flushing the dirty buffers to disk regularly doesn't protect my data, actually. In fact, there is no way to recover transactions that are sitting in the current redo log if that log is lost. Therefore, having an enormous log full of hours and hours (in my case, about 72 hours'-worth) of redo is a massive data loss risk, and not one I'm prepared to take.

Therefore, ARCHIVE_LAG_TARGET allows me to have huge logs to deal with (2) above, but not to have more than half an hour's data at risk from total loss.

I know why the parameter was invented. I can understand the word "target" in its name, after all. But the WAY it achieves its design goals is simply to force log switches. And forcing log switches is a good thing for everyone to be able to do, when appropriate, even if they're not using Data Guard and standby databases.

You are at liberty, of course, to keep on reserving your opinion, but in this case it's ill-informed and missing the point: loss of the current log is not nice and regular log switches means the effects of that unlikely event happening are completely predictable and (importantly) containable.

That's just one advantage, not "loads". But it's a huge one.
Legend
Guru Guru : 2500 - 1000000 pts
Expert Expert : 1000 - 2499 pts
Pro Pro : 500 - 999 pts
Journeyman Journeyman : 200 - 499 pts
Newbie Newbie : 0 - 199 pts
Oracle ACE Director
Oracle ACE Member
Oracle Employee ACE
Helpful Answer (5 pts)
Correct Answer (10 pts)

Point your RSS reader here for a feed of the latest messages in all forums