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:
-
Go to the Autonomous Databasepage.
-
Click the name of the standby peer for which you want to perform the failover operation.
-
On the Autonomous Database detailspage, click Failover.
-
In the Are you sure you want to failover to peer?dialog, do the following:
- If your primary database is not automatically detected, select the region of your primary database.
- Enter the ID of your primary database.
- Click Confirm.
-
-
If your primary database is accessible, follow these steps:
-
Go to the Autonomous Databasepage.
-
Click the name of the primary database for which you want to perform the failover operation.
-
On the Autonomous Database detailspage, select the Disaster recoverytab.
-
For the peer database to which you want to failover, click View actions, and then click Failover.
-
In the Are you sure you want to failover to peer?dialog, enter the ID of your primary database.
-
Click Confirm.
-
After the failover is complete, the peer database becomes the "Primary" and its Statusfield 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.

