How do I copy data from one Db2® table to another on a different (non-connectable) Db2® system?
Scenario: I have data in a Db2® table and want to copy it to another Db2® table. The source and target Db2® tables are on different Db2® systems. It is not possible to connect to the target Db2® system from the source Db2® system by specifying a location value, or I want to transfer the data out of Db2® as part of the copy process.
To copy the data, you need to perform two steps:
- Use the FM/Db2 Export Utility (3.7) to export the data to a sequential
file (preferably) or a VSAM file. In general, the default mapping
is sufficient. To use the default mapping, specify a template data
set and member name on the Export
To
panel and select Template usage option 4 (Generate and save). If the amount of data to be transferred is large (more than 10,000 rows), run the export in batch by selecting Batch execution. If the amount of data to be transferred is very large (more than 100,000–1,000,000 rows), consider using the Db2® UNLOAD utility (accessed from Utilities, 3.9) instead. - Use the FM/Db2 Import Utility (3.6) to load the exported data into the target Db2® table. If the target table has different column names to the source table, or if data type conversions are required, use template re-mapping to map columns in the source table to columns in the target table. In most cases, FM/Db2 performs any data type conversions automatically.
Related tasks
- Copying data to a VSAM or QSAM file
- Running Export in batch
- Copying data from a VSAM or QSAM file
- UNLOAD utility
- Column mapping rules
Related references