If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Db2 Archive Logs

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-17-09, 16:00
claskowski claskowski is offline
Registered User
 
Join Date: Apr 2007
Posts: 3
Db2 Archive Logs

I have been reviewing a number of posts on this subject and nothing I have seen has directly answered my question.

Nightly an on-line backup (include logs) is performed on our production 9.1 UDB database running on a Windows 2007 server.

Logs are archived to a seperate drive on the server. This drive is currently at 95% of capacity and there are over 3,000 log files in the archive directory. My question is -- which of these files can safely be deleted without compromising any potential restore or recovery.
Reply With Quote
  #2 (permalink)  
Old 09-17-09, 16:13
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
I would keep the logs that are about a week old, and dump the rest. You have nightly backups, so all of the last week's backups would have to be corrupted to have a problem trying to restore without the logs.

Andy
Reply With Quote
  #3 (permalink)  
Old 09-17-09, 16:32
dr_te_z dr_te_z is offline
Registered User
 
Join Date: Jan 2009
Location: Zoetermeer, Holland
Posts: 555
[QUOTE=ARWinner]and dump the rest/QUOTE]
Let DB2 do the cleaning for you; DB2 created the file so actually it is a db2-object. Use "db2 prune" for this.
DB2 Universal Database
Reply With Quote
  #4 (permalink)  
Old 09-20-09, 12:16
przytula_guy przytula_guy is offline
Registered User
 
Join Date: Apr 2006
Location: Belgium
Posts: 1,159
all depends on how far in time you would like to restore your db
if you plan to restore a db from a backup of 2 weeks old, keep all log files after this backup
__________________
Best Regards, Guy Przytula
Database Software Consultant
DB2 UDB LUW Certified V7-V8-V9-V9.7 DB Admin - Dprop..
Information Server Datastage Certified
http://www.infocura.be
Reply With Quote
  #5 (permalink)  
Old 10-15-09, 17:33
bulump bulump is offline
Registered User
 
Join Date: Oct 2009
Location: Calgary, AB Canada
Posts: 37
I've been wondering the same thing.....

I'm running nightly online backups starting with a FULL on Sunday and INCREMENTAL DELTAs Monday-Saturday.

How many log files would you recommend holding on to? A weeks worth? And we're talking about the logs inside the ~/db2i1/NODE0000/SQL00001/SQLOGDIR directory, correct?

I have a backup script I wrote for my HADR cluster, so I think I would incorporate the deletion inside there, or utilize the PRUNE command.

What say the almighty DB2 forum?
Reply With Quote
  #6 (permalink)  
Old 10-15-09, 19:56
db2girl db2girl is offline
∞∞∞∞∞∞
 
Join Date: Aug 2008
Location: Toronto, Canada
Posts: 1,816
Like Guy said, the number of logs you keep depends on how far back you may be required to go.

If your company requires you to keep backup images for 3 months, then you also need to keep the corresponding logs. The "include logs" option will only save the logs required to rollforward to a minimum point in time (end of online backup), but you need to have more logs than what's stored in the image if you need to rollforward to a different point in time.
Reply With Quote
  #7 (permalink)  
Old 10-16-09, 04:40
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
I usually is not necessary to keep logs older than the last few backups. If one is keeping backups for three months, it is unlikely that you would need ot roll forward the logs to a point in between the backups. But you must make sure that all backups have the "include logs" option for onliine backups, becasue an online backup with the logs active during the backup cannot be restored.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
  #8 (permalink)  
Old 10-16-09, 08:37
db2girl db2girl is offline
∞∞∞∞∞∞
 
Join Date: Aug 2008
Location: Toronto, Canada
Posts: 1,816
If you're 100% sure that you won't be required to rollforward to a point in between the backups, then no reason to keep all the logs. Our strategy has always been to keep the logs for as long as we required to keep the images...You never know what you may be asked to do.
Reply With Quote
  #9 (permalink)  
Old 10-16-09, 11:15
Cougar8000 Cougar8000 is offline
Registered User
 
Join Date: Nov 2005
Location: IL
Posts: 554
AS Marcus pointed out. As long as you include logs in your backup, you should be ok to smoke them.
__________________
--
IBM Certified DBA on DB2 for Linux, UNIX, and Windows

DB2 v9.1.0.2 os 5.3.0.0
Reply With Quote
  #10 (permalink)  
Old 10-16-09, 12:33
bulump bulump is offline
Registered User
 
Join Date: Oct 2009
Location: Calgary, AB Canada
Posts: 37
This is all really good stuff.

So here's a scenario, and I want to make sure I'm getting this right:

Sunday: Full Online backup include logs
Active Log # 20
Action: This will backup up the whole database and include Active Log #20

Monday: Incremental Delta backup include logs
Active Log #25
Action: This will backup the newly modified pages since Sunday's successful backup AND include Active Log #25

Tuesday: Incremental Delta backup include logs
Active Log #34
Action: This will backup the newly modified pages since Monday's successful backup AND include Active Log #34

Observation:
If business rules dictate that I only need to keep the logs responsible for restoring at any time for the previous day to present then I would keep Monday's backup, logfiles #26-#33, and Tuesday's backup

If the rules say that I don't need to backup to a certain point in time, just back it up, I would only keep Tuesday's backup and no logfiles

Is this correct?

What's the easiest way to determine which was the active log when the backup took place?
Reply With Quote
  #11 (permalink)  
Old 10-16-09, 13:46
db2girl db2girl is offline
∞∞∞∞∞∞
 
Join Date: Aug 2008
Location: Toronto, Canada
Posts: 1,816
I'll answer your last question first:

You can use "db2 list history backup all for db <db name>" and look at the "Earliest Log" and "Current Log" value. This identifies the log range you need in order to rollforward to a minimum point in time (end of backup). This log range is part of the backup image when logs are included.


I'm not too clear about your first question.. Let's say, today is Wednesday and you have to restore your db back to Tuesday. Let's say, tuesday's backup completed at 2:30am. What is the requirement? To restore your db back to Tuesday 2:30am or some later time?

If the requirement is to restore it back to 2:30am (end of backup), then you only need to have the logs that were active while the backup was executing (those logs are part of the image). If you have to restore it back to 10am (for example), then you have to have additional logs.
Reply With Quote
  #12 (permalink)  
Old 10-16-09, 14:23
Cougar8000 Cougar8000 is offline
Registered User
 
Join Date: Nov 2005
Location: IL
Posts: 554
If your Tuesday backup is good. And you crash on Wed before the back up. Technically speaking all you would need are the logs starting after your Tuesday backup. #35+. as #34- and before will be extracted from the back up image.
__________________
--
IBM Certified DBA on DB2 for Linux, UNIX, and Windows

DB2 v9.1.0.2 os 5.3.0.0
Reply With Quote
  #13 (permalink)  
Old 10-16-09, 15:57
bulump bulump is offline
Registered User
 
Join Date: Oct 2009
Location: Calgary, AB Canada
Posts: 37
ok great, I think I'm getting it...

So needless to say, if I'm backing up every night, I only need to keep that day's logs around priot to the next backup....


I know this is really easy to grasp, I don't know why I'm having such a hard time with it...

OH! And is it safe to say that the logs you get rid of on the PRIMARY server, you can get rid of the same logs on the Standby server, in a clustered environment?
Reply With Quote
  #14 (permalink)  
Old 10-16-09, 22:07
Stealth_DBA Stealth_DBA is offline
Registered User
 
Join Date: May 2009
Posts: 472
bulump, As long as you only want the ability to restore to some point in time on the previous day, all you need is:

1) Last Full Backup
2) All Delta Incremental backups since the Full backup and before the restore time.
3) All Logs since the last Delta Incremental backup before the restore time and up to and including the restore time.

For example, you might have the following timeline:

Sun 2:30 AM Full Backup
Logs
Mon 2:30 AM Delta Incremental Backup (1)
Logs
Tue 2:30 AM Delta Incremental Backup (2)
Logs
Wed 2:30 Am Delta Incremental Backup (3)
Logs

On Wed, you determine the need to restore to Tue 3:00 PM. You will need Full backup from Sun, Delta Incremental backup (1) from Mon, Delta Incremental Backup (2) from Tue, and Tue Logs.

If you never want to restore any earlier than the previous day, you could delete the Sun Logs on Tues and the Mon Logs on Wed, etc.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On