Results 1 to 6 of 6
  1. #1
    Join Date
    Jun 2012
    Posts
    6

    Unanswered: db2 logs questions

    Hey guys,

    I'm a complete novice to DB2 and as our DBA has quit, I need to try and learn the basics of it at least! Been reading some guides for it on various sites including IBM's, but have a couple of questions so far.

    How can you specify where DB2 stores its log files ? From what I can tell, it seems to be storing it in two locations:

    /logfiles-db2/db2inst1/<database name>/NODE0000/C0000000
    /home/db2inst1/db2inst1/NODE0000/SQL00001/SQLOGDIR

    In the second directory, there are 10 log files, but in the first directory, there are over 7500 log files!! As the server is rapidly running out of space, is it ok to delete the majority of the log files from the /logfiles-db2 directory, except for say, the last 50 ?

    More importantly, when I look around in the command centre, it appears as if there hasn't been any backup taken on the database since February . . . . . .(what was the DBA doing I hear you ask!!!), and I intend on taking one but I need to clear some space first or add another drive to the server.

    If I delete the log files, will this impact any backups or am I best to take a backup first before I delete the log files ? Or, does the backup rely on all those log files ? Or does it only look at the last 10 log files in the SQLOGDIR directory ? I noticed that the 10 log files are all the same size.

    Thanks for any help guys

  2. #2
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    There are two types of log files:
    - active -- needed for crash recovery;
    - archived -- needed for rollforward recovery after a restore.

    Archived logs are normally stored in a separate location, as in your case. Active logs are archived when they don't contain active transactions.

    You only need archived logs that are created after the beginning of a backup that you want to restore. If your policy is to keep only one backup image you can safely delete all archived logs that are older than that image.

    Here's one way to do it: Deleting database recovery objects using the PRUNE HISTORY command or the db2Prune API - IBM DB2 9.7 for Linux, UNIX, and Windows

    You'll find the full command syntax in the online manual as well.

  3. #3
    Join Date
    Jun 2012
    Posts
    6
    Thanks for your reply n_i.

    If I deleted the archive logs and then performed a back-up, would we still be able to restore the database if required to how it is today ? The server itself is used for pre-production testing and that's the reason it's not been backed up like the others.

    I've had a look at your link, and it looks very informative, thanks. However, I'm not sure at all on the command I would use, would it be along the lines of
    Code:
    DB2 PRUNE HISTORY 20120601 AND DELETE LOGFILE PRIOR TO S0007450.LOG
    Thanks

  4. #4
    Join Date
    Oct 2009
    Location
    221B Baker St.
    Posts
    486
    Strongly suggest the organization bring a contractor for some period of time to help with current support and to train you.

    In some crisis, you do not want to depend on a forum to keep your system running. . .

  5. #5
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    Quote Originally Posted by scaramoosh View Post

    If I deleted the archive logs and then performed a back-up, would we still be able to restore the database if required to how it is today ?
    Read the Backup and Recovery chapter here: FREE Book- Getting Started with DB2 Express-C - Wikis

    Quote Originally Posted by scaramoosh View Post
    I'm not sure at all on the command I would use, would it be along the lines of
    Code:
    DB2 PRUNE HISTORY 20120601 AND DELETE LOGFILE PRIOR TO S0007450.LOG
    Check the command syntax again. The HISTORY and LOGFILE options are mutually exclusive.

  6. #6
    Join Date
    Jun 2012
    Posts
    6
    Thanks for the link to the book n_i, is going to be bed time reading for me tonight - such an exciting life I lead!

    papadi, in an ideal world, that would be exactly what the business does. However, I've been told that the funds are not available to do so, so unfortunately, for the time being, I need to make sure it runs without issues until we recruit a replacement DBA.

    Thanks again guys.

Posting Permissions

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