Question: I’m making a change to DB2 LUW database table – and would like to first backup the table – before I make the change. What is a method for backing up a table and data?
Answer: This method will create the table LIKE the source table , and then the INSERT statement will take all the data from the source table and INSERT into the target table.
CREATE TABLE MYSCHEMA.A_NEW_TBL LIKE MYSCHEMA.AN_OLD_TBL; INSERT INTO MYSCHEMA.A_NEW_TBL (SELECT * FROM MYSCHEMA.AN_OLD_TBL);
Note: Using this method will not copy across all objects associated with this table. The LIKE method copies the implicit definition of the table. The implicit definition does not include unique constraints, foreign key constraints, triggers, or indexes.
To get full details of all the options available for the CREATE TABLE .. LIKE option have a read through the documentation.
As an alternative method, which gives you greater control you can look at the process to create a DDL on an existing DB2 table (DBA DB2)
Read More on DB2 Object management