Reverse engineering
Reverse engineering lets you reverse engineer the Db2® objects in your database catalog.
Reverse engineering generates the SQL statements necessary to re-create a Db2® object.
- Database
- Table space
- Table or view
- Index
- Schema
- Distinct type
- Function
- Stored procedure
To generate DDL for objects at a remote location, first connect to that location, then use the GEN line command.
- Extracting the DDL for an object before changes are made, so that the changes are applied to the current definition and are available for fallback purposes.
- Move Db2® objects to another Db2® subsystem. By using reverse engineering (together with the Db2® table unload and load facilities), objects can be moved after a few manual modifications to the generated SQL and batch jobs.
When extracting database, table space, and table objects, all dependent objects can also be generated; this includes table spaces, tables, indexes, views, synonyms, aliases, referential constraints, table checks, and table triggers. When extracting objects in schemas, reverse engineering can extract the dependent distinct types, functions, and stored procedures. All authorizations to these objects can also be generated.
You can generate the SQL statements using a batch or online job. If you are using FM/Db2 to extract several objects from a large catalog, batch jobs are recommended.
If you use the GEN line command, FM/Db2 displays the Generate SQL From Db2® Catalog panel.
- As an option, specify new values for the :
- Storage group (possibly using a different storage group for table spaces and index spaces).
- Database.
- Specify a new object owner. If specified, the new owner is used whenever an object is created.
- Specify a new schema name (where applicable). If specified, the new schema is used whenever an object is created.
- Specify the data set in which FM/Db2 places the generated SQL.
- Specify whether the SQL generation runs as a batch or online job.
- Specify how often reverse engineering adds an SQL COMMIT statement to the generated SQL.
- Specify whether Db2® default parameters are removed or kept in the generated SQL.
If you specify an execution mode of BATCH, FM/Db2 generates a batch job and displays the job in an ISPF Edit session, ready for any modifications you need to make before submitting the job for execution. If you specify TSO, FM/Db2 generates the SQL statements online and displays the results.
Related tasks
Related references