Back Up a Database to Object Storage

This article explains how to work with backups managed by Oracle Cloud Infrastructure. You do this by using the Console or the API.

For unmanaged backups, you can use RMAN or dbcli, and you must create and manage your own Object Storage buckets for backups. See Back Up a Database to Object Storage Using RMAN.

Caution:

If you previously used RMAN or dbcli to configure backups and then you switch to using the Console or the API for backups, a new backup configuration is created and associated with your database. This means that you can no longer rely on your previously configured unmanaged backups to work.

Required IAM Policy

To use Oracle Cloud Infrastructure, you must be granted security access in a policy by an administrator. This access is required whether you're using the Console or the REST API with an SDK, CLI, or other tool. If you get a message that you don’t have permission or are unauthorized, verify with your administrator what type of access you have and which compartment to work in.

If you're new to policies, see Getting Started with Policies and Common Policies.

Prerequisites

The DB system requires access to the Oracle Cloud Infrastructure Object Storage service, including connectivity to the applicable Swift endpoint for Object Storage. Oracle recommends using a service gateway with the VCN to enable this access. For more information, see these topics:

Note

Note that your database and DB system must be in an "Available" state for a backup operation to run successfully. Oracle recommends that you avoid performing actions that could interfere with availability (such as patching and Data Guard operations) while a backup operation is in progress. If an automatic backup operation fails, the Database service retries the operation during the next day’s backup window. If an on-demand full backup fails, you can try the operation again when the DB system and database availability are restored.

In addition to the prerequisites listed, ensure that the following conditions are met to avoid backup failures:

  • The database's archiving mode is set to ARCHIVELOG (the default).
  • The /u01 directory on the database host file system has sufficient free space for the execution of backup processes.
  • The .bash_profile file for the oracle user does not include any interactive commands (such as oraenv or one that could generate an error or warning message).
  • (For automatic backups) No changes were made to the default WALLET_LOCATION entry in the sqlnet.ora file.
  • No changes were made to RMAN backup settings by using standard RMAN commands.

See Backup Failures on Bare Metal and Virtual Machine DB Systems for details on problems that can result from not following these guidelines.

Oracle Cloud Infrastructure Managed Backup Features

The following information applies to managed backups configured using the Oracle Cloud Infrastructure Console or API.

Note

Databases in a security zone compartment must have automatic backups enabled. For a full list of policies that affect Database service resources, see Security Zone Policies.

Automatic Incremental and Archived Redo Log Backups

When you enable the Automatic Backup feature for a database, the service creates the following on an on-going basis:

  • Weekly level 0 backup, generally created on a specified weekend day. A level 0 backup is the equivalent of a full backup. Note that in the Console, weekly level 0 backups appear in the list of backups with backup type "incremental", as do the daily level 1 backups.
  • Daily level 1 backups, which are incremental backups created on each day for the six days following the level 0 backup day.

    Level 0 and level 1 backups are stored in Object Store and have an assigned OCID.

  • Ongoing archived redo log backups (with a minimum frequency of every 60 minutes). The Last Backup Time field on the database details page in the Oracle Cloud Infrastructure Console displays the time of the last archived redo logs. This backup differs from the level 0 and level 1 automatic backups in that it is based on log data and does not have an assigned OCID. The last archived redo log backup can be used to create a new database or to recover a database with minimal data loss.

The automatic backup process used to create level 0 and level 1 backups can run at any time within the daily backup window (between midnight and 6:00 AM). See the following topic on backup scheduling for backup window time zone information. Automatic incremental backups (level 0 and level 1) are retained in Object Storage for 30 days by default.

Backup Retention

If you choose to enable automatic backups, you can choose one of the following preset retention periods: 7 days, 15 days, 30 days, 45 days, or 60 days. The system automatically deletes your incremental backups at the end of your chosen retention period.

Audit and Trace File Retention for Databases Using Automatic Backups

Oracle Database writes audit and trace files to your database's local storage in the /u01 directory. These files are retained for 30 days by default, though you can change this interval. Once a day, audit and trace files older than 30 days (or the user-specified interval, if applicable) are discarded by a Oracle Scheduler job. You can also disable the Scheduler job if you want to retain these files permanently. Use the following dbcli commands to make changes to this Scheduler job.

  • To change the retention period from the default setting of 30 days:

    dbcli update-database -in ;dbName> -lr ;number_of_days_to_retain_files>

    For example:

    dbcli update-database -in inventorydb -lr 15
  • To disable the daily discard Scheduler job for older audit and trace files:

    dbcli update-schedule -i ;schedulerID> -d

    For example:

    dbcli update-schedule -i 5678 -d

Backup Scheduling

The automatic backup process starts at any time during your daily backup window. You can optionally specify a 2-hour scheduling window for your database during which the automatic backup process will begin. There are 12 scheduling windows to choose from, each starting on an even-numbered hour (for example, one window runs from 4:00-6:00 AM, and the next from 6:00-8:00 AM). Backups jobs do not necessarily complete within the scheduling window

The default backup window of 00:00 to 06:00 in the time zone of the DB system's region is assigned to your database if you do not specify a window. Note that the default backup scheduling window is six hours long, while the windows you specify are two hours long. For backup window time zone information, see the following note.

Note

  • Backup Window Time Zone - Automatic backups enabled for the first time after November 20, 2018 on any database will run between midnight and 6:00 AM in the time zone of the DB system's region. If you have enabled automatic backups on a database before this date, the backup window for the database will continue to be between midnight and 6:00 AM UTC. You can create a My Oracle Support service request to have your automatic backups run in a backup window of your choice.
  • Data Guard - You can enable the Automatic Backup feature on a database with the standby role in a Data Guard association. However, automatic backups for that database will not be created until it assumes the primary role.
  • Retention Period Changes - If you shorten your database's automatic backup retention period in the future, existing backups falling outside the updated retention period are deleted by the system.
  • Object Storage Costs - Automatic backups incur Object Storage usage costs.

On-Demand Full Backups

You can create a full backup of your database at any time unless your database is assuming the standby role in a Data Guard association.

Standalone Backups

When you terminate a DB system or a database, all of its resources are deleted, along with any automatic backups. Full backups remain in Object Storage as standalone backups. You can use a standalone backup to create a new database.

Note

  • The list of backups you see in the Console does not include any unmanaged backups (backups created directly by using RMAN or dbcli).
  • All backups are encrypted with the same master key used for Transparent Data Encryption (TDE) wallet encryption.

Navigate To the List of Standalone Backups For Your Current Compartment

Configure Automatic Backups For a Database

Create an On-Demand Full Backup Of a Database

Delete Full Backups From Object Storage

Delete Standalone Backups from Object Storage

  1. Open the navigation menu. Click Oracle Database, then click Standalone Backups under Resources.
  2. In the list of standalone backups, find the backup you want to use to delete.
  3. Click the Actions menu for the backup you are interested in, and then click Delete.
  4. In the Delete dialog, click Delete to confirm the backup deletion.

Use the API

For information about using the API and signing requests, see REST APIs and Security Credentials. For information about SDKs, see Software Development Kits and Command Line Interface.

Use these API operations to manage database backups:

  • ListBackups
  • GetBackup
  • CreateBackup
  • DeleteBackup
  • UpdateDatabase - To enable and disable automatic backups.

For the complete list of APIs for the Database service, see Database Service API.