Results 1 to 7 of 7
  1. #1
    Join Date
    Aug 2011
    Location
    Columbus, OH
    Posts
    55

    Question Unanswered: Ideas for automating a monthly redirected restore

    Hello DB2 Friends!

    I am trying to automate a monthly process to load a test database from a prod backup via a redirected restore. Both the backup and the restore are executed using a korn shell script. The backup job is kicked off by a scheduler application (Control M) but I can't have it kick off the restore too because I have to edit the restore script giving it the timestamp of the backup image.

    Does anyone know how I can read the sysout from the backup job, get the time stamp to pass to the redirected restore as a parameter.

    I've checked with our scheduler application and it doesn't seem possible, so I'm thinking I may have to script something. I can grunt through some scritpting, but I was wondering if there were any better ideas.

    Thanks!!!!

  2. #2
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    Do the backup to an empty directory and then you can omit the TAKEN AT clause on the restore. You can rollforward to END OF BACKUP and STOP NORETRIEVE.

    I assume this is DB2 LUW, but your use of the term sysout makes me wonder (or maybe you are an ex-mainframe DBA?).
    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
    Aug 2011
    Location
    Columbus, OH
    Posts
    55

    Thumbs up

    Thanks, Marcus_A. This is exactly what I was looking for. This is for DB2 LUW, which I didn't specify. I am an ex-mainframe developer, that's where sysout-speak comes from. Thanks again

  4. #4
    Join Date
    Aug 2011
    Location
    Columbus, OH
    Posts
    55
    [QUOTE=Marcus_A;6518943] You can rollforward to END OF BACKUP and STOP NORETRIEVE.
    QUOTE]

    Marcus_A, my current redirected restore does "rollforward db scdtptst to end of logs and complete" I'm not sure I understand the difference with what you mentioned.

  5. #5
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    Quote Originally Posted by Tracygirl View Post
    Marcus_A, my current redirected restore does "rollforward db scdtptst to end of logs and complete" I'm not sure I understand the difference with what you mentioned.
    END OF BACKUP is the minimum rollforward point that must be done when restoring an online backup. If you have additional logs and want to go to end of logs, that is fine.
    Last edited by Marcus_A; 09-20-11 at 02:10.
    M. A. Feldman
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows
    IBM Certified DBA on DB2 for z/OS and OS/390

  6. #6
    Join Date
    Aug 2008
    Location
    Toronto, Canada
    Posts
    2,367
    Another option is to extract the timestamp from the history file and pass it to the restore. Something similar to:

    db2 "restore db test taken at `db2 list history backup all for db test | grep 'B D' | head -1 | cut -c 9-22`"

  7. #7
    Join Date
    Aug 2008
    Location
    Toronto, Canada
    Posts
    2,367
    Actually, the history file on your test server won't have this info until the db is restored. So, the history file needs to be restored first. Or just get the timestamp from your backup job or use Marcus's method.

Posting Permissions

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