Renaming the database

Last Updated : May 07, 2025 |

About this task

After the source link is broken on the target system, the analytics_db must be renamed to analyticsdb for Avaya Analytics™ release version 4.3 usage and grant global access permissions.

Before you begin

Complete Migrating the Microstrategy Database.

Procedure

  1. To find the name of the Crunchy 5 primary pod, run the following command:
    kubectl get pod -l postgres-operator.crunchydata.com/cluster=analyticsdb,postgres-operator.crunchydata.com/role=master -o name | cut -c 5-
  2. Run the following command into Crunchy 5 primary pod:
    kubectl exec -it POD_NAME -- /bin/bash

    Here, replace POD_NAME with the name of the Crunchy 5 primary pod found in above step.

  3. Open the database command prompt with the following psql command:
    bash-4.4$ psql
    psql (11.13)
    Type "help" for help.
    postgres=#
  4. Run the following commands to rename the DB and grant permissions:
    UPDATE pg_database SET datallowconn = false WHERE datname = 'analyticsdb';
    UPDATE pg_database SET datallowconn = false WHERE datname = 'analytics_db';
    SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname is not null AND pid <> pg_backend_pid();
    DROP database analyticsdb;
    ALTER DATABASE analytics_db RENAME TO analyticsdb;
    UPDATE pg_database SET datallowconn = true WHERE datname = 'analyticsdb';
    grant temporary, connect on database analyticsdb to public;
    grant ALL on database analyticsdb to dbwriterservice;
    grant ALL on database analyticsdb to mstruser;
  5. Run the command \q to exit psql.
  6. Run the command exit to exit the pod and return to CCM.