Relocating a DB2 database – db2relocatedb

With working on different customer systems we regularly come across databases that have been created on default drives eg, C:\ and are running out of space or have problems with sql logs shipping in mirrored environments.

To move a database from one drive to another eg, C:  to D: use the following steps can be used
  • Run DB2 CLP
  • Issue “db2stop” – you must stop Db2 running before copying any folders
  • Issue “list db directory” to determine which drives you current databases are on

 

  • Issue “list db directory on c:” to determine which folder contains the database you want to move

 

  • Now copy that folder to the equivalent location on the other drive eg, d:
  • Now open a dos prompt change to Db2 bin directory
  • Create a text file called relocate.cfg and populate it as follows and save in to the DB2 bin folder:
  • DB_NAME=Filenet
  • DB_PATH=C:,D:
  • INSTANCE=DB2
  • Now run the following from the command line:
  • c:\IBM\SQLLIB\bin\db2relocatedb -f relocate.cfg
  • You should receive a prompt to say the database has been successfully relcoated.
  • Rename the old folder that contained the database. This means we still have it as a backup.
  • Issue “db2start” from the command line
  • To check that the database has been moved successfully issue a “list db directory” and check the database location information.

The db2relocatedb tool was introduced in IBM DB2 and makes these type of operations more straight forward. It can also be used to relocate database from one machine to another running on different operating systems.

Check out this developerworks article for more in-depth information:

 

http://www.ibm.com/developerworks/data/library/techarticle/dm-0407schlamb/index.html

 

 

Explore posts in the same categories: Uncategorized

Tags: , ,

You can comment below, or link to this permanent URL from your own site.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s


Follow

Get every new post delivered to your Inbox.

Join 213 other followers