Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2012
    Posts
    2

    Unanswered: Migrate DB2 Database

    Hi All,

    I have very little knowledge in DB2 and need assistance to perform the following task.

    We have two DB2 v9.7 database on the same server.
    Source : BDQ
    Dest : BDD

    I wish to copy all tables and data in tablespaces 'DSSDATA' and 'METADATA' from the BDQ to BDD.

    What would be the best way to do this?

    My thoughts originally was to do a straight backup and restore but I did not know how to go about this.

    I was then pointed to db2move which I tried at a schema level. I used the following command:
    db2move BDQ COPY -sn <schema> -co TARGET_DB BDD USER <username> USING <password>

    ***** DB2MOVE *****

    Action: COPY

    Start time: Mon May 14 10:12:40 2012


    All schema names matching: <schema> ;

    Connecting to database BDQ ... successful! Server : DB2 Common Server V9.7.4

    Binding package automatically ... /db2/db2bdq/sqllib/bnd/db2common.bnd ... successful!

    Binding package automatically ... /db2/db2bdq/sqllib/bnd/db2move.bnd ... successful!

    **ERROR - Failed to connect to target database : BDD


    db2move failed with -1 (debuginfo:19).




    Files generated:
    -----------------
    COPYSCHEMA.20120514101240.msg

    Please delete these files when they are no longer needed.

    **Error occured -1


    It looks as if it can't find the database, so I ran a db2 list db directory
    command and can comfirm it is not in there but can connect to BDD via DB2 Control Center.

    Could someone please take the time point me in the right direction.

    Thanks

  2. #2
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    If you are using automatic storage, it is not that hard to do backup and restore. Check the Command Reference manual for instructions on how to restore to another database.

    But one thing you need to know is whether the databases are in the same instance. If the databases are in different instances, that may be why it cannot find the other database with db2move. To fix that problem, you can catalog the target database in the instance where the original database is located (need to create tcpip node, and catalog db). But backup and restore is probably easier if using automatic storage.
    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
    Mar 2012
    Posts
    2
    Hi All,

    Goal:Overwrite the Development Database from a QA (dont ask) Database

    Details:
    1 server
    2 instances (db2inst1, db2qa)
    1 database on each instance (db2inst1:dev, db2bdq:qa) <instance:db>

    1) Backup dev
    2) Backup qa
    3) set BD2INSTANCE=db2inst1
    4) db2 RESTORE DATABASE QA FROM "/db2/data/backups" TAKEN AT 20120515152858 TO "/db2/data/db2inst1" INTO DEV redirect;

    SQL2528W Warning! Restoring to an existing database that is the same as the
    backup image database, but the alias name "DEV" of the existing database does
    not match the alias "QA" of backup image, and the database name "BDD" of the
    existing database does not match the database name "QA" of the backup image.
    The target database will be overwritten by the backup version.
    Do you want to continue ? (y/n) y

    SQL1277W A redirected restore operation is being performed. Table space
    configuration can now be viewed and table spaces that do not use automatic
    storage can have their containers reconfigured.
    DB20000I The RESTORE DATABASE command completed successfully.

    5) db2 list tablespaces show detail
    6) db2 list tablespace containers for 3;

    Change tablespace path if needed

    7) db2 restore db QA continue
    DB20000I The RESTORE DATABASE command completed successfully.

    8) db2 get dbm cfg
    Notice service name is the same as QA so when trying to resolve the port number for DEV it resolves it still to QA. Found this out by:

    9) cd /etc/services/
    10) more +/<service name> services

    11) db2 update dbm cfg using svcename <dev service name>

    12) db2stop force
    13) db2start

    But when I check the database manager configuration for QA, it has changed it there..

    It seems the DEV and QA are using the same configuration?
    Have a got an alias to the same database?
    What should I do to ensure DEV and QA databases are separated?

    I get this error in Control Center when trying to connect to DEV database:

    [IBM][CLI Driver] SQL30061N The database alias or database name
    "DEV " was not found at the remote node.
    SQLSTATE=08004



    Explanation:

    The database name is not an existing database at the remote database
    node.

    The statement cannot be processed.

    User response:

    Resubmit the command with the correct database name or alias.

    Federated system users: check to ensure that the entry in SYSCAT.SERVERS
    correctly specifies the database name of the data source.

    sqlcode: -30061

    sqlstate: 08004

    9)

  4. #4
    Join Date
    Aug 2008
    Location
    Toronto, Canada
    Posts
    2,367
    Can you restore databases DEV and QA (or whatever their names are) back to their respective instances and make sure you can connect to each db from the command line. Then, collect the following from each instance:

    - db2 list db directory
    - db2 list db directory on <db path from the previous step>

    - db2 connect to <db name>
    - db2pd -d <db name> -sto -tab

Tags for this Thread

Posting Permissions

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