Is there a way using a DB2 database to systematically export all tables from a schema to separate csv files ? What I mean is to export all the tables in a schema without specifying table names. Maybe somehow getting all table names in a schema, then applying the export on those
DB2 LUW – How to Export All Tables from Database Schema to CSV
db2db2-luw
Related Question
- DB2 – how to safely blow away database on linux
- DB2 Database Dump – How to Dump Specific Tables
- How to Select NOT NULL Columns in DB2
- Db2 – Data Migration: Unload/load of GENERATED ALWAYS TIMESTAMP
- DB2, How to save all stored procedures as files
- Db2 – How to move database from Db2/Linux/System-z to Db2/Linux/Intel
- Db2 – How to identify row change timestamp columns in Db2 Table
Best Answer
You can easily create a small script that does this for you, or even do a loop on the command line. Assuming you are on a unix/linux platform something like below should do.
You can replace DB2INST1 with whatever schema you are interested in. If you want tables from several schematas you can use in:
There are a lot of options that you can use to format the output from export, here I use modified by coldel but there is much more that you can configure. See:
https://www.ibm.com/support/knowledgecenter/en/SSEPGG_11.1.0/com.ibm.db2.luw.admin.cmd.doc/doc/r0008303.html
for more info.