On this page:
Summary: this page explains how to generate DDL for a DB2 database using the using the db2look tool tool for use with the SQL Analyzer extension.
Note that the db2look tool is only available with an installation of a DB2 UDB instance. If you are using a DB2 z/OS instance, CAST recommends the use of the RC/Migrator tool which is part of the CA Database Management Solution for DB2 for Z/OS, Version 19. There are no instructions provided for this.
The db2look tool provided by IBM generates the DDL statements by object type. See the full documentation for the tool here: https://www.ibm.com/support/knowledgecenter/en/SSEPGG_10.5.0/com.ibm.db2.luw.admin.cmd.doc/doc/r0002051.html.
DDL extraction of all objects from the TEST database
db2look -d TEST -a -e -o c:\temp\DB2_SQL\TEST_DDL.sql
DDL extraction for a specific schema using a specific user
db2look -d TEST -z CASTPUBS -i db2admin -w db2admin -e -o c:\temp\DB2_SQL\CASTPUBS_DDL.sql
See SQL Analyzer - working with XXL or XXS tables for a DB2 database.