Skip to Content
avatar image
Former Member

Restore sap db2 db from TSM storage manager usig different db name ?

Hi,

What I need to do is to restode backed up sap db2 db using different db name. For example db A is backed up to TSM and I need to restore it as db B. Of coure db structure should be the same.

Anyone did this before ?

Any links involving this issue ?

Please help !!! I really need to do this.

thanks

Vilius

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

5 Answers

  • avatar image
    Former Member
    Aug 05, 2008 at 04:42 PM

    Hello,

    there are two alternatives to rename a database:

    - 1) rename database using redirected restore

    - 2) rename database without any restore but using db2relocatedb

    1) Rename database using redirected restore

    it does not matter if restoring to the same or to another server if the operting system and db2 version (not fixpack) of source and target is the same.

    The statement "\[...] but the restore command does not include a database rename \[...]" is nearly correct. The restore statement has no parameter named "RENAME", correct. But there is a parameter named "INTO" doing a rename of the database during the restore. The restore command using parameter "INTO" looks like that:

    RESTORE DATABASE <source database>
    USE TSM
    ...
    INTO <target database>
    ...
    

    If your database instance runs with DB2 9.1 you could generate the whole redirected restore script with the following restore syntax:

    RESTORE DATABASE <source database>
    USE TSM
    ...
    INTO <target database>
    ...
    GENERATE SCRIPT <generated script>
    ...
    

    The generated script includes the following steps:

    - begin of REDIRECTED RESTORE

    - SET TABLESPACE CONTAINER clause

    - continue REDIRECTED RESTORE to the database name and physical containers

    If the database path and container path are the same as before like in your case, then you could use the generated script to restore the database to a new name without any changes.

    If the path are not the same you have to change the source container paths into target container paths in the generated script.

    After that you could start the redirected restore with the generated script:

    db2 -svtf <generated script> -z <output>
    

    After completion of the restore you have to extract all the archive logs from tsm to the target database and copy them to the configured log directory.

    db2adutl EXTRACT LOGS BETWEEN S<firstlog> and s<lastlog> DB <source database> NODENAME <source node> PASSWORD <password from target node>
    

    Then you have to rollforward the target database to the requested point in time.

    ROLLFORWARD DATABASE <target database> TO <point in time> USING LOCAL TIME
    ROLLFORWARD DATABASE <target database> complete
    

    Now you have to reconfigure your new restored database and do post copy tasks, i.e.:

    - recreate event monitors

    - grant privileges

    - run db6_update_db.sh

    - rename tablespaces and customize data classes (for example RENAME TABLESPACE SID#FACTD TO TID#FACTD or SID#FACTD TO PSAPFACTD).

    2) Rename database without any restore but using db2relocatedb

    An alternative to rename the database without doing any restore is to use db2relocatedb.

    Just create a relocate file i.e. relocate.cfg like that: [db2relocatedb - Relocate database command|http://publib.boulder.ibm.com/infocenter/db2luw/v9/topic/com.ibm.db2.udb.admin.doc/doc/r0004500.htm?resultof=%22%72%65%6c%6f%63%61%74%65%22%20%22%72%65%6c%6f%63%61%22%20]

    DB_NAME=<source database>,<target database>
    DB_PATH=/db2/<SID>
    INSTANCE=db2<sid>
    NODENUM=0
    

    Afterwards rename the database with the following command:

    db2relocatedb -f relocate.cfg
    

    Regards

    Gerhard Paulus

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 23, 2008 at 10:37 AM

    Hi,

    what you want to do is a "redirected restore".

    This procedure is supported by the tool brdb6brt from the sap kernel. A description on how to use can be found in the Database Administration Guide for DB2 UDB

    kind regards

    Thomas

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 23, 2008 at 10:39 AM
    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 23, 2008 at 03:01 PM

    Hi,

    you did not say if you are restoring to same server (O/S) or another server (O/S).

    we don't use, TSM, we use Netbackup.

    We frequently refresh test systems by restoring our production database to test servers.

    meaning database PRD on production server restored to test server as database QAS.... but the restore command does not include a database rename... we have to actually restore PRD to PRD on test server, then use the relocatedb utility to rename database PRD to database QAS.

    you may have to do something similar.

    good luck,

    Norma Jean

    Add comment
    10|10000 characters needed characters exceeded

  • Aug 05, 2008 at 09:12 PM

    and do not forget to check sapnotes 91976 & 122222 😉

    GreetZ, AH

    Add comment
    10|10000 characters needed characters exceeded