Rename database DB2

Is common practice to require a replica of a database on another different environment, and also require that the new database has a new name. For example, to update a pre-production database, backing up SAP homogeneous or simply to change the name of the database for any need.


The utility “db2relocatedb” is used to perform the following functions:

  • Rename database name
  • Change log directory
  • Change db_path
  • Change location of storage properties for containers/directories

In this article we explain the first function, although its implementation is really simple.

Just create a configuration file (chg_config.txt) with the following values:

DB_NAME=PROD,PREPROD
DB_PATH=/db2/PREPROD/sapdata1
INSTANCE=db2preprod
NODENUM=0


In each propertie, first the old value and a comma followed by the new value. If it have no change, just the current value.

Then, with the instance off (db2stop) run the db2relocatedb:

db2relocatedb -f chg_config.cfg


It’s simple ….


Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Cookies use

This web uses cookies to enhance your user experience, collect anonymous usage statistics and integrate content from third-party services. If you continue browsing you are giving your consent for us to set cookies. More information.

ACEPTAR
Aviso de cookies