Top
Enterprise Postgres 16 Cluster Operation Guide(Database Multiplexing)

4.5 Recovering from an Incorrect User Operation

This section describes how to recover an instance when data has been corrupted due to incorrect user operation.

For example, when data has been corrupted due to incorrect user operation, such as data being unintentionally changed or deleted by an application or command, it is necessary to restore the original data on the primary server and resynchronize with the standby server.

Use the following procedure to perform recovery.

  1. Identify the primary server

    Execute the mc_ctl command in status mode on each server, and search for a server for which "primary" or "none(inactivated primary)" is displayed.

  2. Stop the applications and commands that caused the incorrect operation to occur

    Stop applications and commands that are running on the primary server. This will minimize the impact caused by the incorrect data.

    Also, if any applications used for reference by the standby server are running, stop them too.

  3. Stop the instance and Mirroring Controller

    Stop the instance and Mirroring Controller on both the primary server and standby server.

    Example)
    $ mc_ctl stop -a -M /mcdir/inst1
  4. Recover the database on the primary server

    Recover the database using the recovery method in which the pgx_rcvall command uses the backup data to recover the database to a restore point prior to the time when the incorrect operation was performed.

    See

    Refer to "Recovering from an Incorrect User Operation" in the Operation Guide for information on using the pgx_rcvall command to recover the database to a restore point, and then perform only the database recovery procedure while the instance is in a stop state.

  5. Start the instance and Mirroring Controller

    Start the instance and Mirroring Controller on the primary server.

    Enabling automatic switch/disconnection

    As the instance administrator user, execute the mc_ctl command in start mode.

    Example)
    $ mc_ctl start -M /mcdir/inst1
    Disabling automatic switch/disconnection

    As the instance administrator user, execute the mc_ctl command in start mode with the -F option specified.

    Example)
    $ mc_ctl start -M /mcdir/inst1 -F

    Point

    After Mirroring Controller is started, automatic switch/disconnection can be enabled or disabled using the enable-failover or disable-failover mode of the mc_ctl command.

  6. Build the new standby server

    Refer to "2.5 Setting Up the Standby Server" for information on building (setting up) a standby server from the primary server.