Restore an Autonomous AI Database

This page describes how to restore an Autonomous AI Database from a backup.

You can restore an Autonomous AI Database from a backup or to a point in time. When you restore a database, it retains the schema and all of the data up to the time of the backup, as well as the database options. To view available backups of an Autonomous AI Database, see View backups for an Autonomous AI Database.

To learn more about how backup and recovery works on an Autonomous AI Database, see About Backup and Recovery on Autonomous AI Database.

Restore an Autonomous AI Database

You can only restore an Autonomous AI Database whose status is "Available".

To restore your Autonomous AI Database from a backup, follow these steps:

Console

  1. Go to the Autonomous AI Database page.

    Go to Autonomous AI Database

  2. Click the name of the Autonomous AI Database that you want to restore.

  3. On the Autonomous AI Database details page, select the Backups tab.

  4. To restore from a backup, do the following:

    1. In the Backups section, for your chosen Backup timestamp, click View actions, and then click Restore.

    2. To confirm the restore operation, type the database ID.

    3. Click Restore.

  5. To restore to a point in time, do the following:

    1. In the Backups section, click Restore to timestamp.

    2. Within the retention window, specify a timestamp.

    3. To confirm the restore operation, enter the database ID.

    4. Click Restore.

On the Backups tab, the Status field displays the progress of the restore operation.

gcloud

Run the gcloud oracle-database autonomous-database restore command:

gcloud oracle-database autonomous-database restore DATABASE_NAME
--location=REGION_ID
--project=PROJECT_NAME
--restore-time=RESTORE_TIME

Replace the following:

  • DATABASE_NAME: name of the database you want to restore.
  • REGION_ID: the region of your database.
  • PROJECT_NAME: the name of your Google Cloud project.
  • RESTORE_TIME: the backup time you want to restore your database to. You must use the endTime of the backup as the restore time.

To see a list of available backups for your database, see View backups for an Autonomous AI Database.

API

To restore an Autonomous AI Database, 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/REGION/autonomousDatabases/DATABASE_ID:restore" \
-d \
'{
  "restoreTime": "TIMESTAMP"
}'

Replace the following:

  • PROJECT_ID: the ID of your Google Cloud project. If you're using a Shared VPC, then this project ID is the ID of your host project.
  • REGION: the region of your database.
  • DATABASE_ID: the ID of your database.
  • TIMESTAMP: the date and time to which you want to restore the database. Specify the timestamp in RFC 3339 format. For example, "2014-10-02T15:01:23Z".

C#

using Google.Cloud.OracleDatabase.V1;
using Google.LongRunning;
using Google.Protobuf.WellKnownTypes;
using System.Threading.Tasks;

public sealed partial class GeneratedOracleDatabaseClientSnippets
{
    /// <summary>Snippet for RestoreAutonomousDatabaseAsync</summary>
    /// <remarks>
    /// This snippet has been automatically generated and should be regarded as a code template only.
    /// It will require modifications to work:
    /// - It may require correct/in-range values for request initialization.
    /// - It may require specifying regional endpoints when creating the service client as shown in
    ///   https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
    /// </remarks>
    public async Task RestoreAutonomousDatabaseAsync()
    {
        // Create client
        OracleDatabaseClient oracleDatabaseClient = await OracleDatabaseClient.CreateAsync();
        // Initialize request argument(s)
        string name = "projects/[PROJECT]/locations/[LOCATION]/autonomousDatabases/[AUTONOMOUS_DATABASE]";
        Timestamp restoreTime = new Timestamp();
        // Make the request
        Operation<AutonomousDatabase, OperationMetadata> response = await oracleDatabaseClient.RestoreAutonomousDatabaseAsync(name, restoreTime);

        // Poll until the returned long-running operation is complete
        Operation<AutonomousDatabase, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
        // Retrieve the operation result
        AutonomousDatabase result = completedResponse.Result;

        // Or get the name of the operation
        string operationName = response.Name;
        // This name can be stored, then the long-running operation retrieved later by name
        Operation<AutonomousDatabase, OperationMetadata> retrievedResponse = await oracleDatabaseClient.PollOnceRestoreAutonomousDatabaseAsync(operationName);
        // Check if the retrieved long-running operation has completed
        if (retrievedResponse.IsCompleted)
        {
            // If it has completed, then access the result
            AutonomousDatabase retrievedResult = retrievedResponse.Result;
        }
    }
}

Go


//go:build examples

package main

import (
	"context"

	oracledatabase "cloud.google.com/go/oracledatabase/apiv1"
	oracledatabasepb "cloud.google.com/go/oracledatabase/apiv1/oracledatabasepb"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := oracledatabase.NewClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &oracledatabasepb.RestoreAutonomousDatabaseRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/oracledatabase/apiv1/oracledatabasepb#RestoreAutonomousDatabaseRequest.
	}
	op, err := c.RestoreAutonomousDatabase(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}

	resp, err