Chapter 9. Managing data lifecyle with InfoSphere Warehouse 351
In Example 9-9, we migrate data for the data partition PART_2009Q4, part of the
table CSTINSIGHT.CUSTOMER_TXN, from a source to the target database
environment. The source database has 16 database partitions on two data
nodes. The target database in this example has just four database partitions on a
single data node, similar to an IBM Smart Analytics System 5710.
Example 9-9 Issuing db2hpu from the command line with control file
GLOBAL CONNECT TO <target_dbname>;
--Migrate Block
MIGRATE TABLESPACE
PART(ALL)
DB2 NO LOCK YES QUIESCE YES
TARGET ENVIRONMENT(INSTANCE "target_instance" on "target host" IN
"target_dbname")
WORKING IN("/work1")
SELECT * FROM CSTINSIGHT.CUSTOMER_TXN;
DATAPARTITION_NAME (part_2009q4)
TARGET KEYS(current parts(1:4))
FORMAT MIGRATION INTO schema.customer_txn MODIFIED BY IDENTITYOVERRIDE
;
Where:
/work1 is available on all data nodes.
The target database table exists.
The number of source database partitions is 16.
The number of target database partitions is 4.
MIGRATION INTO specifies the name of the target table name where
different to the source table name.
IDENTITYOVERRIDE indicates that the contents of the identity column on
the source database table is to remain intact during the transfer.
In this example, data is repartitioned from 16 database partitions to four
database partitions. Optim High Performance Unload achieves this by
partitioning the data on the source system using the default round-robin partition
map method. Data is then streamed to four named pipe files on the target system
and the LOAD utility is initiated.
The contents of the identity column, often used to generate a surrogate key, are
retained and this allows for fact and dimensional data to be transferred with
foreign key (informational) constraints intact.