Backing Up a Database to Oracle Cloud Infrastructure Object Storage

Note

This topic is not applicable to Exadata DB systems. For Exadata DB systems, see Managing Exadata Database Backups.

This topic 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 Backing Up a Database to Object Storage Using RMAN.)

Warning

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 given the required type of access in a policy  written by an administrator, whether you're using the Console or the REST API with an SDK, CLI, or other tool. If you try to perform an action and get a message that you don’t have permission or are unauthorized, confirm with your administrator the type of access you've been granted and which compartment  you should 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:

Important

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.

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 Storage 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 note 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. See note for backup window time zone information.

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.

Using the Console

You can use the Console to enable automatic incremental backups, create full backups on demand, and view the list of managed backups for a database. The Console also allows you to delete full backups.

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.

To navigate to the list of standalone backups for your current compartment
To configure automatic backups for a database
To create an on-demand full backup of a database
To delete full backups from Object Storage

Using 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:

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

What's Next?

See Recovering a Database from Object Storage for information on restoring your database.

See To create a database from a backup in an existing DB system for information on creating a new database from a backup. You have the choice of using a daily incremental backup, a standalone backup, the latest archive redo log backup, or a timestamp for a point-in-time copy.

See To create a DB system from a backup for information on creating a new DB system using a backup as the source for the initial database. You have the choice of using a daily incremental backup, a standalone backup, the latest archive redo log backup, or a timestamp for a point-in-time copy.