Adding an instance to Db2 Data Management Console manually
You can add an instance to Db2® Data Management Console manually.
Symptoms
- Db2 Data Management Console fails to add a Db2 instance. The following message is displayed when you open the Db2 instance:
This profile does not exist.
Resolving the problem
To resolve this problem, perform these steps to add an instance to Db2 Data Management Console manually:
- Get the token.Run the following command:
Result:curl --location --request POST 'https://${CPD_ROUTE}/v1/preauth/signin' \ --header 'Content-Type: application/json' \ --data-raw '{"username":"admin","password":"password"}'{ "privateCloudCookie": "ibm-private-cloud-session=<session_id>; Path=/; HttpOnly; Secure; SameSite=Lax", "token": "<token_value>", "csrf_token": "<csrf_token>", "_messageCode_": "success", "message": "success" }Replace `admin` and `password` to the Cloud Pak for Data username and password.
Get the token from the result:"token": "<token_value>" - Verify the
Stateof Db2 Data Management Console instance and redeploy a new instance if needed.Append token value to Bearer with key Authorization into header.
If thecurl --location --request POST 'https://${CPD_ROUTE}/zen-data/v1/addOn/query' \ --header 'Authorization: Bearer <token_value>' \ --header 'Content-Type: application/json' \ --data-raw '{ "type": "dmc" }'Stateof Db2 Data Management Console instance in the result is 'installed' but not 'enabled', then delete this instance and deploy another instance in the Db2 Data Management Console instance page. - Get the database instance
ID:
For example, the instance ID iscurl --location --request GET 'https://${CPD_ROUTE}/zen-data/v3/service_instances?fetch_all_instances=true' \ --header 'Authorization: Bearer <token_value>' \1648557675098841. - Add the database to Db2 Data Management Console. Check
result in step 3, fill-in the following
information:
curl --location --request POST 'https://${CPD_INSTANCE}/addon-dmc/v1/profiles' \ --header 'Authorization: Bearer <token_value>' \ --header 'Content-Type: application/json' \ --data-raw '{ "CollectionCred": { "password": "<password>", "securityMechanism": "9", "user": "db2inst1" }, "databaseName": "BLUDB", "dbInstanceId": "1648557675098841", "dbType": "db2oltp", "display_name": "db2oltp-1648557675098841", "dmcInstanceId": "1653029836233754", "host": "c-db2oltp-1648557675098841-db2u-engn-svc", "plan": "smp", "port": 50001, "sslCertLocation": "/opt/ibm-datasrvrmgr/Config/cpd-internal-tls/ca.crt", "sslConnection": true }'CollectionCred: default user name is db2inst1, securityMechanism is 9. To get password, do the following:For example- Run 'oc get secret -A|grep <db instance id>, find below one end with instancepassword. c-db2oltp-1648557675098841-instancepassword'
- Run 'oc get secret c-db2oltp-1648557675098841-instancepassword -o yaml', check
'password'
apiVersion: v1 data: password: abcdefg kind: Secret metadata: creationTimestamp: "2022-03-04T13:26:10Z" labels: formation_id: db2oltp-1648557675098841 role: none name: c-db2oltp-1648557675098841-instancepassword namespace: cpd-instance ownerReferences: - apiVersion: db2u.databases.ibm.com/v1 kind: Formation name: db2oltp-1648557675098841 uid: ec1be91b-4234-4d20-9d58-8a8038b66a62 resourceVersion: "304047" uid: e52e3e9a-69d6-41c6-8979-cae341e6427d - Decrypt password run 'echo 'abcdefg'|base64 -d'
Check step c in the above result. Get the database instance ID to find Db2 Data Management Console and database instance information to fill-in the following information:databaseName: check 'database-name' dbInstanceId: check 'id' dbType: check 'type' display_name: check 'instance-id' host: run 'oc get svc |grep ${DB_INSTANCE_ID}-db2u-engn-svc' , check 'c-${DB2_TYPE}-db2u-engn-svc' plan: check 'sub-type' port: default is 50001, run 'oc get svc |grep ' to check port of 'c-db2oltp--db2u-engn-svc' sslCertLocation: default is /opt/ibm-datasrvrmgr/Config/cpd-internal-tls/ca.crt sslConnection : default is true dmcInstanceId: check 'id' belong to DMC {"addon_type": "dmc"} - Wait for a few minutes. After the Db2 Data Management Console demon thread adds the database successfully, refresh the database pages and verify whether the Redis pods are started.