Topic
  • 2 replies
  • Latest Post - ‏2013-12-24T11:50:53Z by 9RYQ_Kiran_mk
9RYQ_Kiran_mk
9RYQ_Kiran_mk
78 Posts

Pinned topic Copying all the tables of one schema to another schema which has already tables in it in DB2 LUW databases

‏2013-12-16T12:42:28Z |

Hi Folks,

I used the below method to copy all the tables from one schema to another within the same database.

CALL SYSPROC.ADMIN_COPY_SCHEMA('DB2105', 'SCHEMA2', 'COPY', NULL,'USERSPACE1,IBMDB2SAMPLEREL,IBMDB2SAMPLEXML','TBSP1,SYS_ANY','ERRORSCHEMA', 'ERRORNAME')

But the limitation of this method is it will either create the new schema or will copy the tables and its data to empty schema.

How do I copy all the tables of a schema to a pre-existing schema which has few set of tables.

DB2 Version : DB2 v9.7 LUW FP5 and v10.1 FP2
OS : RHEL 5.7


Best Regards,
Kiran.M.K.

  • DF5V_krishna_Bissa
    DF5V_krishna_Bissa
    42 Posts

    Re: Copying all the tables of one schema to another schema which has already tables in it in DB2 LUW databases

    ‏2013-12-21T18:42:28Z  

    1.Take DB2look for the tables that needs to be copied

    2.Export the data from those tables

    3 create  the tables under destination schema using the db2look collected in step1

    4.load the data from the files in step2

  • 9RYQ_Kiran_mk
    9RYQ_Kiran_mk
    78 Posts

    Re: Copying all the tables of one schema to another schema which has already tables in it in DB2 LUW databases

    ‏2013-12-24T11:50:53Z  

    1.Take DB2look for the tables that needs to be copied

    2.Export the data from those tables

    3 create  the tables under destination schema using the db2look collected in step1

    4.load the data from the files in step2

    But this is the manual way of doing it.  Is there any other through db2move we can do it ?

     

    Best Regards,

    Kiran.M.K.