Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2012
    Posts
    19

    Unanswered: Rollforward to db with another name

    Lets say I need to restore a database with another name and rollforward it. I can restore database using another name using word INTO. But when I try to rollforward, it can't find transaction logs. Rollforward with the same name works fine

    Here are the commands I use:

    RESTORE DATABASE dbname
    FROM "D:\backup"
    TO D:
    INTO dbname_2
    WITH 2 BUFFERS
    BUFFER 1024
    PARALLELISM 1
    COMPRLIB C:\SQLLIB\BIN\db2compr.dll
    WITHOUT PROMPTING;

    ROLLFORWARD DATABASE dbname_2
    TO 2012-02-16-12.30.00.000000
    AND COMPLETE
    OVERFLOW LOG PATH ("D:\backup\tlogs");

  2. #2
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    In the RESTORE command, you can specify the LOGTARGET path and DB2 will copy logs that are contained in the backup to the path specified. Then use that same path in the rollforward command. Path must be empty before you start, and you can only rollforward to "end of backup" (unless you copy other log files from the other database to the same path).
    M. A. Feldman
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows
    IBM Certified DBA on DB2 for z/OS and OS/390

  3. #3
    Join Date
    Feb 2012
    Posts
    19
    Say we made the backup on 2012-02-16-01.00.00.000000. What I want to do is to restore the database to the afternoon of the next day using transaction logs.

    As far as I understand INCLUDE LOGS together with LOGTARGET allows you to rollforward from the point when backup started to the point when it ended. It's helpful only in situation when your backup is huge and is made for a considerably long time.

  4. #4
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    Quote Originally Posted by Harmont View Post
    Say we made the backup on 2012-02-16-01.00.00.000000. What I want to do is to restore the database to the afternoon of the next day using transaction logs.

    As far as I understand INCLUDE LOGS together with LOGTARGET allows you to rollforward from the point when backup started to the point when it ended. It's helpful only in situation when your backup is huge and is made for a considerably long time.
    You are correct that you cannot rollforward past the end of backup using only the "included" logs that come with the online backup (assuming logs are in the online backup, which is now the default).

    To rollforward past the end of backup (or if you are restoring an offline backup and want to rollforward), you will have to copy logs from the other database (with the other name) from the active and/or archive log paths of that other database.

    If you are restoring an online backup, you must rollforward to at least end of backup in order to connect to the database (which is why the minimum necessary logs are now included with the backup by default).
    M. A. Feldman
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows
    IBM Certified DBA on DB2 for z/OS and OS/390

  5. #5
    Join Date
    Feb 2012
    Posts
    19
    Quote Originally Posted by Marcus_A View Post
    To rollforward past the end of backup, you will have to copy logs from the other database (with the other name) from the active and/or archive log paths of that other database.
    As you can see from command I use to rollforward, there is an OVERFLOW LOG PATH clause which points to the transaction logs. I just copied them from the production server.

    The weird thing here is that last week it didn't work. I've just tried that again and rollforward went ok. Dunno why. Anyway, thanks for the help.

Posting Permissions

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