Results 1 to 10 of 10
  1. #1
    Join Date
    Jan 2003
    Posts
    10

    Unanswered: Restore to New Database Prb

    Hi ,

    Thanks to everybody for your valuable suggestions to my previous queries. Right now iam facing another problem in restroing new database.

    I have a backup image file which i need to restore to a new database.

    I followed these steps.

    1. C:\>db2 create database DEVP2
    DB20000I The CREATE DATABASE command completed successfully.

    2. C:\>db2 restore database enblprd from c:\ to c:\ into DEVP2 redirect without rolling forward

    3. C:\>db2 -tvf restoreph2.cmd -z c:\Onsite\RestoreLog.log
    restoreph2.cmd -> holds the command to create table spaces.

    4. C:\>db2 restore database DEVP2 continue
    DB21080E No previous RESTORE DATABASE command with REDIRECT option was issued
    for this database alias, or the information about that command is lost.

    5. C:\>db2 restore database DEVP2
    SQL2008N The callerac parameter is not within valid range or the requested
    action is out of sequence.

    6. C:\>db2 restore database DEVP2 abort
    DB21080E No previous RESTORE DATABASE command with REDIRECT option was issued
    for this database alias, or the information about that command is lost.

    When i executed Step 4: i got the error mentioned. So i tried with the steps 5, 6. No success.

    I gave another try by performing these steps.

    1. Drop database devp2.
    2. Execute step 2
    C:\>db2 restore database enblprd from c:\ to c:\ into DEVP2 without rolling forward
    I got this error. I tried by removing the "without rolling forward" , also removed the target directory "to c:\". But still iam getting the same error.
    SQL0298N Bad container path. SQLSTATE=428B2

    How to resolve this problem. What is container path.

    Can anybody help me out in resolving this issue.

    Thanks in advance
    Babitha

  2. #2
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650

    Re: Restore to New Database Prb

    Babitha

    Create a file restore.cmd as follows:

    resotre database enblprd from etc , etc

    set tablespace containers for 1 .....

    set ...
    set ..
    ...
    ....
    ....
    ...
    set tablespace containers for n ....

    restore database enblprd contine


    From the command line, issue

    db2 -tvf restore.cmd

    This should work ..

    Cheers

    Sathyaram

  3. #3
    Join Date
    Jan 2003
    Posts
    10
    Hi Sathyaram,
    Thanks for your reply.

    I have a query in my mind. Can we use the same tablespace name for two different databases (like in Oracle)?

    Here for Database x, iam using container name as Y and Tablespaces from TB1 to TBN.

    For Database x1, iam using container name as Y1 and Tablespaces from TBX1 to TBXN.

    Even if i give a different container name and different table space name for this new database, iam getting the same error.

    Reason for this : I've taken a backup for Database x and trying to restore it to Database x1. In this case, it would have taken the backup of everything including the tablespaces (User defined) also the system tablespaces.

    In my restore.cmd iam for 4 tablespaces iam using

    c:\db2\node0000\sql00003\sqlt0000.0
    c:\db2\node0000\sql00003\sqlt0001.0
    c:\db2\node0000\sql00003\sqlt0002.0
    c:\db2\node0000\sql00003\sqlt0003.0

    I have modified sql00003 related to the new database.

    Even then iam getting error,
    SQL0298N Bad container path. SQLSTATE=428B2
    in the first step before continuing the set tablespace containers.

    Why using the above command instead of the new table space container name ?
    Why this error is occured?

    Can you tell me how to resolve this issue? Also can you please suggest me a good book for DB2 DBA to know the details.

    Thanks & Regards,
    Babitha.S

  4. #4
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650
    In step 3 above, you will need to do a set tablespace containers command and not create tablespace (as you have mentioned) ... I assume you would have done set tablespace containers command there ...

    You cannot share a container for two different databases ... For eg, C:\database\containers\TS1 can be used by only one database ... When you create a container for a tablespace , db2 'tags' the container to ensure that no other database writes to it ...

    Can you post the contents of restore.cmd ?

    Also, check in the db2diag.log file ... It is likely to have a message or two ...

    Book for a DB2 DBA, mmm ... , you can start with DB2 Certification Guide and then wander on to the manuals ....

    Good luck

    Sathyaram



    Originally posted by babithakrishnan
    Hi Sathyaram,
    Thanks for your reply.

    I have a query in my mind. Can we use the same tablespace name for two different databases (like in Oracle)?

    Here for Database x, iam using container name as Y and Tablespaces from TB1 to TBN.

    For Database x1, iam using container name as Y1 and Tablespaces from TBX1 to TBXN.

    Even if i give a different container name and different table space name for this new database, iam getting the same error.

    Reason for this : I've taken a backup for Database x and trying to restore it to Database x1. In this case, it would have taken the backup of everything including the tablespaces (User defined) also the system tablespaces.

    In my restore.cmd iam for 4 tablespaces iam using

    c:\db2\node0000\sql00003\sqlt0000.0
    c:\db2\node0000\sql00003\sqlt0001.0
    c:\db2\node0000\sql00003\sqlt0002.0
    c:\db2\node0000\sql00003\sqlt0003.0

    I have modified sql00003 related to the new database.

    Even then iam getting error,
    SQL0298N Bad container path. SQLSTATE=428B2
    in the first step before continuing the set tablespace containers.

    Why using the above command instead of the new table space container name ?
    Why this error is occured?

    Can you tell me how to resolve this issue? Also can you please suggest me a good book for DB2 DBA to know the details.

    Thanks & Regards,
    Babitha.S
    Last edited by sathyaram_s; 03-25-03 at 05:44.

  5. #5
    Join Date
    Jan 2003
    Posts
    10
    Hi,

    I followed these steps for Restoring an Image file.

    1. Placing the backup image in the appropriate directory.
    2. Modified the Table space containers in the command file.
    3. Executing the command.

    I got the specified error. When i tried to do the same operation with Export and Load Command, iam not getting any error. I can create a new database with the Generated DDL and DML.

    This backup image file is created in a different machine and i am trying to restore in a different machine with a new database name.

    Why cant i create a new database with the image file? Bcoz doing the same operation using image file takes lesser time than using the batch file for export and import.

    Pls explain why this problem occurs.

    Regards,
    Babitha.S






    Originally posted by sathyaram_s
    In step 3 above, you will need to do a set tablespace containers command and not create tablespace (as you have mentioned) ... I assume you would have done set tablespace containers command there ...

    You cannot share a container for two different databases ... For eg, C:\database\containers\TS1 can be used by only one database ... When you create a container for a tablespace , db2 'tags' the container to ensure that no other database writes to it ...

    Can you post the contents of restore.cmd ?

    Also, check in the db2diag.log file ... It is likely to have a message or two ...

    Book for a DB2 DBA, mmm ... , you can start with DB2 Certification Guide and then wonder on to the manuals ....

    Good luck

    Sathyaram

  6. #6
    Join Date
    Jul 2001
    Location
    Bangalore, India
    Posts
    28
    Hi Babitha,
    Can you post the entire script that you used to restore AS IT IS, this helps in finding out the exact problem. I have used redirected restore extensively in my last proj and may be I can help you out.
    Ravi
    (Also specify the O/S of both source and target systems involved)

  7. #7
    Join Date
    Jan 2003
    Posts
    10

    Restore to New DB - PRB

    Hi Ravi,
    Pls find the details below. Also pls tell me which method is more efficient, using image file or DDL &.ixf file for BACKUP AND RESTORE

    Regards,
    Babitha

    Step : 1
    C:\>db2 create database DEVP2
    DB20000I The CREATE DATABASE command completed successfully.

    Step 2:
    C:\>db2 restore database enblprd from c:\ to c:\ into DEVP2 without rolling forward
    SQL2529W Warning! Restoring to an existing database that is different from the backup image datab
    ase, and the alias name "DEVP2" of the existing database does not match the alias name "ENBLPRD" of
    the backup image, and the database name "DEVP2" of the existing database does not match the databa
    se name "ENBLPRD" of the backup image. The target database will be overwritten by the backup versio
    n. The Roll-forward recovery logs associated with the target database will be deleted.
    Do you want to continue ? (y/n) y
    SQL0298N Bad container path. SQLSTATE=428B2

    ENBLPRD - is the existing database name. The Backup image is taken in this database.

    Tried the above step in these ways:

    C:\>db2 restore database enblprd from c:\ into DEVP2 without rolling forward
    SQL2529W Warning! Restoring to an existing database that is different from the backup image datab
    ase, and the alias name "DEVP2" of the existing database does not match the alias name "ENBLPRD" of
    the backup image, and the database name "DEVP2" of the existing database does not match the databa
    se name "ENBLPRD" of the backup image. The target database will be overwritten by the backup versio
    n. The Roll-forward recovery logs associated with the target database will be deleted.
    Do you want to continue ? (y/n) y
    SQL0298N Bad container path. SQLSTATE=428B2

    C:\>db2 restore database enblprd from c:\ into DEVP2
    SQL2529W Warning! Restoring to an existing database that is different from the backup image datab
    ase, and the alias name "DEVP2" of the existing database does not match the alias name "ENBLPRD" of
    the backup image, and the database name "DEVP2" of the existing database does not match the databa
    se name "ENBLPRD" of the backup image. The target database will be overwritten by the backup versio
    n. The Roll-forward recovery logs associated with the target database will be deleted.
    Do you want to continue ? (y/n) y
    SQL0298N Bad container path. SQLSTATE=428B2
    ***********

    Once the above step is success, execute the following steps.

    Step 3:
    db2 -tvf restore.cmd -z c:\RestoreLog.log

    - To create table spaces and its containers.

    Step 4:
    db2 restore database DEVP2 continue




    restore.cmd Contains the following lines.

    set tablespace containers for 0 using (path 'c:\db2\node0000\sql00003\sqlt0000.0');
    set tablespace containers for 1 using (path 'c:\db2\node0000\sql00003\sqlt0001.0');
    set tablespace containers for 2 using (path 'c:\db2\node0000\sql00003\sqlt0002.0');
    set tablespace containers for 3 using (file 'd:\devcontainers\tenblprd1.dat' 5000);
    set tablespace containers for 4 using (file 'd:\devcontainers\tenblprd2.dat' 28000);
    set tablespace containers for 5 using (file 'd:\devcontainers\tenblprd3.dat' 5000);
    set tablespace containers for 6 using (file 'd:\devcontainers\tenblprd4.dat' 5000);
    set tablespace containers for 7 using (file 'd:\devcontainers\tenblprd5.dat' 10000);
    set tablespace containers for 8 using (file 'd:\devcontainers\tenblprd6.dat' 24000);
    set tablespace containers for 9 using (file 'd:\devcontainers\tenblprd7.dat' 5000);
    set tablespace containers for 10 using (file 'd:\devcontainers\tenblprd8.dat' 5000);
    set tablespace containers for 11 using (file 'd:\devcontainers\tenblprd9.dat' 5000);
    set tablespace containers for 12 using (file 'd:\devcontainers\tenblprd10.dat' 5000);
    set tablespace containers for 13 using (file 'd:\devcontainers\tenblprd11.dat' 5000);
    set tablespace containers for 14 using (file 'd:\devcontainers\tenblprd12.dat' 5000);
    set tablespace containers for 15 using (file 'd:\devcontainers\tenblprd13.dat' 5000);
    set tablespace containers for 16 using (file 'd:\devcontainers\tenblprd14.dat' 5000);
    set tablespace containers for 17 using (file 'd:\devcontainers\tenblprd15.dat' 50000);
    set tablespace containers for 18 using (path 'c:\db2\node0000\sql00003\sqlt0003.0');

  8. #8
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650

    Re: Restore to New DB - PRB

    Had an opportunity to look at the db2diag.log file

    In your last post, you have not specified the redirect option in the restore commands Hence, Im not surprised to see the errors . This is because, the containers on the target are not the same as the source .

    Also, as mentioned in one of my earlier posts, have all the three commands(restore redirect, set tablespace containers and restore continue) in the same script Otherwise, you will end up with an error (This how Unix behaves, not sure about windows)

    Also ensure that all directories you specify in the set tablespace containers statement already exisit in the target machine .

    In my opinion, backup-restore is a better option than export-load You might need to do export-load if you are moving across platforms, or you want a different table-tablespace mapping on the target or you want to change the container types on the target etc .

    Hope this helps


    Sathyaram
    Last edited by sathyaram_s; 03-25-03 at 07:42.

  9. #9
    Join Date
    Dec 2002
    Location
    PUNE, INDIA
    Posts
    25

    Thumbs up Re: Restore to New Database Prb

    Hi, there ..

    Today i came across a same error as mentioned below by you.

    DB21080E No previous RESTORE DATABASE command with REDIRECT option was issued

    What i was trying to do was, to restore a database OLD using a backup of a NEW database. What i did then was RESTORE database NEW and renamed it back to OLD. It worked !!

    Its the context of your post that got my attention... You can give a try. Very much possible that what i said is not what you have been looking for. All the best !!

    --RAHool


    Originally posted by babithakrishnan
    Hi ,

    Thanks to everybody for your valuable suggestions to my previous queries. Right now iam facing another problem in restroing new database.

    I have a backup image file which i need to restore to a new database.

    I followed these steps.

    1. C:\>db2 create database DEVP2
    DB20000I The CREATE DATABASE command completed successfully.

    2. C:\>db2 restore database enblprd from c:\ to c:\ into DEVP2 redirect without rolling forward

    3. C:\>db2 -tvf restoreph2.cmd -z c:\Onsite\RestoreLog.log
    restoreph2.cmd -> holds the command to create table spaces.

    4. C:\>db2 restore database DEVP2 continue
    DB21080E No previous RESTORE DATABASE command with REDIRECT option was issued
    for this database alias, or the information about that command is lost.

    5. C:\>db2 restore database DEVP2
    SQL2008N The callerac parameter is not within valid range or the requested
    action is out of sequence.

    6. C:\>db2 restore database DEVP2 abort
    DB21080E No previous RESTORE DATABASE command with REDIRECT option was issued
    for this database alias, or the information about that command is lost.

    When i executed Step 4: i got the error mentioned. So i tried with the steps 5, 6. No success.

    I gave another try by performing these steps.

    1. Drop database devp2.
    2. Execute step 2
    C:\>db2 restore database enblprd from c:\ to c:\ into DEVP2 without rolling forward
    I got this error. I tried by removing the "without rolling forward" , also removed the target directory "to c:\". But still iam getting the same error.
    SQL0298N Bad container path. SQLSTATE=428B2

    How to resolve this problem. What is container path.

    Can anybody help me out in resolving this issue.

    Thanks in advance
    Babitha

  10. #10
    Join Date
    Jul 2001
    Location
    Bangalore, India
    Posts
    28
    Hi,
    As Sathyaram rightly mentioned, you have not mentioned the REDIRECT option in your command so steps 3 & 4 is of no use.
    For your benefit, I have given the syntaxt that you need to use below,
    -----------------------
    -----------------------
    RESTORE DATABASE <sorce db name> USER <user> USING <password> FROM <source path> TO <target path> INTO <target db name> REDIRECT;
    SET TABLESPACE CONTAINERS FOR 0 USING (PATH '<PATH1>');
    SET TABLESPACE CONTAINERS FOR 1 USING (FILE '<FILENAME1>' size);
    ...............
    ...............
    ...............
    SET TABLESPACE CONTAINERS FOR n USING (FILE '<FILENAMEn>' size);
    RESTORE DATABASE <source db name> CONTINUE;
    -----------------------
    -----------------------
    Note that you donot need to create a new DB seperately (Step1 in your las post), instead mention the new db name in place of "<target db name>" above and make sure you donot have a database with that name already existing.
    Also for SMS, you need to provide the path of the folder and for DMS, you need to provide the file name with full path.
    And as Sathyaram has mentioned, you can have the entire command scripts mentioned above in a single script and run it at once.
    Finally, make sure you have created all the target paths before running this script.
    Hope this helps.

    Ravi

Posting Permissions

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