Data Migration
After setting the encryption parameters for a column, the table can be migrated. For more information on data migration (data encryption), refer to the corresponding CDP Client's documentation.
Steps
To migrate a table, run the following command:
./pdbctl migrate -a <database_alias> -t <table_name>
Flag Description
Flag | Data Type | Description |
---|---|---|
-b | int | Batch size to be migrated. The value must be an integer. This is an optional parameter. Default values: — 1 - For large data types — 1000 - For other data types. Note: Batch processing is not supported for DB2 Large data types. |
-a | string | Database alias associated with the database user. |
-h | Flag to view help for the migrate command. | |
-i | string | Insert trigger name. This is an optional parameter |
-n | string | New table name. This is an optional parameter. |
-t | string | Table name that contains the columns to migrate. |
-u | string | Updated trigger name. This is an optional parameter. |
-- verbose | Print verbose logs. | |
-v | string | View name. This is an optional parameter. |
Note
When performing migration of large data types with batch size > 1, the following message is displayed: Encrypting large datatype column(s) with batch size greater than 1 fails if it contains any data greater than 3936.
Continue only if the data length is ≤ 3936, otherwise, use the default batch size.
Example
The following sample command performs the data migration for the table CUSTOMERS
as per the set encryption parameters along with the status of the operation:
./pdbctl migrate -a demo -t CUSTOMERS
Output
Job ID: 133
Processing...
Job Id 133 | Status : success
Data encryption errors
If the data migration ends in error, you can perform the following operations, as required:
Restore job
Drops the columns created during the encryption. This returns the table to its pre-encryption state.
To restore a job, run the following command:
./pdbctl restorejob -a <database_alias> -t <table_name> -j <jobid>
Resume job
Continues the process from where it ended. You may want to select this option after you have remedied the source of the error.
To resume a job, run the following command:
./pdbctl restorejob -a <database_alias> -t <table_name> -j <jobid> -- resume
Cancel job
Cancels the data migration process.
To cancel a job, run the following command:
./pdbctl restorejob -a <database_alias> -t <table_name> -j <jobid> -- cancel
Tip
After encrypting a table, it is recommended to remove the plaintext. Refer to Delete data after encryption or decryption for details.