Results 1 to 7 of 7
  1. #1
    Join Date
    Dec 2007
    Posts
    288

    Unanswered: Redirect a Restore to a new database

    We are running DB2 UDB V8 on Windows. Trying to figure out how to re-direct a restore to a new Database in the same instance.

    Do I create a new DB first? Should I let the restore create the database? Can anyone guide me through the steps neede to do this?

  2. #2
    Join Date
    Nov 2005
    Location
    IL
    Posts
    557
    Let redirect do the work. Look up RESTORE command. Followed by SET TABLESPACE CONTAINERS command. Followed by ROLLFORWARD.
    --
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows

    DB2 v9.7.0.6 os 6.1.0.0

  3. #3
    Join Date
    Dec 2007
    Posts
    288
    Thanks.. so there is no way to do it through the control center? I was thinking create a new empty database and then restore a backup from the source database to it... but it won't let me.

  4. #4
    Join Date
    Nov 2005
    Location
    IL
    Posts
    557
    The whole idea about a restore is that you hae no database to begin with. If you create something how is it going to work?

    Your other choice, which I hope you do not take, is to create blank db and then do db2move to export and import.
    --
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows

    DB2 v9.7.0.6 os 6.1.0.0

  5. #5
    Join Date
    Jan 2007
    Location
    Jena, Germany
    Posts
    2,721
    You can restore to an existing database, that will effectively wipe out the existing db (including all containers and tablespaces). So why waste the time in creating it in the first place?
    Knut Stolze
    IBM DB2 Analytics Accelerator
    IBM Germany Research & Development

  6. #6
    Join Date
    Dec 2007
    Posts
    288
    Than you!! I guess what I'm confused about is the CONTAINERS tab when I do a restore to a NEW Database. Do I have to specify new containers for a redirected restore?

    Options are *Enable table space containers to be redirected during restore operation.
    *Allow new container creation during roll-forward

    Then it asks you to select the table space with containers to be redirected and then to specify the containers..

    I just want to make sure that I'm doing it correctly so that I'm not overwriting anything in the source DB and just making a copy of it.. Sorry if this all sounds dumb.. but I'm a true newbie at UDB

  7. #7
    Join Date
    Aug 2002
    Posts
    76
    It will not let you rewrite a container in the new database over the old one. It will recognize the contention and the tablespace with be in a Must Have Containers Defined state until you successfully complete the redirect.

    Here is a sample of one i did last week

    db2 "restore db reportt into kratz redirect"
    db2 "set tablespace containers for 0 USING (Path '/u03/SHAZAMD1/KSYSCAT/SQLT0000.0')"
    db2 "set tablespace containers for 25 USING (File '/u03/SHAZAMD1/KRATZTS' 384000 )"
    db2 "set tablespace containers for 1 USING (File '/u03/SHAZAMD1/acktempSpaceTs01' 512032)"
    db2 "set tablespace containers for 3 USING (Path '/u03/SHAZAMD1/KUSERSPACE/QCTEMPTS')"
    db2 "set tablespace containers for 6 USING (Path '/u03/SHAZAMD1/KUSERSPACE/SQLT0001.0')"
    db2 "set tablespace containers for 18 USING (Path '/u03/SHAZAMD1/KUSERSPACE/temp32')"
    db2 restore db reportt continue

    So you do the restore redirect first. Then you set containers for the tablespaces you want to redirect, then you tell it to continue. Note on the continue, you are continuing a restore against the original db name and not the source db name.

Posting Permissions

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