Oracle Cloud Infrastructure Documentation

Backing Up a Database to Local Storage Using the Database CLI


This topic is not applicable to virtual machine DB systems because they have no local storage. For Exadata DB systems, see Managing Exadata Database Backups.

This topic explains how to back up to the local Fast Recovery Area on a bare metal DB system by using the database CLI (dbcli). Some sample dbcli commands are provided below. For complete command syntax, see the Oracle Database CLI Reference.


Backing up to local storage is fast and provides for fast point-in-time recovery, however, if the DB system becomes unavailable, the backup also becomes unavailable. For information about more durable backup destinations, see Backing Up a Database.

Backing Up the Database to Local Storage

You'll use the dbcli commands to create a backup configuration, associate the backup configuration with the database, initiate the backup operation, and then review the backup job.

  1. SSH to the DB System.

    ssh -i <private_key_path> opc@<db_system_ip_address> 
  2. Log in as opc and then sudo to the root user. Use sudo su - with a hyphen to invoke the root user's profile, which will set the PATH to the dbcli directory (/opt/oracle/dcs/bin).

    login as: opc
    [opc@dbsys ~]$ sudo su - 
  3. Create a backup configuration by using the dbcli update-backupconfig command and specify local disk storage as the backup destination.

    The following example creates a backup configuration named prodbackup and specifies a disk backup destination and a disk recovery window of 5 (backups and archived redo logs will be maintained in local storage for 5 days).

    [root@dbsys ~]# dbcli create-backupconfig --name prodbackup --backupdestination disk  --recoverywindow 5
      "jobId" : "e7050756-0d83-48ce-9336-86592be59827",
      "status" : "Success",
      "message" : null,
      "reports" : [ {
        "taskId" : "TaskParallel_471",
        "taskName" : "persisting backup config metadata",
        "taskResult" : "Success",
        "startTime" : 1467774813141,
        "endTime" : 1467774813207,
        "status" : "Success",
        "taskDescription" : null,
        "parentTaskId" : "TaskSequential_467",
        "jobId" : "e7050756-0d83-48ce-9336-86592be59827",
        "reportLevel" : "Info",
        "updatedTime" : 1467774813207
      } ],
      "createTimestamp" : 1467774781851,
      "description" : "create backup config:prodbackup",
      "updatedTime" : 1467774813236

    The example above uses full parameter names for demonstration purposes, but you can abbreviate the parameters like this:

    dbcli create-backupconfig -n prodbackup -d disk  -w 5
  4. Get the ID of the database you want to back up by using the dbcli list-databases command.

    [root@dbsys ~]# dbcli list-databases
    ID                                       DB Name    DB Version CDB        Class    Shape    Storage    Status
    ---------------------------------------- ---------- ---------- ---------- -------- -------- ---------- ----------
    71ec8335-113a-46e3-b81f-235f4d1b6fde     prod   true       OLTP     odb1     ACFS       Configured
  5. Get the ID of the backup configuration by using the dbcli list-backupconfigs command.

    [root@dbbackup backup]# /opt/oracle/dcs/bin/dbcli list-backupconfigs
    ID                                       Name                 DiskRecoveryWindow BackupDestination createTime
    ---------------------------------------- -------------------- ----- ------ -----------------------------------
    78a2a5f0-72b1-448f-bd86-cf41b30b64ee     prodbackup           5     Disk   July 6, 2016 3:13:01 AM UTC   
  6. Associate the backup configuration ID with the database ID by using the dbcli update-database command.

    [root@dbsys ~]# dbcli update-database  --backupconfigid 78a2a5f0-72b1-448f-bd86-cf41b30b64ee --dbid 71ec8335-113a-46e3-b81f-235f4d1b6fde
      "jobId" : "2b104028-a0a4-4855-b32a-b97a37f5f9c5",
      "status" : "Created",
      "message" : null,
      "reports" : [ ],
      "createTimestamp" : 1467775842977,
      "description" : "update database id:71ec8335-113a-46e3-b81f-235f4d1b6fde",
      "updatedTime" : 1467775842978

    You can view details about the update job by using the dbcli describe-job command and specifying the job ID from the dbcli update-database command output, for example:

    dbcli describe-job --jobid 2b104028-a0a4-4855-b32a-b97a37f5f9c5
  7. Initiate the database backup by using the dbcli create-backup command. The backup operation is performed immediately.

    The following example creates a backup of the specified database.

    [root@dbsys ~]# dbcli create-backup --dbid 71ec8335-113a-46e3-b81f-235f4d1b6fde
        "createTimestamp": 1467792576854,
        "description": "Backup service creation with db name: prod",
        "jobId": "d6c9edaa-fc80-40a9-bcdd-056430cdc56c",
        "message": null,
        "reports": [],
        "status": "Created",
        "updatedTime": 1467792576855

    Or you can abbreviate the command parameters like this:

    dbcli create-backup -i 71ec8335-113a-46e3-b81f-235f4d1b6fde

    You can view details about the back up job by using the dbcli describe-job command and specifying the job ID from the dbcli create-backup command output, for example:

    dbcli describe-job --jobid d6c9edaa-fc80-40a9-bcdd-056430cdc56c
  8. Important! Manually back up any TDE password-based wallets to your choice of a safe location, preferably not on the DB system. The wallets are required to restore the backup to a new host.

  9. Optionally, you can review the backup report. Use the Oracle Database CLI Reference command to create a report, then use Oracle Database CLI Reference to get the report ID, and then use Oracle Database CLI Reference with the report ID to get the report location, as shown in the following example.

    [root@dbsys ~]# dbcli create-backupreport --dbid 71ec8335-113a-46e3-b81f-235f4d1b6fde --reporttype summary
    	"jobId" : "65ce79fe-4ef4-4d7d-8020-e56a5390026d",
    	"status" : "Created",
    	"message" : null,
    	"reports" : [ ],
    	"createTimestamp" : "July 6, 2016 23:06:11 PM UTC",
    	"description" : "Creating a report for database 71ec8335-113a-46e3-b81f-235f4d1b6fde",
    	"updatedTime" : "July 6, 2016 23:06:11 PM UTC"
    [root@dbsys ~]# dbcli list-backupreports
    ID                                       Name                 ReportType DbId                                     createTime                          updatedTime
    ---------------------------------------- -------------------- ---------- ---------------------------------------- ----------------------------------- -----------------------------------
    c0e0a16a-485f-4176-ab73-5b30ccf5c560                          summary    71ec8335-113a-46e3-b81f-235f4d1b6fde     July 6, 2016 11:04:05 PM UTC        July 6, 2016 11:04:17 PM UTC
    [root@dbsys ~]# dbcli describe-backupreport --id c0e0a16a-485f-4176-ab73-5b30ccf5c560
    Backup Report details
                         ID: ed67a2cf-fe63-4755-a5d6-7eda5b669837
                Report Type: summary
                   Location: /opt/oracle/dcs/log/LrbvevghazqOGpbatvbpMRZJeVCzaW/rman/bkup/hhUiFnBz/rman_list_backup_summary/2016-07-06/rman_list_backup_summary_2016-07-06_09-49-20.0832.log
                Database ID: 71ec8335-113a-46e3-b81f-235f4d1b6fde
                CreatedTime: July 6, 2016 3:49:12 AM UTC
                UpdatedTime: July 6, 2016 3:49:24 AM UTC

After the backup command completes, the database backup files are available in the Fast Recovery Area on the DB system.

What's Next?

See Recovering a Database from a CLI Backup.