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 backup

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-14-10, 09:08
oliver1 oliver1 is offline
Registered User
 
Join Date: May 2010
Posts: 5
db2 backup

Hi All,

Sorry a very newbie post. We are running db2 v9.1
Looking through the backup wizard I have online and offline backups.

The db2 wizard allows me to select online backups and to include the log file created during the backup process.

Is this file complete, do i need anything else if I wanted to for example restore this database to another machine? Or do I also need log files from the log file directory?

Now once I have done this online backup can I delete some log files from the log file directory and if so how do I know which ones I can delete. Or do I need to do an offline backup before I can delete log files?

To clarify the nature of the data in the database we are happy to backup the database everynight and we have no problem losing a days worth of data in the event of a server crash, so I have no need of log files to restore the data to various points in time.

Thanks in advance for any help.
Reply With Quote
  #2 (permalink)  
Old 05-14-10, 10:23
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
IF you use INCLUDE LOGS in the backup command, you will be able to take the backup image to another machine and restore to a working database without anything else.

Under no circumstances should you delete log files from the active log directory. You can delete then from the archive directory. And only delete logs files in the archive that are older than your last 3 backups.

Andy
Reply With Quote
  #3 (permalink)  
Old 05-14-10, 10:37
oliver1 oliver1 is offline
Registered User
 
Join Date: May 2010
Posts: 5
why do I need the log files though

Why do I need the previous log files anymore? As at no point do I want to role the database back to a point before the backup was taken. So aren't all the log files older than the backup pointless now?
Reply With Quote
  #4 (permalink)  
Old 05-14-10, 10:46
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
You need them for crash recovery. You never really know which log files are needed for this so that is why it is a good idea not to delete log files too soon, even from the archive (because they can be recalled if it is determined that they are needed).
If you delete the log files from the active log directory you can destroy your database. This is really something you should not consider. The space you are trying to save is minor compared to the viability of the database.

Andy
Reply With Quote
  #5 (permalink)  
Old 05-14-10, 11:04
oliver1 oliver1 is offline
Registered User
 
Join Date: May 2010
Posts: 5
) Well it would be minor apart from our poor db2 database has had no maintence or backups, for roughly a year.
So I have 100gb worth of logfiles.
Am trying to blitz it today and tonight, and set up a nice scheduled backup and hopefully get rid of my log files going back to July 2009.
Reply With Quote
  #6 (permalink)  
Old 05-14-10, 11:18
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
I assume that your archive logs are going to a different directory than your active log directory. If not, the you need to set up LOGARCHMETH1 (do it).

Do this:

1) Start the nightly backups.
2) After you have 3 backups (in case any one of them is corrupted), start deleting the log files from the archive directory that are older than your 3rd newest backup.

If you did not have LOGARCHMETH1 setup, you will eventually notice a gap of log files in the active directory. After about a week you should be able to delete the older ones before the gap.

Andy
Reply With Quote
  #7 (permalink)  
Old 05-14-10, 11:41
oliver1 oliver1 is offline
Registered User
 
Join Date: May 2010
Posts: 5
Thanks. Have set up logarchmeth1 as follows
update db cfg for cti_data using LOGARCHMETH1 DISK:c:\archivedlogfiles\
Finaly do both online and offline backups cause logfiles to be archived?
Reply With Quote
  #8 (permalink)  
Old 05-14-10, 11:51
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
Neither cause log file to be archived. Log files are archived whenever they become full or they are truncated. Both backup schemes may cause a log file to be truncated, but not necessarily.

Andy
Reply With Quote
  #9 (permalink)  
Old 05-14-10, 11:58
oliver1 oliver1 is offline
Registered User
 
Join Date: May 2010
Posts: 5
Okay last question honest, and thank you very much for your help so far.
Do I have to restart the service before the update statement I applied before takes effect? Or will log files just start appearing?
Reply With Quote
  #10 (permalink)  
Old 05-14-10, 12:57
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
Quote:
Originally Posted by oliver1 View Post
Okay last question honest, and thank you very much for your help so far.
Do I have to restart the service before the update statement I applied before takes effect? Or will log files just start appearing?
The database has to be restarted when you change LOGARCHMETH1. Disconnecting the users and deactivating the database (if it was explicitly activated) is all that is necessary.

Andy
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