Here is a guide I wrote for my work, I just post it here so that I can refer to it even after I leave.
Install the same DB2 version as in DEV environment (v184.108.40.206)
IBM does not support old version of DB2 developer edition, and when new version is released, old version support is dropped and you’re not able to install them any more.
As a workaround, we need to migrate the existing DB2, which runs as a container, to new server to get the same version.
Here is the steps to migrate the container:
on existing DB2 server:
12 docker export db2server -o db2server.tar ## run this command to export db2server containerdocker inspect db2server |jq '.|.HostConfig.Binds' ## run this command to check what folder is mounted on container
then, copy db2server.tar and the folder from 2nd command (usually /home/centos/.config/ibm-db2-hkex/DB2/db2fs or /home/centos/.config/ibm-db2-developerc/DB2/db2fs) to new server
on new server, run these commands:
1234567 sudo yum install -y docker ## to install dockersudo systemctl enable docker ## config docker to start at bootsudo groupadd docker ## create docker group, to grant current user permission to run dockersudo usermod -aG docker $USER ## add current user to docker group
logout and log back in, try ‘docker info’ to make sure your account has permission to start docker containers
12345 docker import db2server.tar ## import containerdocker images ## list docker images. copy the image ID for use with below commanddocker tag IMAGE_ID db2server:220.127.116.11 ## give this docker image a tag, will be referenced later.
create a file called ‘.env_list’, with the following content:
create a file called run_db2_container.sh, with the following content:
Note the argument to ‘-v’, make sure the folder is where you put the content copied from the old server.
123456789 docker run \--name db2server --restart=always \--detach \--privileged=true \-p 50000:50000 -p 55000:55000 \--env-file .env_list \-v /home/centos/.config/ibm-db2-hkex/DB2/<a class="external-link" href="http://db2fs/db2fs" rel="nofollow">db2fs:/db2fs</a> \db2server:18.104.22.168 \/var/db2_setup/lib/entrypoint.sh
then, run below command to start the container:
1 bash run_db2_container.sh
then, run below command to make sure container started:
1 docker ps
update db2nodes.cfg file with new container hostname, with below commands:
123 docker exec -it db2server bash ## login to containerhostname ## run this within container, to get its hostname
edit file /home/db2inst1/sqllib/db2nodes.cfg, replace old hostname string with new one.
1 exit ## logout from container
restart container and verify DB2 is working:
1234567891011 docker stop db2server ## run this from host machine, to stop the containerdocker start db2server ## start containerdocker exec -it db2server bash ## login to containersu - db2inst1 ## switch to db2 admin accountdb2 connect to sample ## try connect to a sample database, to verify db2 is workingexit;exit ## exit twice to logout from container