13 Backup, Restore and Recover Databases

Review backup, restore, and recovery operations for your databases.

About Database Backup and Recovery Options

Backup your databases in Oracle Database Appliance and use the restore and recover features to restore a database to the same or another system or to recover database files.

It is important to create a backup recovery strategy to protect the databases in Oracle Database Appliance from data loss. A user error or a physical problem with a disk can cause a failure of a read or write operation on a disk file required to run the database. You can create a backup policy in the Browser User Interface or from the command-line interface.

The following backup options are available:

  • Backup to an Oracle Fast Recovery Area (FRA) disk (Internal FRA)

  • Backup to Oracle Cloud Infrastructure Object Storage (Oracle Object Storage)

  • Backup to a Network File System (NFS) location (External FRA)

You can use the backup, restore, and recovery features with databases that have backup policy attached to them in the system. You can choose to manage your backups, and set up your backup, restore, and recovery options.

The backup feature enables you to create a backup policy with your backup parameters, such as backup location, recovery window, enable and disable crosscheck, and ObjectStoreSwift Object details. For new and existing databases, you can create and attach a backup policy to a database to perform backup. After a backup policy is attached to a database, the DCS agent automatically schedules the database backup and archive logs backup, for the database. By default, the frequency of the database backup schedule is once a day and the frequency of archivelog backup schedule is 30 minutes. The database backup scheduler performs level 0 backup every Sunday and a level 1 backup Monday through Saturday. However the level 0 backup day can be changed from the default Sunday to any day of the week. The database backup scheduler and archive logs backup schedulers can be disabled or have their frequencies changed.

The DCS agent generates and saves a backup report for each backup. The backup report contains the metadata required to recover or restore a database.

Oracle Database Appliance uses the Oracle Recovery Manager (RMAN) to recover the database. You can recover from a backup report, a point-in-time (PITR), a System Change Number (SCN), or from the latest backup. When a backup report is used for recovery, it performs an SCN recovery, by reading the SCN value from the backup report. For recovery of data block, tablespaces, data files, PDBs, see the Oracle Database Backup and Recovery Reference Guide.

Backup Policy

The backup policy defines the backup details. When you create a backup policy, you define the destination for the database backups, either Internal FRA (Disk) or External FRA (NFS location), or Oracle Object Storage, and you define the recovery window.

If you use the Oracle Object Storage for backup and recovery, you must have an ObjectStore Resource ID or Name.

You can assign the backup policy to the database when you create the database. You can also attach a backup policy to an existing database or update a backup policy.

You can specify compression algorithm while creating the backup policy. The supported compression algorithms are BASIC, LOW, MEDIUM, and HIGH. For Objectstore backup policy, you can specify any compression algorithm. By default, if you do not specify the compression algorithm while creating the Objectstore backup policy, then MEDIUM compression algorithm is used. By default, if you do not specify the compression algorithm while creating the Disk or NFS backup policy, then BASIC compression algorithm is used. Refer to the Oracle Database Licensing Information User Manual for license considerations when you use LOW, MEDIUM, or HIGH compression algorithms for Disk or NFS backup policy.

Backup Levels

Specify the backup level when you take a backup. The supported back levels are:

  • Level 0: This backup captures all blocks in the datafile. By default, level 0 backups occur every Sunday. You can customize your backup settings through the Browser User Interface or the command-line. A level 0 backup is a full backup and is used as the parent for a level 1 backup.

  • Level 1: This backup is an incremental backup that captures only those blocks that change between backups in each datafile. By default, a level 1 backup occurs daily, Monday through Saturday, and captures images of each block in a datafile that changed. Level 1 backups are differential backups. The Level 1 backup includes blocks that were changed from the most recent level 1 or level 0 backup.

  • LongTerm: This backup is a long-term, or archival backup. Use LongTerm to create a backup that is all-inclusive and exempt from the backup retention policy. The backup is all-inclusive because every file needed to restore and recover the database is backed up to a single location. The backup is exempt from the retention policy that is defined in the recovery window. For long term backups, you must use External FRA (NFS location) or Objectstore backup policy.

  • Archivelog: This is a backup of all archive logs not yet backed up to the backup destination, such as Internal FRA, External FRA (NFS location), or Object Store.

When a database is modified with a backup configuration, database backup schedule and archive logs backup schedules are created automatically. Automatic database backup schedule creates a level 0 backup on Level 0 Backup Day, by default, on Sunday, and level 1 on the remaining days of the week. Also, automatic archive logs backup schedules creates archive logs backup for the database with a default frequency of 30 minutes. These backup schedules can be edited to enable or disable or change the frequency using cron expression.

Backup to Disk

When you backup to disk, you are using the Oracle Fast Recovery Area (FRA) of the disk. FRA is a storage directory that allows backup and recovery operations on Oracle databases. The directory contains archived redo logs, backup pieces and copies, and the control file.

Advantages to backing up to disk are as follows:

  • Quick recovery from backups stored on disk

  • Automate management of recovery related files (like archived logs)

Note:

  • When you backup to disk, the data for non-TDE database is not encrypted and RMAN backup encryption are not allowed. In addition, backup to disk requires a lot of disk space (up to two to three times the size of the database).
  • If the database is TDE-enabled, then the RMAN backup encryption password is not required, irrespective of the backup destination.

The following is a high-level overview of the workflow for backup and recovery when using a disk:

  1. Create a backup policy to define the backup destination (disk) and recovery window for the disk destination.

  2. Create a database and attach the backup policy to the database. When the backup policy is associated with a database, archive logs backups and database backups are automatically created.

  3. Manage obsolete backups.

  4. Recover the database from a backup on the disk.

Backup to External FRA (Network File System)

Specifying a Network File System (NFS) location for backups, enables you to safely and securely store or retrieve a database backup at any time.

The advantages of using NFS backup location are:

  • With NFS, you can access remote files, locally, by mounting local file systems on a network.

  • Provides a centralized backup location, without requiring manual refresh.

  • Supports enhanced security options using firewalls and Kerberos.

  • Support for encrypted backups using passwords. You optionally, set the backup password, and provide the same during restore operation.

  • The RMAN Backup Encryption password is applicable for databases that do not have TDE enabled. If the database has TDE enabled, then the RMAN backup password is not required, irrespective of the backup destination.

The following is a high-level overview of the workflow for backup and recovery when using an NFS location:

  1. Create a mount point for the NFS location.

    The mount point must be accessible from both nodes. The oracle user must have read/write permissions to the NFS location. If the request is being made to a remote server, ensure that it is running. See Creating a Mount Point for NFS Backup Location for the procedure to create a mount point.

  2. Create a backup policy specifying the NFS location, and the recovery window for NFS destination.

  3. Associate the database with this backup policy, either during database creation, or by updating the backup policy for the database.

  4. Backups are automatically scheduled, and you can also run manual backups. You can specify manual backup options in the Browser User Interface or using ODACLI commands.

  5. Manage obsolete backups.

  6. Restore from backup. When you save your backups to NFS, you can restore the database to the same system or to a different system.

  7. Recover the database from a backup on NFS.

Backup to Oracle Object Storage

Oracle Object Storage is a highly secure, scalable storage platform that enables you to safely and securely store or retrieve a database backup at any time. Data and the associated metadata are stored as an object in a logical container (bucket). Oracle Database Appliance creates a Backup Report and a unique ID to identify each backup.

Oracle Object Storage is tightly integrated with Oracle Cloud Infrastructure Identity and Access Management. The data, user-defined metadata associated with the data, and encryption keys are automatically encrypted using 256-bit Advanced Encryption Standard (AES- 256). The encryption keys are rotated frequently and cannot be disabled. By default, only authenticated users that have explicitly been granted access to specific resources can access data stored in Oracle Object Storage. Data is uploaded and downloaded over SSL endpoints using the HTTPS protocol.

When you backup to Oracle Object Storage, you are using your backup policy and your Oracle ObjectStoreSwift credentials. The credentials are stored in an encrypted Oracle wallet. You can attach the credentials to one or more backup policies.

Note:

Credentials are validated when you create the backup policy that uses Oracle Object Storage. The credentials are not validated against the URL and tenancy.

Advantages to using Oracle Object Storage are as follows:

  • Backups are encrypted using the password for non-TDE databases. For TDE-enabled databases, backups are encrypted by default and do not require the RMAN backup encryption password to be specified separately.

    Caution:

    Save the password that you use during backups in a safe location, you must provide the password during recovery operations.
  • Quick recovery from backups. With the Oracle Object Storage, you can safely and securely use the Browser User Interface to store or retrieve data directly from within the cloud platform, at any time. 

  • Automate management of recovery related files (like archived logs)

  • Oracle Object Storage is not directly accessed by the operating system, instead it uses APIs to access the storage at the application level.

The following is a high-level overview of the workflow for backup and recovery when using Oracle Object Storage:

  1. Create an Object Store object with your credentials.

  2. Create a backup policy to define the backup location (Object Store), Object Store Credentials Name, the container (bucket) name where you want to store backups, and the recovery window.

  3. Create a database and attach the backup policy either as a part of creating the database, or update the database with backup policy after creating the database. When the backup policy is associated with a database, backups are automatically created.

  4. Manage obsolete backups.

  5. Restore from backup. When you save your backups to Oracle Object Storage, you can restore the database to the same system or to a different system.

  6. Recover the database from a backup on Oracle Object Storage.

Note:

Before you can use this backup option, you must create an Oracle Cloud Infrastructure Object Storage account. When you create the account, you define the account credentials, end point URL, and bucket. Go to the Oracle Store and sign up for Oracle Cloud Infrastructure Object Storage.

Backup Reports

A backup report is generated for each backup and is similar to, but does not replace, a recovery catalog. The report contains the Oracle Database Appliance information and metadata needed to restore or recover a database. The Backup Report is designed to keep track of all of the information required to restore or recover a database.

The following is an example of a level 1 backup report:

{
  "id" : "2d82460c-d648-4e75-8c7d-72cc90bc442a",
  "dbResId" : "b5fc646e-01a6-4c8b-8286-7633346c4329",
  "tag" : null,
  "dbId" : "2717054291",
  "dbName" : "HRDbO",
  "dbUniqueName" : "HRDbOu",
  "backupType" : "REGULAR-L1",
  "keepDays" : null,
  "backupLocation" : "https://swiftobjectstorage.us-phoenix-1.oraclecloud.com/v1/dbaasimage/backupbucket",
  "cfBackupHandle" : "c-2717054291-20171108-04",
  "spfBackupHandle" : "c-2717054291-20171108-04",
  "pitrTimeStamp" : "November 08, 2017 12:43:14 PM UTC",
  "pitrSCN" : "1175058",
  "resetLogsTimeStamp" : "November 08, 2017 09:55:34 AM UTC",
  "resetLogsSCN" : "1112268",
  "oraHomeVersion" : "12.2.0.1.170814 (26723265, 26609817)",
  "sqlPatches" : "25811364,26609817",
  "backupLogLoc" : "https://swiftobjectstorage.us-phoenix-1.oraclecloud.com/v1/dbaasimage/backupbucket/scaoda702c1n1/rmanlog/HRDbOu/2717054291/2017-11-08/rman_backup_2017-11-08_12-42-41.0545.log",
  "tdeWalletLoc" : null,
  "dbConfigLoc" : "https://swiftobjectstorage.us-phoenix-1.oraclecloud.com/v1/dbaasimage/backupbucket/scaoda702c1n1/dbconfig/HRDbOu/2717054291/2017-11-08/DBCONFIG_TAG20171108T124407_2017-11-08_12-44-07.0533.tar.gz",
  "name" : "Backup_Report_HRDbO",
  "createTime" : "November 08, 2017 12:42:08 PM UTC",
  "state" : {
    "status" : "CONFIGURED"
  },
  "updatedTime" : "November 08, 2017 12:44:12 PM UTC",
  "backupReportLogDetail" : "https://swiftobjectstorage.us-phoenix-1.oraclecloud.com/v1/dbaasimage/backupbucket/scaoda702c1n1/rmandetaillogreport/HRDbOu/2717054291/2017-11-08/rman_list_backup_detail_2017-11-08_12-44-04.0362.log",
  "dbInfo" : {
    "dbClass" : "OLTP",
    "dbType" : "RAC",
    "dbShape" : "odb1",
    "dbEdition" : "EE",
    "dbStorage" : "ASM"
  },
  "dbDataSize" : "1542M",
  "dbRedoSize" : "16403M"
}

About Backup of TDE Wallet

When the database backup is performed, the TDE wallet backup is also taken. The database backup can be of any type like regular-L0, regular-L1, longterm and archivelog. Use the odacli list-tdebackupreports command to view the latest TDE wallet backup in a backup destination. For example, if a TDE-enabled database named tdedb1 was attached with Disk, and then NFS, and later Oracle Object Storage backup configuration, and the database was backed up to each of these backup destination eventually, then the odacli list-tdebackupreports command lists three entries of TDE wallet backup corresponding to Disk, NFS and Oracle Object Storage backup destination, respectively, for the database tdedb1. The reason for selecting the latest copy is that the TDE wallet is a cumulative wallet, that is, all previous changes, such as re-key operation is available in the latest TDE wallet itself.

About Recovery Options

The recovery in Oracle Database Appliance always performs a full database restore or recover. The recovery options are LATEST, PITR, SCN, and BackupReport.

The following types of recovery are available:

  • LATEST: Performs a complete recovery (valid backups and all required archived logs and online redo logs must be available)

  • PITR: Point-in-Time Recovery that performs a recovery to a specified timestamp within the current incarnation of database

  • SCN: SCN-based recovery that performs a recovery is an incomplete recovery to a specified SCN within the current incarnation of database.

  • BackupReport: Performs a recovery based on the Backup Report SCN. The BackupReport option is similar to SCN, except that the recovery uses the Backup Report SCN instead of a specified SCN.

Point-in-Time Database Recovery

Point-in-Time Recovery (PITR) recovers the database to a specific point-in-time. You must specify the timestamp for this type of recovery.

A point-in-time recovery is often used for the following situations:

  • You want to recover the database to an SCN before a user or administrative error.

  • Complete database recovery failed because all necessary archived redo logs were not available.

  • A database upgrade fails.

  • You are creating a test database or a reporting database from production database backups.

System Change Number Recovery

A system change number (SCN) is a stamp that defines a committed version of a database at a point in time. Oracle assigns every committed transaction a unique SCN. You can recover a database to the latest time or to an SCN.

The database is restored from backups created before the target time, and then applies incremental backups and logs to re-create all changes between the time of the data file backups and the end point of recovery. When the end point is specified as an SCN, the database applies the redo logs and stops after each redo thread or the specified SCN, whichever occurs first. When the end point is specified as a time, the database internally determines a suitable SCN for the specified time and then recovers to this SCN.

SCN is a primary mechanism to maintain data consistency in Oracle database. With each execution, there is an increase in the count of the SCN. The following are some examples of areas that use SCN:

  1. Redo records. Every redo record has an SCN version of the redo record in the redo header (redo records can have non-unique SCN). Given redo records from two threads (as in the case of RAC), recovery will order them in SCN order, essentially maintaining a strict sequential order.

  2. Data block. Every data block has block SCN (block version). In addition to that, a change vector in a redo record also has expected block SCN. This means that a change vector can be applied to one and only version of the block. Code checks if the target SCN in a change vector is matching with the block SCN before applying the redo record. If there is a mismatch, corruption errors are thrown.

  3. Read consistency. Every query has query environment which includes an SCN at the start of the query. A session can see the transactional changes only if that transaction commit SCN is lower then the query environment SCN.

  4. Commit. Every commit generates an SCN (commit SCN) that marks a transaction boundary. Group commits are possible too.

Restoring Archive Logs

The database auto backup policies - Regular-L0, and Regular-L1 delete archivelog, which could be essential in later process, such as in configuration or reinstate operations for Oracle Data Guard. Oracle Database Appliance supports restore of archive logs for a database. You can choose to restore archive logs from one SCN to another SCN, or from one timestamp to another timestamp.

Run the command odacli restore-archivelog specifying the SCN or timestamp period.

Obsolete Database Backups

It is important to remove older backups once they become obsolete. The type of backup and the recovery window that you define in the database backup policy determines when database backups become obsolete.

For level 0, level 1, and archivelog backups, run the command odacli delete-backup for a given Database Resource Identifier to delete obsolete backups and backup reports based on the defined recovery window.

For Longterm backups, provide the corresponding backup report as an input and use the command odacli delete-backup to delete the backups from Oracle Object Storage or NFS backup location and the back report you specify in the command.

Typically, older level 0 and level 1 database backups are considered obsolete based on the defined recovery window and those obsolete backups are deleted when you run the odacli delete-backup command. The defined recovery window is as follows:
  • Disk: 1-14 days

  • Object Storage: 1-30 days

Starting with Oracle Database Appliance release 19.15, on attaching a backup policy to a database, the DCS agent creates a scheduler for deleting the database backup. It deletes the obsolete backups and backup reports for the database. By default, the frequency of this delete backup scheduler is once a week. It runs on every Monday to delete obsolete backups and backup reports of the database. The delete backup scheduler can be edited to disable it or to change its frequency.

Configuring NFS Backup and Restore on Oracle Database Appliance

To backup databases to Network File System (NFS) location or to restore the database from NFS location, you must configure the NFS backup location to ensure that Oracle Database Appliance can perform read and write operations.

Following are the steps to configure the NFS location, backup database to NFS location, and restore database as a standby database from the NFS backup location.

Configuring an NFS Backup Location

Configure Network File System (NFS) backup location, to set up the NFS backup and mount the NFS client location on Oracle Database Appliance.

An NFS setup involves an NFS server location and an NFS client location. While performing database backup operation, it is recommended that you configure the NFS server location on a different system, than the system where the source database, that is, the database to be backed up, is running. This ensures the database backups are not lost, even if the system where the source database is running, is corrupted or lost. However, the NFS client location must be configured on the same machine where the database is running, to perform database backup operation. Also, while performing database restore operation, the NFS client location must be configured on the same system where the database must be restored.

Note:

  • An NFS backup configuration object must be created and attached to the database. This NFS backup location is a mandatory parameter to create a NFS backup configuration object.
  • For TDE-enabled database, Oracle Database Appliance requires the backup path to be different for database and TDE wallet, as per security guidelines. If the source database is TDE-enabled, then configure another NFS client location following the steps in this topic.
Run the following steps on the NFS server:
  1. Create an Oracle ADVM volume and format the volume as Oracle ACFS, on any node, for example, node0, of a different Oracle Database Appliance system, as the grid operating system user.
    [root@***** ~]# su - grid
     
    [grid@***** ~]# asmcmd
     
    ASMCMD> volcreate -G data -s 100G backup
     
    ASMCMD> volinfo -G data backup
    Diskgroup Name: DATA
    Volume Name: BACKUP
    Volume Device: /dev/asm/backup-322
    State: ENABLED
    Size (MB): 102400
    Resize Unit (MB): 64
    Redundancy: HIGH
    Stripe Columns: 8
    Stripe Width (K): 4096
    Usage:
    Mountpath:
    ASMCMD> exit
    [grid@***** ~]$ mkfs -t acfs /dev/asm/backup-322
    mkfs.acfs: version = 19.0.0.0.0
    mkfs.acfs: on-disk version = 46.0
    mkfs.acfs: volume = /dev/asm/backup-322
    mkfs.acfs: volume size = 107374182400 ( 100.00 GB )
    mkfs.acfs: Format complete.
     
    [grid@***** ~]$ exit
  2. Create an operating system directory as the root user to export Oracle ACFS volume created in the previous step.
    [root@***** ~]# mkdir /nfs_backup_server
  3. Register the file system with Oracle Clusterware and start the file system as the root user.
    [root@***** ~]# /u01/app/19.13.0.0/grid/bin/srvctl add filesystem -d /dev/asm/backup-322 -path /nfs_backup_server -mountowner oracle -mountgroup asmadmin
    [root@***** ~]#/u01/app/19.13.0.0/grid/bin/srvctl start filesystem -d /dev/asm/backup-322
  4. Identify the owner and group of the DBHOME/bin/oracle binary of the source database and set the directory ownership to the same owner and group. In the following example, the owner and group of the DBHOME/bin/oracle binary are oracle and asmadmin respectively. Hence, the ownership of NFS server location is set to the same. The permissions of the directory must be set to 750.
    [root@***** ~]# ls -ltr /u01/app/odaorahome/oracle/product/19.0.0.0/dbhome_1/bin/oracle
        -rwsr-s--x 1 oracle asmadmin 449234896 Sep 21 11:39 /u01/app/odaorahome/oracle/product/19.0.0.0/dbhome_1/bin/oracle
         
    [root@***** ~]# chown oracle:asmadmin /nfs_backup_server
    [root@***** ~]# chmod 750 /nfs_backup_server
    [root@***** ~]# ls -ld /nfs_backup_server
        drwxr-x--- 2 oracle asmadmin 4096 Sep 21 12:25 /nfs_backup_server
  5. When NFS server location and NFS client location are on different systems, then there may be cases where the IDs of the oracle user and the asmadmin group may be different. If the IDs of the oracle user and the asmadmin group are the same, then do not run step 6. In the following example, the ID of oracle user is 1001 on the NFS server system and 1000 on the NFS client system.
    Output of the system where the NFS server location is configured:
         
        [root@***** ~]# id oracle
        uid=1001(oracle) gid=1001(oinstall) groups=1001(oinstall),1006(asmdba),1003(dba),1002(dbaoper)
         
         
        Output of the system where the NFS client location is configured:
         
        [root@***** ~]# id oracle
        uid=1000(oracle) gid=1001(oinstall) groups=1001(oinstall),1006(asmdba),1003(dba),1002(dbaoper)
    
    In such a case, the ownership of the NFS server location must be set to the same ID as the oracle useron the system where the NFS client location is configured. The ownership of the /nfs_backup_server location must be set to 1000 as follows:
     [root@***** ~]# chown 1000:asmadmin /nfs_backup_server/
  6. Export the NFS server location to the systems where the NFS client location is created.
    [root@***** ~]#  cat /etc/exports
        /nfs_backup_server Node0_NFS_Client_Location_IP(rw,sync,no_root_squash)
        /nfs_backup_server Node1_NFS_Client_Location_IP(rw,sync,no_root_squash)
    Note that the NFS mount option must be (rw,sync,no_root_squash). Starting with Oracle Database Appliance release 19.17, there is no dependency on NFS mount option no_root_squash, It can then be (rw,sync).
  7. Restart the NFS server.
    Command on Oracle Linux 7 systems:
         [root@***** ~]# /bin/systemctl restart nfs.service
         
    Command on Oracle Linux 8 systems:
          [root@***** ~]# /bin/systemctl restart nfs-server
  8. Verify the mount point using the showmount -e command.
    [root@***** ~]# showmount -e
        Export list for *****:
        /nfs_backup_server       Node0_NFS_Client_Location_IP,Node1_NFS_Client_Location_IP
Follow these steps to mount the NFS location on Oracle Database Appliance. If the source database is on an Oracle Database Appliance high-availability system, then run the following steps on both nodes.
  1. Create a NFS client location as the root user.
    [root@***** ~]# mkdir /nfs_backup_client
  2. Mount the NFS client location on to the NFS server location, using the IP address of the system where the NFS server location is configured.
    [root@***** ~]# mount -t nfs NFS_Server_Location_IP:/nfs_backup_server /nfs_backup_client

Backing Up the Database to NFS Location

To backup a database to NFS location on Oracle Database Appliance, you must create an NFS backup configuration object and then attach the same to the database.

The relationship between NFS backup configuration object and database is one-to-many, that is, you can attach one NFS backup configuration object to multiple databases. Use the NFS backup location that you configured in the Configuring an NFS Backup Location topic to create an NFS backup configuration object.
Follow these steps to backup a database to an NFS location:
  1. Create the NFS backup configuration with the NFS backup location using the odacli create-backupconfig command. In the following sample output, the NFS backup location, specified using the -c option, is /nfs_backup_client/, the name of the NFS backup configuration object, specified using the -n option is nfsbcfg, the destination, specified using the -d option is nfs and the retention period, specified using the -w option is 1 day.
    If the source database is TDE-enabled, then along with database backup location, specified using the -c option, the TDE wallet location must also be specified using the -f option. The TDE backup path must be different from the database backup path and can be configured in the same way as the database backup path.
    #  odacli create-backupconfig -n nfsbcfg -d nfs -c /nfs_backup_client/ -w 1
        {
          "jobId" : "0a86bd50-7ac7-4d6d-af4b-1ee2c4d451d5",
          "status" : "Created",
          "message" : "backup config creation",
          "reports" : [ ],
          "createTimestamp" : "September 21, 2022 17:02:21 PM UTC",
          "resourceList" : [ {
            "resourceId" : "023eb9ac-a4d0-4071-a358-c904791d15d7",
            "resourceType" : null,
            "resourceNewType" : "BackupConfig",
            "jobId" : "0a86bd50-7ac7-4d6d-af4b-1ee2c4d451d5",
            "updatedTime" : null
          } ],
          "description" : "create backup config:nfsbcfg",
          "updatedTime" : "September 21, 2022 17:02:21 PM UTC"
        }
         
     #  odacli describe-job -i 0a86bd50-7ac7-4d6d-af4b-1ee2c4d451d5
         
        Job details                                                     
        ----------------------------------------------------------------
                             ID:  0a86bd50-7ac7-4d6d-af4b-1ee2c4d451d5
                    Description:  create backup config:nfsbcfg
                         Status:  Success
                        Created:  September 21, 2022 5:02:21 PM UTC
                        Message:  backup config creation
         
        Task Name                                Start Time                          End Time                            Status   
        ---------------------------------------- ----------------------------------- ----------------------------------- ----------
        Backup config metadata persist           September 21, 2022 5:02:21 PM UTC   September 21, 2022 5:02:21 PM UTC   Success  
  2. Attach the NFS backup configuration object to the database using the odacli modify-database command.
    #  odacli modify-database -in mydb -bin nfsbcfg
        {
          "jobId" : "4cd995f1-feb4-413e-a863-71e87cc97cff",
          "status" : "Created",
          "message" : "Modify database",
          "reports" : [ ],
          "createTimestamp" : "September 21, 2022 17:37:13 PM UTC",
          "resourceList" : [ {
            "resourceId" : "09b476c2-8f09-4636-9233-d8789c320b25",
            "resourceType" : "DB",
            "resourceNewType" : null,
            "jobId" : "4cd995f1-feb4-413e-a863-71e87cc97cff",
            "updatedTime" : "September 21, 2022 17:37:13 PM UTC"
          } ],
          "description" : "Modify database : mydb",
          "updatedTime" : "September 21, 2022 17:37:13 PM UTC"
        }
         
      # odacli describe-job -i 4cd995f1-feb4-413e-a863-71e87cc97cff
         
        Job details                                                     
        ----------------------------------------------------------------
                             ID:  4cd995f1-feb4-413e-a863-71e87cc97cff
                    Description:  Modify database : mydb
                         Status:  Success
                        Created:  September 21, 2022 5:37:13 PM UTC
                        Message:  Modify database
         
        Task Name                                Start Time                          End Time                            Status   
        ---------------------------------------- ----------------------------------- ----------------------------------- ----------
        Validate OMF parameter values            September 21, 2022 5:37:18 PM UTC   September 21, 2022 5:37:19 PM UTC   Success  
        update db with backupconfig attributes   September 21, 2022 5:37:34 PM UTC   September 21, 2022 5:37:39 PM UTC   Success  
        Enable Database Autobackup               September 21, 2022 5:37:39 PM UTC   September 21, 2022 5:37:39 PM UTC   Success  
        Enable Archivelog Autobackup             September 21, 2022 5:37:39 PM UTC   September 21, 2022 5:37:39 PM UTC   Success  
        Configure Control file Auto Backup Format September 21, 2022 5:37:39 PM UTC   September 21, 2022 5:37:42 PM UTC   Success  
        Backup Current Control file              September 21, 2022 5:37:42 PM UTC   September 21, 2022 5:37:50 PM UTC   Success  
        Update metadata for database:mydb        September 21, 2022 5:37:50 PM UTC   September 21, 2022 5:37:50 PM UTC   Success
  3. Backup the database using the odacli create-backup command. For example, you can take a backup type called Regular-L0 with archivelog using the -ka option.
    Note that you must take the backup with the -ka option, if you want to restore the backup as a standby database only for Oracle Database Appliance releases earlier than 19.12. From Oracle Database Appliance release 19.12 and later, the -ka option is not mandatory for restoring the database as standby.
     # odacli create-backup -in mydb -bt regular-l0 -ka
        {
          "jobId" : "6dc7ae65-93e3-4dc2-b4a7-563c8f98b01a",
          "status" : "Created",
          "message" : null,
          "reports" : [ ],
          "createTimestamp" : "September 21, 2022 17:39:03 PM UTC",
          "resourceList" : [ ],
          "description" : "Create regular-l0 Backup[TAG:auto][Db:mydb][NFS:/nfs_backup_client/orabackups/scaoda823-c/database/3031000803/mydb]",
          "updatedTime" : "September 21, 2022 17:39:03 PM UTC"
        }
         
     #  odacli describe-job -i 6dc7ae65-93e3-4dc2-b4a7-563c8f98b01a
         
        Job details                                                     
        ----------------------------------------------------------------
                             ID:  6dc7ae65-93e3-4dc2-b4a7-563c8f98b01a
                    Description:  Create regular-l0 Backup[TAG:auto][Db:mydb][NFS:/nfs_backup_client/orabackups/scaoda823-c/database/3031000803/mydb]
                         Status:  Success
                        Created:  September 21, 2022 5:39:03 PM UTC
                        Message: 
         
        Task Name                                Start Time                          End Time                            Status   
        ---------------------------------------- ----------------------------------- ----------------------------------- ----------
        Validate backup config                   September 21, 2022 5:39:05 PM UTC   September 21, 2022 5:39:05 PM UTC   Success  
        NFS location existence validation        September 21, 2022 5:39:05 PM UTC   September 21, 2022 5:39:05 PM UTC   Success  
        Backup Validations                       September 21, 2022 5:39:05 PM UTC   September 21, 2022 5:39:11 PM UTC   Success  
        Recovery Window validation               September 21, 2022 5:39:11 PM UTC   September 21, 2022 5:39:13 PM UTC   Success  
        Archivelog deletion policy configuration September 21, 2022 5:39:13 PM UTC   September 21, 2022 5:39:16 PM UTC   Success  
        Database backup                          September 21, 2022 5:39:16 PM UTC   September 21, 2022 5:40:27 PM UTC   Success  
  4. Oracle Database Appliance creates a backup report corresponding to each backup. Identify the backup report of the above database backup job using the odacli list-backupreports command. Describe the backup using the odacli describe-backupreport - backupreport_id command and save its output to a JSON file, as shown in the following example. After the JSON file for the backup report is ready, copy the file to the target system where you want to restore the database backup.
    # odacli list-backupreports | grep -i mydb
      496d6e76-d061-4bc2-ae0a-b3325eaa15fa     09b476c2-8f09-4636-9233-d8789c320b25     3031000803    mydb       mydb           regular-l0   auto         September 21, 2022 5:39:16 PM UTC   September 21, 2022 5:39:16 PM UTC   Configured   
    # odacli describe-backupreport -i 496d6e76-d061-4bc2-ae0a-b3325eaa15fa > mydb.json

Restoring the Database from NFS Backup

Understand the steps to restore a database from NFS location.

Follow these steps to restore a database from an NFS location:
  1. The NFS client location must be created on both the nodes of the Oracle Database Appliance system as the root user.
    [root@***** ~]# mkdir /nfs_backup_client 
  2. At the server system, export the NFS server location to the Oracle Database Appliance system using the IP address of the Oracle Database Appliance system.
    [root@***** ~]#  cat /etc/exports
        /nfs_backup_server <Node0_target_machine_IP>(rw,sync,no_root_squash)
        /nfs_backup_server <Node1_target_machine_IP>(rw,sync,no_root_squash)
    For Oracle Database Appliance release 19.16 and earlier, you must specify the no_root_squash parameter. Starting with Oracle Database Appliance release 19.17, you need not specify the no_root_squash parameter.
  3. Restart the NFS server on the system with the NFS server location.
    Command on Oracle Linux 7 systems:
         [root@***** ~]# /bin/systemctl restart nfs.service
         
    Command on Oracle Linux 8 systems:
          [root@***** ~]# /bin/systemctl restart nfs-server
  4. Restore the database.
    # odacli irestore-database -r mydb.json
        Enter SYS user password:
        Retype SYS user password:
        {
          "jobId" : "85a8792a-ca9b-4a50-8202-11d63949d3f2",
          "status" : "Created",
          "message" : null,
          "reports" : [ ],
          "createTimestamp" : "September 21, 2022 17:43:06",
          "resourceList" : [ ],
          "description" : "Database service recovery with db name: mydb",
          "updatedTime" : "September 21, 2022 17:43:06"
        }
         
     # odacli describe-job -i 85a8792a-ca9b-4a50-8202-11d63949d3f2
         
        Job details                                                     
        ----------------------------------------------------------------
                             ID:  85a8792a-ca9b-4a50-8202-11d63949d3f2
                    Description:  Database service recovery with db name: mydb
                         Status:  Success
                        Created:  September 21, 2022 5:43:06 PM UTC
                        Message: 
         
        Task Name                                Start Time                          End Time                            Status   
        ---------------------------------------- ----------------------------------- ----------------------------------- ----------
        Check if cluster ware is running         September 21, 2022 5:43:30 PM UTC   September 21, 2022 5:43:30 PM UTC   Success  
        Check if cluster ware is running         September 21, 2022 5:43:30 PM UTC   September 21, 2022 5:43:30 PM UTC   Success  
        Creating DbStorage for DbRestore         September 21, 2022 5:43:30 PM UTC   September 21, 2022 5:48:36 PM UTC   Success  
        Validating dbHome available space        September 21, 2022 5:43:30 PM UTC   September 21, 2022 5:43:30 PM UTC   Success  
        Validating dbHome available space        September 21, 2022 5:43:30 PM UTC   September 21, 2022 5:43:30 PM UTC   Success  
        Validating DiskSpace for DATA            September 21, 2022 5:43:30 PM UTC   September 21, 2022 5:43:31 PM UTC   Success  
        Generating SSH key                       September 21, 2022 5:43:31 PM UTC   September 21, 2022 5:43:31 PM UTC   Success     
        .
        .
        .
        Reset Associated Networks                September 21, 2022 6:30:03 AM UTC   September 21, 2022 6:30:04 AM UTC   Success  
        Set log_archive_dest for Database        September 21, 2022 6:30:04 AM UTC   September 21, 2022 6:30:11 AM UTC   Success 

Configuring Agent Proxy Settings for Object Store Access

If the Object Store IP address is accessible only through proxy setup by the Oracle Database Appliance server, then define the proxy setting for the agent, so that the agent can access the Object Store.

To create a backup policy that uses Object Store location, the agent must be able to access the Object Store URL.
  1. Define the HttpProxyHost and HttpProxyPort settings in the update-agentconfig-parameters command.
     # odacli update-agentconfig-parameters -n HttpProxyHost -v www-proxy.test.com -n HttpProxyPort -v 80 -u
    
    Job details
    ----------------------------------------------------------------
    ID: 0b0cbf9b-b0ab-4523-a096-5da4e48fc825
    Description: Update agent configuration parameter values [HttpProxyHost, HttpProxyPort]
    Status: Created
    Created: October 23, 2018 4:56:53 PM IST
    Message:
    
    Task Name Start Time End Time Status
    ----------------------------------------

    For more information about the update-agentconfig-parameters command usage, see the Oracle Database Appliance Command-Line Interface.

  2. Verify that the update succeeded:
    # odacli describe-job -i 0b0cbf9b-b0ab-4523-a096-5da4e48fc825
    
    Job details
    ----------------------------------------------------------------
    ID: 0b0cbf9b-b0ab-4523-a096-5da4e48fc825
    Description: Update agent configuration parameter values [HttpProxyHost, HttpProxyPort]
    Status: Success
    Created: October 23, 2018 4:56:53 PM IST
    Message:
    
    Task Name Start Time End Time Status
  3. Run the list-agentconfigParameters command to view the changes in the proxy settings:
    # odacli list-agentConfigParameters
    
    Name Value Description Updated
    ------------------------------ ----------------------------------------
    HttpProxyHost www-proxy.test.com October 23, 2018 4:56:53 PM IST
    HttpProxyPort 80 October 23, 2018 4:56:53 PM IST
    HttpsProxyHost Https proxy server host October 23, 2018 12:23:21 AM IST
    HttpsProxyPort Https proxy server port October 23, 2018 12:23:21 AM IST
    OSPatchRepos Repo list for OS patching October 23, 2018 12:23:21 AM IST
You can now use the Browser User Interface or the command-line interface to create a backup policy to use the ObjectStore location for backup.

Creating a Database Backup Policy

Understand how to create a policy to backup a database to an internal or external Oracle Fast Recovery Area (FRA) location or to the Object Store using the Browser User Interface.

The backup policy defines the backup, including the location where you want to store the backups and the recovery window. Backup to disk requires a lot of disk space (up to two to three times the size of the database).

Follow these steps to create a backup policy from the Browser User Interface:

  1. Click the Database tab in the Browser User Interface.
  2. Click Backup Policy in the left navigation to display a list of backup policies.
  3. Click Create Backup Policy.
  4. Enter a name for the backup policy and select the number of days for the recovery window. Select Enable Crosscheck to determine if the files on the disk or in the media management catalog correspond to data in the RMAN repository. The Enable Compression checkbox is selected by default. Selecting this option ensures backups are compressed. Select one of the following as the backup destination:
    • To backup to disk, select Internal FRA as the backup destination.
    • To backup to the cloud, select ObjectStore as the backup destination. If you have more than one Object Store, then select the Object Store Credential Name from the list. Enter a name in the Container Name field.
    • To backup to an NFS location, select External FRA as the backup destination, and specify the NFS mount point location.
    • To not define a destination, select None.
    The Backup Policy name must begin with an alpha character and contain only alphanumeric characters.
  5. You must specify the TDE Wallet Backup Location to associate the backup configuration to a TDE-enabled database.
  6. Click Create. Click Yes to confirm that you want to create the backup policy.
    A link to the job appears. When the job completes successfully, the backup configuration is ready.
Update an existing database to attach the backup configuration to the database using the ID or Name. When you attach the backup configuration to a database, the DCS agent schedules daily automatic backups for the database and automatic backups for archivelog of the database.

Updating a Database with a Backup Policy

Attach a backup policy to a database to define the database backup attributes and destination.

  1. In the Browser User Interface, click the Database tab.
  2. For the database that you want to modify, select Modify in the Actions drop down list.
  3. In the Modify Database page, select a backup policy from the Select Backup Policy drop down list.
  4. Specify and confirm the Backup Encryption Password.
  5. Click Modify to submit the job.
  6. Click the Activity tab to check the job status.
    When the job completes successfully, the backup policy is associated with the database.

Updating a Backup Policy

Use the Browser User Interface to update the recovery window, change the ObjectStore Credential, or change the crosscheck option for a backup policy.

Crosscheck determines if the files on the disk on in the media management catalog correspond to data in the RMAN repository.
  1. Click the Database tab in the Browser User Interface.
  2. Click Backup Policy in the left navigation to display a list of backup policies.
  3. Expand the Actions menu for a backup policy, then click Update.
  4. To change the recovery window, use the up or down arrow to change the number of days.
  5. To enable or disable the crosscheck, select or deselect Enable Crosscheck.
  6. Click Update. Click Yes to confirm that you want to update the backup policy.
    A link to the job appears. When the job completes successfully, the backup configuration is ready.

Backing Up a Database Using the Browser User Interface

Apply a backup policy to a database, create a manual backup, update a database backup schedule, or update an archive log backup scheduler.

You can use the Browser User Interface or the command-line interface to create a database backup. In the command-line interface, use the command odacli create-backup for a specified Database.
Before creating a database backup, you must have a backup policy. The backup policy defines the recovery window and the backup destination. You must associate a backup policy with the database, otherwise you cannot create backups.

Follow these steps to backup a database from the Browser User Interface:

  1. In the Browser User Interface, click the Database tab.
  2. Click a database name to select a database from the list.
  3. Review the database information, including the backup policy name and destination details. To select a backup policy for the database, click Apply Backup Policy. Select a policy and specify the Backup Encryption Password. For TDE-enabled databases, backups are encrypted by default and do not require the RMAN backup encryption password to be specified separately. For databases that do not have TDE enabled, the Backup Encryption Password is mandatory for Objectstore backup destination, optional for NFS backup destination and not required for Disk backup destination.
  4. Click Manual Backup, Update Database Backup Schedule or Update Archive Log Backup Schedule.
    If the action is disabled, then apply a backup policy.
  5. Click Yes to confirm the job.
    A link to the job appears. When the job completes successfully, the backup is ready. A list of backups appears at the bottom of the page.

Viewing Backup Reports

Understand how you can use the Browser User Interface to view backup reports.

A report is generated when a database backup is performed. The backup report lists the type, location, and date and timestamp of the backup.
  1. In the Browser User Interface, click the Database tab, then click the database name in the list of databases.
    Information about the database appears on the Database Information page.
  2. Scroll to the bottom of the page to view a list of Backups.
  3. Click the Job ID for a backup to view the Backup Report and more details about the backup.

Recovering a Database Using the Browser User Interface

Understand the recovery options available for recovering a database.

  1. In the Browser User Interface, click the Database tab, then select a database from the list.
  2. On the Database Information page, click Recover.
  3. On the Recover Database page, select any of the following recovery options:

    Recover Full Database to the specified Backup: Select the existing backup from which you want to recover the database

    Recover Full Database to the Latest: Select this option to recover the database from the last known good state, with the least possible data loss.

    Recover Full Database to the specified Timestamp: Specify the timestamp to recover the database.

    Recover Full Database to the System Change Number (SCN): Specify the SCN of the backup from which you want to recover the database.

  4. Specify and confirm the Backup Encryption Password for databases without Transparent Database Encryption (TDE) enabled.
  5. If the database has TDE enabled, then the TDE Wallet Backup Location and TDE Password fields are displayed.
  6. Click the Activity tab to check the job status.
    When the job completes successfully, the database is recovered as per the specified recovery options.

Deleting a Backup Using the Browser User Interface

Use the Browser User Interface to delete database backups.

You can delete Level-0, Level-1, and Archive Log backups anytime. To delete long term backups, you must check the Backup Report for the database to determine when the backup is obsolete.
  1. Click the Database tab in the Browser User Interface.
  2. Click the database name, in blue font, to display more details about the database for which you want to delete the backup.
  3. Click Delete Backups .
  4. Select the Backup type you want to delete, whether Level-0, Level-1, and Archive Log backup or long Term backup, then click Start. Click Yes to confirm that you want to delete the backup.
    A link to the job appears. When the job completes successfully, the backup is deleted.

Deleting a Backup Policy

Use the Browser User Interface to delete a database backup policy.

  1. Click the Database tab in the Browser User Interface.
  2. Click Backup Policy in the left navigation to display a list of backup policies.
  3. Expand the Actions menu for a backup policy, then click Delete. Click Yes to confirm that you want to delete the backup policy.
    A link to the job appears. When the job completes successfully, the backup policy is deleted.

Using the CLI to Backup, Restore, and Recover

Use the command-line interface to backup, restore, and recover databases.

Preparing for Database Backup to Disk

Use the command-line interface to create a policy to backup a database to the Oracle Fast Recovery Area (FRA) of a disk.

You can create a backup policy using the Browser User Interface or the command-line interface. Most of the backup and recovery commands enable you to provide either a resource name or resource ID to identify the database.

Backup to disk or the Backup to Internal FRA option in the Browser User Interface, requires a lot of disk space (up to two to three times the size of the database).

Follow these steps to create a backup policy through the command-line interface:

  1. Create a BackupConfig object (backup configuration) using the command odacli create-backupconfig.
    The backup configuration defines the backup, including the location where you want to store the backups and the recovery window.

    The following example creates a backup configuration named mkg1dailydisk with a backup to disk and a 1 day recovery window.

    # odacli create-backupconfig -d Disk -n mkg1dailydisk -w 1
  2. Check the job status.
    # odacli describe-job -i job_id_from_step1
    When the job completes successfully, the backup configuration is ready.
  3. Update an existing database to attach the backup configuration to the database using the ID or Name.
    When you attach the backup configuration to a database, the DCS agent schedules daily automatic backups for the database and automatic backups for the archivelog.

    The following example uses the Database Resource ID and Backup Configuration ID:

    # odacli modify-database -i d3c4d8f6-5eb7-4f9e-ab27-7bdd5013ac90 -bi 9d942e0a-ba00-4cbc-9bfb-0de83ed279e5 -bp 

    The following example uses the Database Resource Name, mydb and the Backup Configuration Name, mydb:

    # odacli modify-database -in mydb -bin mybcfg

Preparing for Database Backup to NFS Location

Use the command-line interface to create a policy to backup a database to an External FRA (NFS Location).

You can create a backup policy using the Browser User Interface or the command-line interface. Most of the backup and recovery commands enable you to provide either a resource name or resource ID to identify the database.

Backup to NFS location or the Backup to External FRA option in the Browser User Interface, requires creation of an NFS mount point.

Follow these steps to create a backup policy through the command-line interface:

  1. Create a BackupConfig object (backup configuration) using the command odacli create-backupconfig.
    The backup configuration defines the backup, including the location where you want to store the backups and the recovery window.

    The following example creates a backup configuration named mkg1dailynfs with a backup to disk and a 1 day recovery window.

    # odacli create-backupconfig -d NFS -n mkg1dailynfs -c absolute-path-to-parent-directory-for-NFS-destination -w 1
  2. Check the job status.
    # odacli describe-job -i job_id_from_step1
    When the job completes successfully, the backup configuration is ready.
  3. (Optional) Update an existing database to attach the backup configuration to the database using the ID or Name.
    When you attach the backup configuration to a database, the DCS agent schedules daily automatic backups for the database and automatic backups for the archivelog.

    The following example uses the Database Resource ID and Backup Configuration ID:

    #  odacli modify-database -i d3c4d8f6-5eb7-4f9e-ab27-7bdd5013ac90 -bi 9d942e0a-ba00-4cbc-9bfb-0de83ed279e5 -bp 

    The following example uses the Database Resource Name, mydb and the Backup Configuration Name, mydb:

    # odacli modify-database -in mydb -bin mybcfg -bp
    The -bp option to specify the backup password is optional and is not applicable for TDE-enabled databases.

Preparing for Database Backup to Oracle Cloud

Create a backup configuration to backup a database to Oracle Cloud Infrastructure Object Storage.

Before you can backup to Oracle Object Storage, you must sign up for an Oracle Cloud Infrastructure Object Storage account and know your Oracle Object Storage credentials. When you create an Oracle ObjectStoreSwift object, the command creates and stores the credential details in the system and stores the password in an encrypted Oracle wallet. The Oracle wallet contains the Oracle Object Storage password.

Go to the Oracle Store to sign up for Oracle Cloud Infrastructure Object Storage.

  1. Create an Oracle ObjectStoreSwift object using the command create-objectstoreswift.
    # odacli  create-objectstoreswift -e swift end point URL -n Object Store Swift name -t Object Store tenant name -u Object Store user name

    For example:

    # odacli create-objectstoreswift -e https://swiftobjectstorage.r1.oracleiaas.com/v1 -n ossn1 -t mytenant -u user.name@example.com
    The output includes an objectstoreswift Resource ID to identify an ObjectStoreSwift credential.
  2. Create a BackupConfig object (backup configuration) using the command odacli create-backupconfig .
    The backup configuration defines the backup, including the location (container) where you want to store the backups, the recovery window, and the credentials that are defined in your encrypted Oracle wallet.

    The following example creates a backup configuration named hr_7d_cloud with a backup to the ObjectStore. The following backup parameters are defined: the container is hr_bucket, crosscheck is not enabled, the recovery window is 7 days, and the ObjectStoreSwift Resource ID is provided, which attaches the ObjectStoreSwiftObject to the backup configuration.

     # odacli  create-backupconfig  -n hr_7d_cloud -d ObjectStore -w 7 -o b974f006-5503-4949-ab6c-6f1a56e4ac37 -c hr_bucket -no-cr  

    Note:

    If the ObjectstoreSwift Object was not created with valid credentials, then creating the backup configuration will fail.
  3. Check the job status.
    odacli describe-job -i job_id_from_step2
    When the job completes successfully, the backup configuration is ready.
  4. Update an existing database to attach the backup configuration to the database.
    When you attach the backup configuration to a database, the DCS agent schedules daily automatic backups for the database, automatic backups for the archivelog, and weekly deletion of obsolete backups and backup reports for the database.
    # odacli modify-database -i e3c4d8f6-5eb7-4f9e-ab27-7bdd5013ac10 -bi 7d942e0a-ba00-4cbc-9bfb-0de83ed279e5 -bp 

Note:

When you create a new database, you have the option to associate the database with any type of backup configuration.

Backing Up a Database with the CLI

Create a level 0, level 1, LongTerm database backup, or archivelog backup with the command-line interface.

You can create a database backup in the Browser User Interface or with the command-line interface. When you attach a backup configuration object to a database, the DCS agent automatically schedules daily backups for the database. The day and time are based on the Oracle Database Appliance time zone. The AutoSchedule triggers a level 0 Backup every Sunday, a level 1 the other 6 days of the week, and an archivelog backup every 30 minutes. Use the command odacli update-schedule to disable or change the scheduled backup time.

To create a Long Term database backup, or a level 0 or level 1 backup outside of the automatic backups, use the command odacli create-backup.

Note:

To recover a database, there must be a level 0 backup taken, so that the backup report contains information about the base backup. Restoring a database to the same system with a different DB Name and DB Unique Name or to another system does not always require a long term database backup report. You can use archivelog, or level 0, or level 1 backup reports as well. If you use the archivelog backup report , a prior database backup must exist.To restore a database to another system, you must have a long term database backup in Oracle Object Storage.
  1. Verify that a backup configuration object is associated with the database.
  2. Create a single backup, outside of the automatic backups, using the command odacli create-backup.
    Use the Database Resource ID or Database Name to identify the database to backup, specify the type of backup, and use a tag to create a name for the backup. You can use up to 30 alphanumeric characters for the backup name tag. For example, create a level 0 backup named 2018Jan02_HRLevel0 for resource ID 20576eb1-bc32-4e34-bf97-fda0b60ca15b
    # odacli create-backup -i 20576eb1-bc32-4e34-bf97-fda0b60ca15b -bt Regular-L0 -t 2018Jan02_HRLevel0
    When the job finishes, a backup report is generated for the backup. The report contains all of the metadata required to recover a database.
  3. (Optional) Display a list of backup reports.
    # odacli list-backupreports 

Recovering a Database with the CLI

Recover the database to the system using a Backup Report, point-in-time recovery (PITR), a system change number (SCN), or from the latest backup time.

Recovering a database in Oracle Database Appliance is a full RMAN database recovery.

Recovering from a backup report requires JSON input for the backup report.

When recovering a TDE-enabled database, you need not specify the backup password.

  1. Display a list of backup reports and locate the latest Backup Report for the database and save the Backup Report ID.
    # odacli list-backupreports
  2. Use the Backup Report ID to display the details of the Backup Report. Determine how you want to recover the database: PITR, SCN, or Latest and locate the needed information in the Backup Report.
    # odacli describe-backupreport -i 7fbb06bf-e3a3-4aed-b617-4d1cd3d33387
    {
      "id" : "7fbb06bf-e3a3-4aed-b617-4d1cd3d33387",
      "dbResId" : "4903d18a-6c20-4860-9ed0-d2ea7bd3d7b9",
      "tag" : "auto", 
      "dbId" : "3022438697",
      "dbName" : "tdbasm1",
      "dbUniqueName" : "tdbasm1",
      "backupType" : "regular-l0",
      "keepDays" : null,
      "backupLocation" : "https://swiftobjectstorage.us-ashburn-1.oraclecloud.com/v1/paasdevdbcssi/Bha_Backups",
      "cfBackupHandle" : "c-3022438697-20201022-03",
      "spfBackupHandle" : "c-3022438697-20201022-03",
      "pitrTimeStamp" : "October 22, 2020 07:51:59 AM UTC",
      "pitrSCN" : "2549429",
      "resetLogsTimeStamp" : "October 22, 2020 05:23:56 AM UTC",
      "resetLogsSCN" : "2510142",
      "oraHomeVersion" : "19.8.0.0.200714",
      "sqlPatches" : "31281355",
      "backupLogLoc" : "https://swiftobjectstorage.us-ashburn-1.oraclecloud.com/v1/paasdevdbcssi/Bha_Backups/scaoda8s002-c/database/3022438697/tdbasm1/rmanlog/2020-10-22/rman_backup_auto_2020-10-22_07-51-06.0546.log",
      "tdeWalletLoc" : "https://swiftobjectstorage.us-ashburn-1.oraclecloud.com/v1/paasdevdbcssi/TestLtBackupFailur/scaoda8s002-c/database/3022438697/tdbasm1/tdewallet/ewallet_2020102207525186_tdbasm1.p12",
      "dbConfigLoc" : "https://swiftobjectstorage.us-ashburn-1.oraclecloud.com/v1/paasdevdbcssi/Bha_Backups/scaoda8s002-c/database/3022438697/tdbasm1/dbconfig/2020-10-22/DBCONFIG_auto_2020-10-22_07-52-43.0230.tar.gz",
      "name" : "Backup_Report_tdbasm1",
      "createTime" : "October 22, 2020 07:51:03 AM UTC",
      "state" : {
        "status" : "CONFIGURED"
      },
      "updatedTime" : "October 22, 2020 07:52:55 AM UTC",
      "backupReportLogDetail" : "https://swiftobjectstorage.us-ashburn-1.oraclecloud.com/v1/paasdevdbcssi/Bha_Backups/scaoda8s002-c/database/3022438697/tdbasm1/rmandetaillogreport/2020-10-22/rman_list_backup_detail_auto_2020-10-22_07-52-33.0919.log",
      "dbInfo" : {
        "dbClass" : "OLTP",
        "dbType" : "SI",
        "dbShape" : "odb1",
        "dbEdition" : "EE",
        "dbStorage" : "ASM",
        "dbRedundancy" : null,
        "pdbName" : null,
        "isCdb" : false
      },
      "dbDataSize" : "1662M",
      "dbRedoSize" : "12298M",
      "rmanBackupPieces" : "https://swiftobjectstorage.us-ashburn-1.oraclecloud.com/v1/paasdevdbcssi/Bha_Backups/scaoda8s002-c/database/3022438697/tdbasm1/backuppieces/2020-10-22/backupPieces_auto_4903d18a-6c20-4860-9ed0-d2ea7bd3d7b9_20201022075238.json",
      "compressionAlgo" : "MEDIUM",
      "cpuPool" : null,
      "numberOfCores" : null
    }
  3. To recover from a backup report, based on SCN, identify the database ID and the backup report for recovery.

    In the following example, the JSON input file for the backup report is backupreport.json.

    # odacli recover-database -i b5fc646e-01a6-4c8b-8286-7633346c4 -br backupreport.json
  4. To recover based on PITR, identify the database ID and the date and time stamp for recovery.
    # odacli recover-database -i b5fc646e-01a6-4c8b-8286-7633346c4 -t PITR -r 01/08/2018 12:57:33
  5. To recover based on SCN, identify the database ID and the SCN number.
    # odacli recover-database -i b5fc646e-01a6-4c8b-8286-7633346c4 -t SCN -s 392375947
  6. To recover based on the latest backup, identify the database ID and use the Latest option.
    # odacli recover-database -i b5fc646e-01a6-4c8b-8286-7633346c4 -t Latest
  7. Validate that the job completed. You can track the job in the Activity tab in the Browser User Interface, or run the command odacli describe-job with the job ID.
    # odacli describe-job -i jobId
    When the job completes successfully, the recovery is complete.

Note:

Use the -p option only if the database backup is encrypted using the RMAN backup password. The -p option is not applicable for TDE-enabled databases.

Restoring a Database with the CLI

You can restore a database to a system from Oracle Object Storage or NFS backup location using a backup report and the command-line interface.

When you restore a database, environment and validation checks and setup tasks are performed. Restoring a database requires a number of tasks and configuration details, such as creating database storage, Oracle Home, recreating the control file, registering the database, and establishing RMAN restore and recovery. An Oracle Database Appliance backup report is generated for each backup and contains the metadata required to restore a database. The report is designed to help you to quickly and efficiently restore a database.

You can restore a database from one appliance to another appliance, or to the same appliance when the source database is deleted:

  • To restore to a different system, copy the backup report generated by the command odacli create-backup to any folder on the other machine and use the command odacli irestore-database with the backup report. You must provide the complete location of the backup report when you run the command odacli irestore-database.

  • To restore to the same system, delete the source database and use the backup report generated by the command odacli create-backup.

To restore a database from Object Store backup, the backup report corresponding to that backup must be present in the target system. Also an ObjectStoreSwift object with the credential that can access the Object Store backup must be created and specified while restoring the database.

Note:

For Standard Edition Oracle Database 19c or later, you cannot restore Oracle RAC or Oracle RAC One Node Database.

Follow these steps to restore a database using the command-line (CLI):

  1. Display a list of backup reports and locate the latest Backup Report in Oracle Object Storage or NFS for the database and save the Backup Report ID.
    # odacli list-backupreports
  2. Use the Backup Report ID to display the details of the latest Backup Report.
    #  odacli  describe-backupreport -i 7fbb06bf-e3a3-4aed-b617-4d1cd3d33387
    {
      "id" : "7fbb06bf-e3a3-4aed-b617-4d1cd3d33387",
      "dbResId" : "4903d18a-6c20-4860-9ed0-d2ea7bd3d7b9",
      "tag" : "auto", 
      "dbId" : "3022438697",
      "dbName" : "tdbasm1",
      "dbUniqueName" : "tdbasm1",
      "backupType" : "regular-l0",
      "keepDays" : null,
      "backupLocation" : "https://swiftobjectstorage.us-ashburn-1.oraclecloud.com/v1/paasdevdbcssi/Bha_Backups",
      "cfBackupHandle" : "c-3022438697-20201022-03",
      "spfBackupHandle" : "c-3022438697-20201022-03",
      "pitrTimeStamp" : "October 22, 2020 07:51:59 AM UTC",
      "pitrSCN" : "2549429",
      "resetLogsTimeStamp" : "October 22, 2020 05:23:56 AM UTC",
      "resetLogsSCN" : "2510142",
      "oraHomeVersion" : "19.8.0.0.200714",
      "sqlPatches" : "31281355",
      "backupLogLoc" : "https://swiftobjectstorage.us-ashburn-1.oraclecloud.com/v1/paasdevdbcssi/Bha_Backups/scaoda8s002-c/database/3022438697/tdbasm1/rmanlog/2020-10-22/rman_backup_auto_2020-10-22_07-51-06.0546.log",
      "tdeWalletLoc" : "https://swiftobjectstorage.us-ashburn-1.oraclecloud.com/v1/paasdevdbcssi/TestLtBackupFailur/scaoda8s002-c/database/3022438697/tdbasm1/tdewallet/ewallet_2020102207525186_tdbasm1.p12",
      "dbConfigLoc" : "https://swiftobjectstorage.us-ashburn-1.oraclecloud.com/v1/paasdevdbcssi/Bha_Backups/scaoda8s002-c/database/3022438697/tdbasm1/dbconfig/2020-10-22/DBCONFIG_auto_2020-10-22_07-52-43.0230.tar.gz",
      "name" : "Backup_Report_tdbasm1",
      "createTime" : "October 22, 2020 07:51:03 AM UTC",
      "state" : {
        "status" : "CONFIGURED"
      },
      "updatedTime" : "October 22, 2020 07:52:55 AM UTC",
      "backupReportLogDetail" : "https://swiftobjectstorage.us-ashburn-1.oraclecloud.com/v1/paasdevdbcssi/Bha_Backups/scaoda8s002-c/database/3022438697/tdbasm1/rmandetaillogreport/2020-10-22/rman_list_backup_detail_auto_2020-10-22_07-52-33.0919.log",
      "dbInfo" : {
        "dbClass" : "OLTP",
        "dbType" : "SI",
        "dbShape" : "odb1",
        "dbEdition" : "EE",
        "dbStorage" : "ASM",
        "dbRedundancy" : null,
        "pdbName" : null,
        "isCdb" : false
      },
      "dbDataSize" : "1662M",
      "dbRedoSize" : "12298M",
      "rmanBackupPieces" : "https://swiftobjectstorage.us-ashburn-1.oraclecloud.com/v1/paasdevdbcssi/Bha_Backups/scaoda8s002-c/database/3022438697/tdbasm1/backuppieces/2020-10-22/backupPieces_auto_4903d18a-6c20-4860-9ed0-d2ea7bd3d7b9_20201022075238.json",
      "compressionAlgo" : "MEDIUM",
      "cpuPool" : null,
      "numberOfCores" : null
    }
  3. (Optional) If you need to generate a new backup report, use the command odacli create-backup.
    # odacli create-backup
  4. Locate the Swift Object Store credential ID for the database backup.
    # odacli list-objectstoreswifts 
  5. Save the backup report from Step 2, as a JSON file in any directory on the appliance. For example, backupreport.json.
  6. Restore the database to the system using the JSON file in the command odacli irestore-database. You must specify the abolute path to the JSON file.
    Run the command, then enter the SYS user password when prompted.
    # odacli irestore-database -r backupreport.json -oid Object Store ID
    To restore a TDE-enabled database, the TDE wallet password must be provided. You must specify the -t option in the command odacli irestore-database. If source database is TDE enabled, then the target database which was restored will also have TDE enabled.
  7. Validate that the job completed. You can track the job in the Activity tab in the Browser User Interface, or run the command odacli describe-job with the job ID.
    # odacli describe-job -i jobId

Restoring Archivelog with the CLI

You can restore archivelog from one SCN to another SCN, or from one timestamp to another timestamp using the command-line interface.

Follow these steps to restore archivelog using the command-line (CLI):

  1. Restore archivelog from one SCN to another SCN, or from one timestamp to another timestamp:
    # odacli restore-archivelog -fs from_scn -ts to_scn 
    # odacli restore-archivelog -ft from_timestamp -tt to_timestamp 

Deleting Backups with the CLI

Delete older, obsolete level 0, level 1, archive log, and long term backups along with obsolete backup reports.

For level 0, level 1, and archive log backups, the recovery window defined in the Backup Configuration determines when the backup is obsolete. The ranges are as follows:

  • Backup to disk: between 1 and 14 days

  • Backup to the Oracle Object Storage: between 1 and 31 days

For Long Term backups to the Oracle Object Storage or NFS, view the keepDays attribute of the Backup Report for a database to determine when the backup is obsolete. To delete Long Term Backup, the Database Resource ID or Database name and the Backup Report are required.

Follow these steps to delete database backups using odacli commands:

  1. Display a list of all backup reports.
    # odacli  list-backupreports 
  2. Obtain the Database ID and type of backup.
    # odacli  describe-backupreport -i Backup Report ID
  3. To delete obsolete level 0, level 1, and archivelog backups along with obsolete backup reports, use the Database ID or Database Name to delete the backup.
    # odacli delete-backup -i 20576eb1-bc32-4e34-bf97-fda0b60ca15b
  4. To delete Long Term backups, use the Backup Report from the JSON file to delete the backup.

    In the following example, the JSON input file for the backup report is backupreport.json.

    # odacli delete-backup -i 20576eb1-bc32-4e34-bf97-fda0b60ca15b -br backupreport.json