Enabling and Reconfiguring the Automatic Backups Feature

When you create an Oracle Database Cloud Service database deployment, you specify whether automatic backups are configured by choosing a backup destination. After the deployment is created you can change the configuration by changing the deployment’s backup destination.

The instructions in this topic describe how to switch backup destinations for an existing database deployment. Specifically, the following changes are possible using the instructions in this topic:

  • From None to Both Cloud Storage and Local Storage

  • From None to Cloud Storage Only (not currently available for database deployments that use Oracle RAC)

  • From Both Cloud Storage and Local Storage to Cloud Storage Only

  • From Cloud Storage Only to Both Cloud Storage and Local Storage

For background information on the destinations, see About Backing Up Database Deployments on Database Cloud Service.

Note:

The Oracle Database Cloud Service console does not currently recognize changes to the backup destination made by using the bkup.cfg file with the backup assistant. Therefore, the console will not reflect the new backup destination and may not display any backups taken, depending on what backup destination change you have made. If the backups are not displayed, you will not be able to use the Oracle Database Cloud Service console to perform recovery.

Prerequisites

  • If you are switching to the backup destination Both Cloud Storage and Local Storage, you must increase the size of the local storage used for backups. Use the Extend Backup Storage Volume option of the Oracle Database Cloud Service console’s scaling feature to add storage such that the backup storage is 1.7 times the size of your database storage. For instructions, see Scaling a Database Deployment.

    Note:

    Older deployments do not support the Extend Backup Storage Volume option, and an error is displayed when you try to use it. In this case, you must manually add backup storage. For instructions, see Increasing Local Storage for Backups on Older Database Deployments.

  • If you are switching to the backup destination Both Cloud Storage and Local Storage or Cloud Storage Only, you must have an Oracle Storage Cloud Service container in your account that is reserved for backups. If you don’t have one, you must create one. See Creating Containers in Using Oracle Storage Cloud Service, or see the tutorial Oracle Storage Cloud Service: Creating Containers Using the REST API.

The commands you use to change the backup destination depend on the type of database running in the database deployment.

Changing the Backup Configuration on Database Deployments Hosting Single-Instance Databases

Oracle Database Cloud Service allows you to change the backup destination for your database deployments after creating them.

Before changing the backup destination, make sure you have performed applicable Prerequisites.

  1. Connect as the oracle user to the compute node.
  2. Start an RMAN session:
    $ rman target=/
    ...
    RMAN> 
  3. Delete any existing backups.
    RMAN> delete backup;
    All backups for this database recorded in the RMAN repository are deleted. (This process may take several minutes.)
  4. Exit the RMAN session:
    RMAN> exit;
  5. If you are switching from the None destination, and this is the first time you have done so, you must configure Transparent Data Encryption (TDE). Run the following command:
    $ /var/opt/oracle/dbaascli/dbaascli tde config --ks_login auto

    TDE provides encryption of database files at the file level. For information about TDE, including auto login, see Oracle Database Advanced Security Guide for Release 18, 12.2, 12.1 or 11.2.

  6. Close your connection to the compute node as the oracle user.
  7. Connect as the opc user to the compute node.
  8. Start a root-user command shell:
    $ sudo -s
    #
  9. Enter this bkup_api command to generate a file containing the current backup settings:
    # /var/opt/oracle/bkup_api/bkup_api get config [--file=filename] --dbname=dbname
    

    where filename is an optional parameter used to specify a name for the file that will be generated and dbname is the database name for the database that you want to act on.

  10. Edit the parameter values in the generated file to change any settings you want to update in the current backup configuration. The following parameters are used to customize the current backup configuration:
    Parameter Description

    bkup_disk

    Enable backup to disk. Valid values are yes and no.

    bkup_disk_recovery_window

    Recovery window expressed in number of days between 1 and 14.

    bkup_oss

    Enable backup to an Oracle Storage Cloud container. Valid values are yes and no.

    bkup_oss_passwd

    Oracle Storage Cloud user password. Only applicable when bkup_oss is set to yes.

    bkup_oss_recovery_window

    Recovery window for backups to an Oracle Storage Cloud container, expressed in number of days between 1 and 30. Only applicable when bkup_oss is set to yes. Only applicable when bkup_oss is set to yes.

    bkup_oss_url

    URL for an Oracle Storage Cloud container such as https://storage.oraclecorp.com/v1/Storage-test/test.

    bkup_oss_user

    Oracle Storage Cloud username. Only applicable when bkup_oss is set to yes.

  11. Enter this bkup_api command to update the backup settings using the file you generated:
    # /var/opt/oracle/bkup_api/bkup_api set config --file=filename --dbname=dbname
    

    where filename is used to specify a name for the file that will be used to update the backup settings and dbname is the database name for the database that you want to act on.

  12. You can use this bkup_api command to check the status of the update:
    # /var/opt/oracle/bkup_api/bkup_api configure_status
    
  13. Exit the root-user command shell:
    # exit
    $

Changing the Backup Configuration on Database Deployments Hosting Oracle RAC Databases

Not Oracle Cloud InfrastructureNot Oracle Cloud at Customer This topic does not apply to Oracle Cloud Infrastructure or to Oracle Cloud at Customer.

Oracle Database Cloud Service allows you to change the backup destination for your database deployments after creating them.

Before changing the backup destination, make sure you have performed applicable Prerequisites.

Note:

If you have used the update rdk subcommand of the raccli utility to update the cloud tooling to 16.4.5 or later, you must manually update the opc installer for the Oracle Database Cloud Backup Module before you use the update backupconfig subcommand. For instructions, see in Updating the cloud tooling on a deployment hosting Oracle RAC requires manual update of the Oracle Database Cloud Backup Module in Known Issues for Oracle Database Cloud Service.

  1. Connect as the opc user to compute node 1.
  2. Use the raccli update backupconfig command to update the configuration.

    To change the backup destination to Both Cloud Storage and Local Storage, enter the following command. Line breaks have been added for clarity; you must enter the command on a single line.

    $ raccli update backupconfig -params '{"diskEnabled" : true, "ossEnabled" : true, 
     "cloudStorageUser" : "username", "cloudStoragePwd" : "password", 
     "cloudStorageContainerUrl" : "container-URL"}' 

    where:

    • username is the user name of an Oracle Cloud user who has read/write access to the container.

    • password is the password of the user specified in cloudStorageUser.

    • container-URL is the URL of the Oracle Storage Cloud container.

Increasing Local Storage for Backups on Older Database Deployments

Not Oracle Cloud Infrastructure This topic does not apply to Oracle Cloud Infrastructure.

Older database deployments on Oracle Database Cloud Service do not support the Extend Backup Storage Volume feature, so you must manually add backup storage.

To create a larger storage volume and use it for backups:

  1. Create a storage volume for backups. Its size should be 1.7 times the space allocated for data storage.

    Use the Create New Storage Volume option of the Oracle Database Cloud Service console’s scaling feature to add a storage volume of the appropriate size. For instructions, see Scaling a Database Deployment.

  2. Connect as the opc user to the compute node.

    For detailed instructions, see Connecting to a Compute Node Through Secure Shell (SSH).

  3. Confirm the addition of the storage volume by listing the devices:

    $ lsblk
    NAME    MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
    xvdb    202:16   0   21G  0 disk
    ├─xvdb1 202:17   0  200M  0 part /boot
    ├─xvdb2 202:18   0 15.8G  0 part /
    └─xvdb3 202:19   0    4G  0 part [SWAP]
    xvdc    202:32   0   10G  0 disk
    └─xvdc1 202:33   0   10G  0 part /u04
    xvdd    202:48   0    7G  0 disk
    └─xvdd1 202:49   0    7G  0 part /u03
    xvde    202:64   0   30G  0 disk
    └─xvde1 202:65   0   30G  0 part /u01
    xvdf    202:80   0   11G  0 disk
    └─xvdf1 202:81   0   11G  0 part /u02
    xvdg    202:96   0   17G  0 disk
    └─xvdg1 202:97   0   17G  0 part /u05
    
  4. Change from the opc user to the oracle user:

    $ sudo su - oracle
    
  5. As the oracle user, use RMAN to shut down the database instance:

    $ rman target=/
    ...
    RMAN> shutdown immediate;
    
    using target database control file instead of recovery catalog
    database closed
    database dismounted
    Oracle instance shut down
    

    Quit RMAN and exit the oracle user session:

    RMAN> quit;
    
    Recovery Manager complete.
    $ exit
  6. As the root user, copy the content from /u03 (which you have been using for backup storage) to /u05:

    # cp -R /u03/* /u05/
  7. Unmount the /u05 and /u03 mount points:

    # umount /u05/
    # umount /u03/

    Note:

    The Linux unmount command is umount (with no n).
  8. Mount the partition of new storage volume you just created to /u03, which Oracle Database Cloud Service uses for backups. For example:

    # mount /dev/xvdg1 /u03
  9. Look at the results:

    # lsblk
    NAME    MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
    xvdb    202:16   0   21G  0 disk
    ├─xvdb1 202:17   0  200M  0 part /boot
    ├─xvdb2 202:18   0 15.8G  0 part /
    └─xvdb3 202:19   0    4G  0 part [SWAP]
    xvdc    202:32   0   10G  0 disk
    └─xvdc1 202:33   0   10G  0 part /u04
    xvdd    202:48   0    7G  0 disk
    └─xvdd1 202:49   0    7G  0 part
    xvde    202:64   0   30G  0 disk
    └─xvde1 202:65   0   30G  0 part /u01
    xvdf    202:80   0   11G  0 disk
    └─xvdf1 202:81   0   11G  0 part /u02
    xvdg    202:96   0   17G  0 disk
    └─xvdg1 202:97   0   17G  0 part /u03
    
    

    The old 7 GB partition xvdd1, which was previously mounted to /u03, is no longer mounted at all. The new 17 GB partition xvdg1 is now mounted to /u03 and will therefore be used for backups. Note that the space used for xvdd1 is now no longer available for any use.

  10. Set the ownership and permissions of the mount-point directory /u03. For example:

    # chown -R oracle:oinstall /u03
    # chmod 755 /u03
  11. As the oracle user, start SQL*Plus, connect to the database as SYSDBA, and start it. For example:

    $ sqlplus /nolog
    
    SQL*Plus: Release 12.1.0.2.0 Production on Sat Feb 21 13:19:51 2015
    
    Copyright (c) 1982, 2014, Oracle.  All rights reserved.
    
    SQL> connect sys/password as sysdba
    Connected to an idle instance.
    SQL> startup
    ORACLE instance started.
    
    Total System Global Area 3170893824 bytes
    Fixed Size                  2929400 bytes
    Variable Size            1845497096 bytes
    Database Buffers         1308622848 bytes
    Redo Buffers               13844480 bytes
    Database mounted.
    Database opened.
    
  12. If you want to see the current setting for the limit on the total space to be used by target database recovery files, show the values of the parameter DB_RECOVERY_FILE_DEST, for example:

    SQL> show parameter db_recovery_file_dest                                      
    NAME                         TYPE        VALUE
    ---------------------------- ----------- ------------------------------
    db_recovery_file_dest        string      /u03/app/oracle/fast_recovery_
                                                     area
    db_recovery_file_dest_size   big integer 7G
    
  13. Increase the parameter DB_RECOVERY_FILE_DEST_SIZE to use the new extra space in /u03, for example:

    SQL> alter system set db_recovery_file_dest_size=17G;
    
    System altered.
  14. Show the new value:

    SQL> show parameter db_recovery_file_dest;  
    NAME                         TYPE        VALUE
    ---------------------------- ----------- ------------------------------
    db_recovery_file_dest        string      /u03/app/oracle/fast_recovery_
                                                     area
    db_recovery_file_dest_size   big integer 17G
    
  15. Quit SQL*Plus and log out:

    SQL> quit;
    Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
    $ exit