Use the Generate DDL window to generate DDL, SQL and statistics in a script
file to recreate a database objects and its statistics in another
database.
Data Definition Language (DDL) is a subset of SQL. It is a language
for describing data and its relationships in a database.
There are several reasons to generate DDL, SQL and statistics for database
objects.
- You want to keep a snapshot of what the database looks like.
- You want to setup a test system where the database acts like the
production system but contains no data.
Note: | You can only generate DDL for Version 6 databases.
|
Fields and controls
Authorities and privileges

To generate DDL for database objects:
- Open the Generate DDL window.
- Optional. Either accept the default or select a different value for
Schema. Selecting the value All
Schemas will generate DDL for all schemas in the database.
- Optional. Select or clear the Database
objects check box to indicate whether to generate DDL statements for
Database objects such as tables, views and indexes.
- Optional. Select or clear the Tablespaces,
nodegroups, and bufferpools check box to indicate whether to
generate DDL statements for these objects.
- Optional. Select or clear the Authorization
statements check box to indicate whether to generate SQL
authorization statements (GRANT) for database objects.
- Optional. Select the Database
statistics check box if you want to generate SQL statements for
table statistics in the database.
- Optional. Select the Update
statistics check box if you want to generate an update statistics
command.
- Optional. Select Include COMMIT
statements after every table check box if you want to include COMMIT
statements after every table.
- Optional. To schedule the job that will generate DDL, click Schedule. The Schedule window opens.
- Optional. To view and save the SQL command that will generate the
DDL, click Show Command. The Show
Command window opens.
- To generate DDL, click Generate.
The Run Script window opens. Type a userid
and password and click OK. A job is
created with the contents of the db2look command. A DB2 Message window
appears with the job id of the new job. The job creates a script
generated by the db2look command. Click OK to close the message
window.
- Use the Job History page of the Journal notebook
to view the results of this job, and to view the contents of a saved script
associated with the job. Click mouse button 2 on the job and select
Show results from the pop-up menu. The Job Results window opens.
The output of the db2look command is shown in the Job output pane. The
User comment pane identifies where the output file is saved. Select
Create Script to create a script of the
results. The New Command Script window
appears.

Related information