DEV Community

Eduardo Issao Ito
Eduardo Issao Ito

Posted on

2 2

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

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay