Skip to content

Instantly share code, notes, and snippets.

@soapplied
Last active December 9, 2016 16:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save soapplied/5899230 to your computer and use it in GitHub Desktop.
Save soapplied/5899230 to your computer and use it in GitHub Desktop.
DB2 export DB tables
db2 connect to MYDB
db2 -x "select tabname from syscat.tables where TABSCHEMA='MYSCHEMA'
and type='T'" > tableNames
while read TABLE; do
db2 EXPORT TO ./exported/$TABLE.del OF DEL lobs to ./exported/lobs
lobfile $TABLE xml to ./exported/xml xmlfile $TABLE
modified by lobsinsepfiles xmlinsepfiles MESSAGES ./exported/$TABLE.txt
"SELECT * FROM MYSCHEMA.$TABLE"
done < tableNames
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment