You could use the EXPORT
, and related IMPORT
or LOAD
commands if the goal is to transfer data back into another DB2 database.
In fact, you can generate the the statements based on metadata from SYSCAT.TABLES
EXPORT
SELECT 'EXPORT TO /usr/data/SCHEMA/' || TABNAME || '.ixf OF IXF LOBS TO /usr/data/SCHEMA/lbos/ MODIFIED BY LOBSINFILE SELECT * FROM SCHEMA.' || TABNAME || ';'
FROM SYSCAT.TABLES
WHERE TABSCHEMA = 'SCHEMA'
ORDER BY TABNAME
IMPORT
SELECT 'IMPORT FROM /usr/data/SCHEMA/' || TABNAME || '.ixf OF IXF LOBS FROM /usr/data/SCHEMA/lobs/ MODIFIED BY LOBSINFILE INSERT INTO SCHEMA.' || TABNAME || ';'
FROM SYSCAT.TABLES
WHERE TABSCHEMA = 'SCHEMA'
ORDER BY TABNAME
If you want the actual insert scripts, then you may need to go with a third-party tool (I'm not aware of one provided by DB2, though I could be wrong.)