IBM Maximo: Migrate MAXDB to RH OpenShift (DB2 Version)
Create MAXDB database
1) Install the DB2 Operator
- Ensure the IBM DB2 Operator is installed and available in the OpenShift cluster where MAS is running.
2) Create a new DB2 instance
- Open the OpenShift Console.
- Navigate to Operators → Installed Operators → DB2 Operator.
- Select DB2 Cluster and click Create New Cluster.
3) Create the DB2 cluster using a YAML definition
- Obtain the YAML file referenced in the IBM Maximo documentation: IBM Maximo: Migrate MAXDB to RH OpenShift (db2ucmas76-01.yaml)
- Open the YAML view in the DB2 Cluster creation screen.
- Paste the contents of the YAML file into the editor.
- Review and adjust values as required for your environment (namespace, storage classes, resources, etc.).
- Click Create to deploy the DB2 cluster.
Copy backup file into Container
Define db2 project on openshift
oc project db2u
Check pods
oc get pods
Copy backup file
oc cp MAXDB76.zip c-db2u-maxdb-db2u-0:/mnt/backup/MAXDB76.zip
Login on container
oc rsh c-db2u-maxdb-db2u-0
Extract file
cd /mnt/backup unzip MAXDB76.zip chmod a+rw MAX*
List
ls -l total 7121740 -rw-rw-rw-. 1 db2uadm db2iadm1 7095119872 Sep 13 2022 MAXDB76.0.ctginst1.DBPART000.20220913055916.001 -rw-rw-rw-. 1 db2uadm db2iadm1 197538909 Apr 7 21:15 MAXDB76.zip
Change user
su - db2inst1
Check backup
db2ckbkp -H /mnt/backup/MAXDB76.0.ctginst1.DBPART000.20220913055916.001
This command is generate the following file: IBM Maximo: Migrate MAXDB to RH OpenShift (db2ckbkp.out)
Restore MAXDB76 backup file into Container
This command will export data from backup file
su - db2inst1 cd /mnt/backup db2 restore database MAXDB76 redirect generate script restoresql.sql
This command is generate the following file: IBM Maximo: Migrate MAXDB to RH OpenShift (restoresql.sql)
This can help to change parameters on restore.
Prepare db2
db2 force applications all db2 terminate db2 deactivate database MAXDB db2 drop database MAXDB
Create directories
mkdir -p /mnt/bludata0/MAXDB mkdir -p /mnt/tempts/c-db2ucmas76-05-db2u/MAXDB
Start RESTORE with REDIRECT
db2 "RESTORE DATABASE MAXDB76 FROM '/mnt/backup' TAKEN AT 20220913055916 INTO MAXDB REPLACE HISTORY FILE REPLACE EXISTING REDIRECT WITHOUT ROLLING FORWARD WITHOUT PROMPTING"
Configure Storage Group
db2 "SET STOGROUP PATHS FOR IBMSTOGROUP ON '/mnt/bludata0'"
Continue the RESTORE
db2 "RESTORE DATABASE MAXDB76 CONTINUE"
Checking restored database
Connect to database
db2 connect to MAXDB
Verify tablespaces
db2 list tablespaces show detail
Verify containers
db2 list tablespace containers for 0 show detail db2 list tablespace containers for 5 show detail db2 list tablespace containers for 6 show detail
Verify storage group
db2 "select * from syscat.stogroups" db2 "select * from syscat.storagepaths"
Verify data (tables)
db2 "select count(*) from syscat.tables"
db2 "select tabschema, tabname, card from syscat.tables where tabschema not like 'SYS%' fetch first 10 rows only"