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
1) Define db2 project on openshift
oc project db2u
2) Check pods
oc get pods
3) Copy backup file to the pod
oc cp MAXDB76.zip c-db2u-maxdb-db2u-0:/mnt/backup/MAXDB76.zip
4) Login on container
oc rsh c-db2u-maxdb-db2u-0
5) Extract file and fix permissions
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
6) Change user
su - db2inst1
7) 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 to MAXDB
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.
Restore Database
1) Prepare db2
su - db2inst1 db2 force applications all db2 terminate db2 deactivate database MAXDB
2) Start Restore
db2 "RESTORE DATABASE MAXDB76 FROM /mnt/backup TAKEN AT 20220913055916 INTO MAXDB REPLACE EXISTING REDIRECT WITHOUT ROLLING FORWARD WITHOUT PROMPTING"
3) Configure Storage Group
db2 "SET STOGROUP PATHS FOR IBMSTOGROUP ON '/mnt/blumeta0/db2/databases'"
4) Continue the RESTORE
db2 "RESTORE DATABASE MAXDB76 CONTINUE"
5) Activate and verify
db2 "ACTIVATE DATABASE MAXDB" db2 "CONNECT TO MAXDB" db2 "LIST TABLESPACES SHOW DETAIL"
Checking restored database
1) Connect to database
db2 connect to MAXDB
2) Verify tablespaces
db2 list tablespaces show detail
3) 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
4) Verify storage group
db2 "select * from syscat.stogroups" db2 "select * from syscat.storagepaths"
5) 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"