Search code examples
db2db2-luw

Restore a database changing the schema on DB2


I have a database dump where the table schema is db2inst2. I would like to restore this database on a different server, but using db2inst1 as the destination schema.

Is there a way to do it using db2 restore command?

If not, is there a way to change the schema of all tables after the restore?


Solution

  • You can use the ADMIN_COPY_SCHEMA procedure to copy all objects from one schema to another.

    Once completed and you verify everything you can use ADMIN_DROP_SCHEMA to drop the old one.