Technical Blog Post
Abstract
How to create an empty DB2 database with objects and config from an existing one
Body
db2look is the tool which could be used to achieve this purpose.
From DB2 10.1 onwards there is a -createdb option which helps to get the original create database syntax.
The create database syntax is put at the beginning of db2look output, so that, when it's used as a script to recreate the database, the first thing which will be invoked is the create database command.
Also, -printdbcfg option helps to get the database configurations and put in the output file in a way which could be directly used to update the database configurations.
Following example will get the create database syntax along with all object DDLs, mimic and config used for optimizer and database config as a whole,
db2look -d sample -createdb -f -m -l -a -e -printdbcfg -o db2look.out
So, with this db2look output script an empty database similar to source database could be recreated.
To recreate the empty database and create the objects etc just need to run,
db2 -tvf db2look.out
UID
ibm11140814