DB2 backup/restore schema

adzubla

Eduardo Issao Ito

Posted on April 14, 2022

DB2 backup/restore schema

Creating the backup

Exporting DDL from EXAMPLE schema:

db2look -d MYDB -z EXAMPLE -e -o EXAMPLE.sql
Enter fullscreen mode Exit fullscreen mode

Exporting data from schema:

db2move MYDB export -sn EXAMPLE
Enter fullscreen mode Exit fullscreen mode

The db2move command will create a lot of files, incluing db2move.lst.

It contains internal tables like EXPLAIN_* and ADVISE_*. If you don't need them just delete de corresponding lines from db2move.lst.

Restoring backup

Creating objects:

db2 -t -f EXAMPLE.sql
Enter fullscreen mode Exit fullscreen mode

Restoring data:

db2move MYDB import

db2move MYDB import -io insert_update
Enter fullscreen mode Exit fullscreen mode
💖 💪 🙅 🚩
adzubla
Eduardo Issao Ito

Posted on April 14, 2022

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

DB2 backup/restore schema
db2 DB2 backup/restore schema

April 14, 2022