Perform a failover

This page describes how to perform a failover operation for an Autonomous Database in Google Cloud.

For your Autonomous Database, Oracle Database@Google Cloud lets you failover to a standby peer database.

Before you begin

Ensure that you have the following roles and permissions required to perform a failover:

  • roles/autonomousDatabaseAdmin

Perform a failover

To failover to a standby peer database, do the following:

Console

  • In the event of a disaster, if your primary database is inaccessible, follow these steps:

    1. Go to the Autonomous Database page.

      Go to Autonomous Database

    2. Click the name of the standby peer for which you want to perform the failover operation.

    3. On the Autonomous Database details page, click Failover.

    4. In the Are you sure you want to failover to peer? dialog, do the following:

      1. If your primary database is not automatically detected, select the region of your primary database.
      2. Enter the ID of your primary database.
      3. Click Confirm.
  • If your primary database is accessible, follow these steps:

    1. Go to the Autonomous Database page.

      Go to Autonomous Database

    2. Click the name of the primary database for which you want to perform the failover operation.

    3. On the Autonomous Database details page, select the Disaster recovery tab.

    4. For the peer database to which you want to failover, click View actions, and then click Failover.

    5. In the Are you sure you want to failover to peer? dialog, enter the ID of your primary database.

    6. Click Confirm.

After the failover is complete, the peer database becomes the "Primary" and its Status field shows "Available".

gcloud

Use the gcloud oracle-database autonomous-databases failover command to perform a failover.

 gcloud oracle-database autonomous-databases failover PEER_DATABASE_ID
 --project=PROJECT_ID
 --location=PEER_REGION
 --peer-autonomous-database=projects/PROJECT_ID/locations/PRIMARY_REGION/autonomousDatabases/PRIMARY_DATABASE_ID

Replace the following:

  • PEER_DATABASE_ID: the ID of your peer database.
  • PROJECT_ID: the ID of your Google Cloud project.
  • PEER_REGION: the region of your peer database.
  • PRIMARY_REGION: the region of your primary database.
  • PRIMARY_DATABASE_ID: the ID of your primary database.

API

To perform a failover operation, run the following curl command:

curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
"https://oracledatabase.googleapis.com/v1/projects/PROJECT_ID/locations/PEER_REGION/autonomousDatabases/PEER_DATABASE_ID:failover" \
-d \
'{
  "peer_autonomous_database": "projects/PROJECT_ID/locations/PRIMARY_REGION/autonomousDatabases/PRIMARY_DATABASE_ID"
}'

Replace the following:

  • PROJECT_ID: the ID of your Google Cloud project which contains your primary database.
  • PEER_REGION: the region of your peer database.
  • PEER_DATABASE_ID: the ID of your peer database.
  • PRIMARY_REGION: the region of your primary database.
  • PRIMARY_DATABASE_ID: the ID of your primary database.

What's next