Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2007
    Posts
    47

    Unanswered: backup database include / exclude logs

    I am trying to understand include versus exclude on the backup database command. They seem to be more of a convenience to use include with the backup so you don't have to copy logs and tell it where they are during the restore?

    This is db2 v8 FP 12.

  2. #2
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    The INCLUDE LOGS clause is only valid for online backups. It will add the necessary log files to the backup to insure that the restored database can be rollforward to a minimum consistent state. If they are excluded (the default), in order to get a restored database to rollforward, the logs must be retrieved manually, or with the userexit/logarchmeth1.

    Andy

  3. #3
    Join Date
    Feb 2007
    Posts
    47
    Quote Originally Posted by ARWinner
    The INCLUDE LOGS clause is only valid for online backups. It will add the necessary log files to the backup to insure that the restored database can be rollforward to a minimum consistent state. If they are excluded (the default), in order to get a restored database to rollforward, the logs must be retrieved manually, or with the userexit/logarchmeth1.

    Andy
    ok, I did a

    backup database mydb online to e:\sqlbackups\mydb compress include logs;

    Then I did a:


    TERMINATE;

    CONNECT RESET;

    RESTORE DATABASE mydb FROM "E:\sqlbackups\mydb" TAKEN AT 20090319084303 TO "E:" INTO mydb REDIRECT;

    SET TABLESPACE CONTAINERS FOR 0 IGNORE ROLLFORWARD CONTAINER OPERATIONS USING (PATH "E:\DB2\NODE0000\SQL00006\SQLT0000.0");

    SET TABLESPACE CONTAINERS FOR 1 IGNORE ROLLFORWARD CONTAINER OPERATIONS USING (PATH "E:\DB2\NODE0000\SQL00006\SQLT0001.0");

    SET TABLESPACE CONTAINERS FOR 2 IGNORE ROLLFORWARD CONTAINER OPERATIONS USING (PATH "E:\DB2\NODE0000\SQL00006\SQLT0002.0");

    SET TABLESPACE CONTAINERS FOR 3 IGNORE ROLLFORWARD CONTAINER OPERATIONS USING (PATH "e:\db2\NODE0000\SQL00006\SYSTOOLSPACE");

    SET TABLESPACE CONTAINERS FOR 4 IGNORE ROLLFORWARD CONTAINER OPERATIONS USING (PATH "E:\DB2\NODE0000\SQL00006\SYSTOOLSTMPSPACE");

    RESTORE DATABASE mydb CONTINUE;

    ROLLFORWARD DATABASE mydb TO end OF LOGS AND COMPLETE;

    ===

    Unfortunately, I don't have the output of the rollforward, but we did have a user adding some data in during the online backup. I dropped the db and restore from that backup. It had that users data in the restore. Since this worked, it seems that I did not need logtarget and logs?

    Just an FYI, the prod db uses 230 gigs of disk. Backup is around 168 gig.

  4. #4
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    If you restore the DB to the same location (E: ) that it originally resided in, and you did not move the location of the log files, it is possible that the log files necessary to rollforward were already where they needed to be--the logs were hanging around from the backup.

    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
  •