Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2004
    Posts
    268

    Unanswered: Restore latest backup

    Linux RHEL 5.5 - DB2 V8.2 FP14

    I am trying to automate a process that needs to restore the production database from the latest backup that is in a directory with previous backups. There is more that 1 backup file in the directory for the same database but I want to restore the latest.

    Is there a DB2 command to do this ?

    Thanks

  2. #2
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    There is no such command, but you can find the latest backup timestamp by selecting from the table function ADMIN_LIST_HIST(), then use the timestamp to invoke RESTORE with the TAKEN AT clause.

  3. #3
    Join Date
    Oct 2004
    Posts
    268
    Thanks for the suggestion. I got the taken at value but having problems placing in the restore command.................

  4. #4
    Join Date
    Oct 2004
    Posts
    268
    Got it...................

    db2 -x "select 'db2 restore db TESTDB from /home/db2server01/backup/ taken at', (SELECT START_TIME FROM TABLE(SYSPROC.ADMIN_LIST_HIST()) AS backup_time where OPERATION='B' Order by START_TIME desc fetch first 1 rows only), 'replace existing;' FROM SYSIBM.SYSDUMMY1"
    Last edited by mdx34; 08-30-10 at 16:31.

Posting Permissions

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