Results 1 to 10 of 10

Thread: db2 backup

  1. #1
    Join Date
    May 2010
    Posts
    5

    Unanswered: 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.

  2. #2
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    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

  3. #3
    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?

  4. #4
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    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

  5. #5
    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.

  6. #6
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    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

  7. #7
    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?

  8. #8
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    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

  9. #9
    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?

  10. #10
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •