Moving IBM Connections databases to another disk

On my connections test server i installed everything in one machine.

TheĀ  home directory for db2inst1 user ends the file space

The databases and all containers are under the default of /home/db2inst1. So we can use db2relocatedb to move them.

First i tested this here with the sample database, and it worked. Your configuration file should look like the following (This is for FILES DB, you will have to change at least the DB_NAME for the others):

DB_NAME=Files
DB_PATH=/home/db2inst1,/dados
INSTANCE=db2inst1
STORAGE_PATH=/home/db2inst1,/dados/db2inst1

/* NOTE that I am assuming that all databases are using the default storage path like the FILES DB is. If not, you will need to modify this. You can verify by running for each database:

db2 “SELECT VARCHAR(STORAGE_GROUP_NAME, 30) AS STOGROUP, VARCHAR(DB_STORAGE_PATH, 40) AS STORAGE_PATH FROM TABLE(ADMIN_GET_STORAGE_PATHS(”,-1)) AS T”

So if the output shows /home/db2inst1, then you can use my example above. Otherwise you will need to use the actual value for te original location. */

LOG_DIR=oldDirPath,newDirPath

/* For the log directory, with the FILES DB, you are suing the default of /home/db2inst1/etc etc, so you do not need to set this. If the others are the same, then you do not need to set them either. Otherwise you have to.

FAILARCHIVE_PATH=newDirPath
LOGARCHMETH1=newDirPath
LOGARCHMETH2=newDirPath
MIRRORLOG_PATH=newDirPath
OVERFLOWLOG_PATH=newDirPath

/* For the above, for the FILES database, you are not using any of them so you can ignore these. For the other databases, if you are not using them OR you are using the default of /home/db2inst1, then you can ignore them.

So ultimately for the FILES database, you would have:

DB_NAME=Files
DB_PATH=/home/db2inst1,/dados
INSTANCE=db2inst1
STORAGE_PATH=/home/db2inst1,/dados/db2inst1

If the other databases are just like files (regarding storage path and log directory), then you will have the same thing except for the database name.

Then perform the following steps:

1. Stop the Connections server and terminate all connections and deactivate the databases – “db2 deactivate db <dbname>”.
2. Stop the instance – “db2stop”.
3. MOVE (do NOT copy!!) the database directory to the new location (VERY IMPORTANT TO MAKE SURE INSTANCE IS STOPPED!!):

mv /home/db2inst1/db2inst1 /dados

Once done you should have /dados/db2inst1/<all the database stuff>. Since all databases are under this directory, you only need to execute the one move command.

4. Ensure that the owner/group/permissions for /dados/db2inst1 are correct (should match old location).
5. Then you would execute the db2relocatedb command FOR EACH database. DO NOT START THE INSTANCE UNTIL ALL ARE DONE!!.

db2relocatedb -f <config file name>

You should see the following output:

[[email protected] ~]$ /home/db2inst1/sqllib/bin/db2relocatedb -f blogs.cfg
Files and control structures were changed successfully.
Database was catalogued successfully.
6. Once the above has been done for each database, you should be able to start the instance and then connect to the databases.

Thanks to IBM IM Support.