Results 1 to 10 of 10
  1. #1
    Join Date
    Dec 2009
    Location
    Montreal, QC
    Posts
    5

    Question Unanswered: Issue With Redirected Restore

    Scenario:
    Typically I receive snapshots of a production database and restore them in another environment for testing. This specific situation is the same as any other, except when I run the redirected restore, I get some errors. My process is to create a user, then an instance with the same name, create the directory for the database under the instance (e.g. /home/data/$INSTANCE/$DATABASE_2) and launch the restore script, pointing to the snapshot I received.


    Environment:
    DB2 V9.1 on AIX 6.1 TL02


    Restore Script:
    db2 "RESTORE DATABAE $DATABASE_1 TAKEN AT $SNAPSHOT TO '/home/data/$INSTANCE/$DATABASE_2' INTO $DATABASE_2 WITH 2 BUFFERS BUFFER 1024 REDIRECT WITHOUT ROLLING FORWARD WITHOUT PROMPTING"

    db2 "set tablespace containers for 0 using (path '/home/data/$INSTANCE/$DATABASE_2/space1')"
    db2 "set tablespace containers for 1 using (path '/home/data/$INSTANCE/$DATABASE_2/space2')"
    db2 "set tablespace containers..
    .
    .
    db2 restore db $DATABASE_1 continue
    db2 rollforward database $DATABASE_2 to end of logs and stop


    Errors:
    Once the script reaches the set tablespace (verified by running manually, one by one) for every "set tablespace..." command I receive
    SQL1024N A database connection does not exist. SQLSTATE=08003
    SQL1024N A database connection does not exist. SQLSTATE=08003
    .
    .

    Once at the "restore db $DATABASE_1 continue" I get
    SQL2008N The callerac parameter is not within valid range or the requested
    action is out of sequence.


    I don't understand why when I "set tablespace containers..." it is looking for a connection to the database that doesn't exist yet. I think once the SQL1024N errors are addressed, the SQL2008N will also disappear. Anyway, I've already checked the DB2 doc, didn't see much, so any additional help would be appreciated.

  2. #2
    Join Date
    Dec 2009
    Posts
    1

    Hello

    Excellent ! I like it very much

  3. #3
    Join Date
    Aug 2008
    Location
    Toronto, Canada
    Posts
    2,367
    Verify that the first step of redirected restore (restore... redirect) doesn't generate any error.

  4. #4
    Join Date
    Dec 2009
    Location
    Montreal, QC
    Posts
    5
    When running the first step (redirected restore), I get this:
    SQL2537N Roll-forward is required following the Restore.

    But at the end of the script, after the restore, I have:
    db2 rollforward database $DATABASE_2 to end of logs and stop

  5. #5
    Join Date
    Aug 2008
    Location
    Toronto, Canada
    Posts
    2,367
    remove "WITHOUT ROLLING FORWARD" from the first step.

  6. #6
    Join Date
    Dec 2009
    Location
    Montreal, QC
    Posts
    5
    For now, it appears to be working...That is the set tablespace containers completed successfully, the restore continue was invoked and the directory is growing.

    Can you explain why removing "WITHOUT ROLLING FORWARD" fixed this issue?

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

    Can you explain why removing "WITHOUT ROLLING FORWARD" fixed this issue?
    Possibly you were restoring from an online backup, which requires rollforward operation. Only offline backups can be restored without rolling forward.
    ---
    "It does not work" is not a valid problem statement.

  8. #8
    Join Date
    Dec 2009
    Location
    Montreal, QC
    Posts
    5
    After the restore, am I supposed to run:
    db2 rollforward database $DATABASE_2 to end of logs and stop?

    If so, I am receiving errors, the rollforward fails. Will post specific SQL####N on failed rollforward tomorrow. If I recall correctly it was SQL6059N.

    I get a SQL1117N when trying to connect after rollforward failed. So I tried:
    db2 rollforward database $DATABASE_2 stop as well as db2 rollforard database $DATABASE_2 complete
    neither would bring the db out of rollforward pending state.

    Also, there did not appear to be any log files. I have dropped the database and restored again specifying the logtarget path:
    db2 "RESTORE DATABAE $DATABASE_1 TAKEN AT $SNAPSHOT TO '/home/data/$INSTANCE/$DATABASE_2' INTO $DATABASE_2 logtarget $LOGPATH WITH 2 BUFFERS BUFFER 1024 WITHOUT ROLLING FORWARD REDIRECT WITHOUT PROMPTING"

    The state of the database tomorrow should be restore completed successfully...so is it required to rollforward after the restore?

    Sorry for the delay in responses, it is a 12 hour import.
    Last edited by ca1cu1on; 12-17-09 at 22:41.

  9. #9
    Join Date
    Aug 2008
    Location
    Toronto, Canada
    Posts
    2,367
    You have to issue the rollforward db command if you're restoring from an online image. If the logs are included in the image, then you can restore them during db restore or as a separate step and then use them during rollforward (specify "overflow log path" and "noretrieve" parameters). Please see example on p.14 here:
    http://download.boulder.ibm.com/ibmd...RFAQ_0508I.pdf

  10. #10
    Join Date
    Dec 2009
    Location
    Montreal, QC
    Posts
    5
    First, the database restored successfully, as did the rollforward. Thank you for the assistance!

    However, when executing the command:
    db2 rollforward db $DBNAME to end of logs and stop overflow log path ($LOGTARGET)
    as shown in the example FAQ link, did not work. I would receive a syntax error of `(' not expected, so I took off the '()', then I got a syntax error that expected token missing `('.

    That didn't make sense, so I go into db2 command and execute the same command
    db2 => rollforward db $DBNAME to end of logs and stop overflow log path ($LOGTARGET)
    which also didn't work.

    DB2 claimed LOGTARGET was an invalid path, check filesystem, ownership...well it is in the filesystem housing the instance, in a directory under the instance and owned by the instance.

    So I just ran db2 => rollforward db $DBNAME to end of logs and stop
    And it worked...presumably because I restored again with LOGTARGET listed in restore command?

    Anyway, thanks again for your assistance.

Posting Permissions

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