Add On-Premises Database to Recovery Service Using Cloud Protect

The Cloud Protect Fleet Agent registers the on-premises database with Recovery Service to create a protected database.

In SQLcl, the rcv add database command automatically detects the database clients and adds them to a specified OCI compartment. All the databases are registered with the same Recovery Service subnet. The Oracle defined Bronze protection policy is assigned by default. You can also specify a protection policy of your choice.

If you want to add each database client to a separate OCI compartment and assign different Recovery Service subnets and protection policies, then you must run the rcv add database command along with the -generate_config_only option to first generate a configuration (JSON) file. Modify the configuration file to specify the required compartment ID, Recovery Service subnet, and protection policy for each database. Then, run the rcv add database command again, along with the configuration file. Oracle recommends that you follow this automated method to add databases to Recovery Service.

Note

Cloud Protect assigns the Oracle defined Bronze protection policy as the default policy for all databases. You can change the default policy in the configuration file before adding the database.

In the manual approach, you connect to each database (with SYSBACKUP privileges) and then run the rcv add database command to add the database individually.

When you run the rcv add database command, the Cloud Protect Fleet Agent performs these steps internally:

  • Verifies the prerequisites for adding the database to Recovery Service.
  • Creates a SYSBACKUP user and password, if the SYSBACKUP user does not exist.
    Note

    The SYSBACKUP user and password is required for the Cloud Protect Fleet Agent to establish a named connection to the database. Use this command to connect to the database as the SYSBACKUP user:

    /opt/oracle/sqlcl/bin/sql -name <DB_UNIQUE_NAME>_rcv_conn

    DB_UNIQUE_NAME is the globally unique name of the database.

  • Generates a random password for the VPC user account. The VPC user credentials are required to authenticate database access to the RMAN recovery catalog.
  • Invokes the Recovery Service API to create a protected database resource.
  • Waits until the protected database enters the Active life cycle state.
  • Registers the database in Recovery Appliance of Recovery Service using RMAN
  • Configures the protected database with Cloud Protect.
  • Cloud Protect maintains data protection.

Use these steps to add an on-premises database to Recovery Service.

  1. Log in to the database as the Oracle software owner user (oracle).
    If your SQLcl version is lower than 26.2.0, then ensure to set the ORACLE_HOME environmental variable before you run the rcv commands in SQLcl.

    In this example, the ORACLE_HOME environmental variable points to the directory where the Oracle database client is installed.

    echo $ORACLE_HOME
    /u01/app/oracle/product/19.0.0.0/dbhome_1
  2. Start SQLcl as an oracle user.
    In an Oracle RAC environment, start SQLcl only on the first compute node.
    oracle@host$ /opt/oracle/sqlcl/bin/sql /nolog
    SQL>
  3. Run the rcv add database command to automatically add all the detected databases using the same OCI compartment, Recovery Service subnet, and protection policy. Skip this step and proceed to step 4 if you want to add each database to a separate compartment using different Recovery Service subnets and protection policies.
    SQL> rcv add database -auto_discover 
    -compartment_id <COMPARTMENT_OCID> 
    -recovery_service_subnets <SUBNET_OCID>
    -protection_policy_id <PROTECTION_POLICY_OCID>
    • -compartment_id: the OCID of the compartment to add all the database clients
    • -recovery_service_subnets: the OCID of the Recovery Service subnet that must be used to register all the eligible database clients as protected databases in Recovery Service
    • (optional) -protection_policy_id: the OCID of the protection policy that must be assigned to the protected databases registered in Recovery Service. If you do not specify a policy, the Oracle-defined Bronze policy is assigned by default.
  4. Perform these steps to automatically detect the database clients and add each database client to a separate compartment. You can also assign different Recovery Service subnets and protection policy to each database.
    1. Run the rcv add database command along with the -generate_config_only option to automatically detect the database clients and generate a configuration file. The specified compartment ID and Recovery Service subnet ID can be modified for each database in the configuration file.
      SQL> rcv add database -auto_discover -generate_config_only 
      -compartment_id <COMPARTMENT_OCID> 
      -recovery_service_subnets <SUBNET_OCID>
      In this sample output, the rcv add database command generates the add_database.json configuration file which contains the compartment ID and Recovery Service subnet ID values required to create protected database. The Bronze policy is assigned as the default protection policy.
      2025-08-15 09:22:16: Created config JSON /u01/app/oracle/rcv/add_database.json
      2025-08-15 09:22:16: You can onboard a database by running 'rcv add database -config /u01/app/oracle/rcv/add_database.json'
    2. (Optional) Edit the configuration file to modify the assigned values, if necessary.
      edit /u01/app/oracle/rcv/add_database.json
      Sample contents of the add_database.json configuration file.
      
      [
          {
              "dbUniqueName": "DB1",
              "displayName": "DB1",
              "compartmentId": "ocid1.compartment.oc1..aaa...",
              "protectionPolicy": "ocid1.recoveryservicepolicy.region1..aaa...",
              "sbtLibrary": "/u01/app/oracle/product/19.24.0.0/dbhome_2/lib/libra.so",
              "oracleHome": "/u01/app/oracle/product/19.24.0.0/dbhome_2",
              "oracleSid": "DB1",
              "recoveryServiceSubnets": [
                  "ocid1.subnet.oc1.phx.aaa..."
              ]
          },
          {
              "dbUniqueName": "DB2",
              "displayName": "DB2",
              "compartmentId": "ocid1.compartment.oc1..aaaaaa...",
              "protectionPolicy": "ocid1.recoveryservicepolicy.region1..aaa...",
              "sbtLibrary": "/u01/app/oracle/product/19.27.0.0/dbhome_1/lib/libra.so",
              "oracleHome": "/u01/app/oracle/product/19.27.0.0/dbhome_1",
              "oracleSid": "DB2",
              "recoveryServiceSubnets": [
                  "ocid1.subnet.oc1.phx.aaa..."
              ]
          },
          {
              "dbUniqueName": "DB3",
              "displayName": "DB3",
              "compartmentId": "ocid1.compartment.oc1..aaa...",
              "protectionPolicy": "ocid1.recoveryservicepolicy.region1..aaa...",
              "sbtLibrary": "/u01/app/oracle/product/19.26.0.0/dbhome_3/lib/libra.so",
              "oracleHome": "/u01/app/oracle/product/19.26.0.0/dbhome_3",
              "oracleSid": "DB3",
              "recoveryServiceSubnets": [
                  "ocid1.subnet.oc1.phx.aaa..."
              ]
          }
      ]
      SQL>
    3. Run the rcv add database command again and specify the configuration file.
      SQL> rcv add database -config <configuration file location> 
      In this example, you specify the path for the add_database.json configuration file.
      SQL> rcv add database -config /u01/app/oracle/rcv/add_database.json 
  5. (Recommended) Enable Real-time data protection.
    1. Use SQLcl to log in to the database as a user with the SYSBACKUP privileges.
      oracle@host$ /opt/oracle/sqlcl/bin/sql -name <DB_UNIQUE_NAME>_rcv_conn

      In this example, you connect to the database c1db1.

      oracle@host$ /opt/oracle/sqlcl/bin/sql -name c1db1_rcv_conn
    2. Run the rcv realtime_redo command.
      SQL> rcv add realtime_redo
      Review the sample output for the database c1db1.
      2025-08-15 10:33:48: Log file: /u01/app/oracle/rcv/dbs/c1db1/log/add_realtime_redo_c1db1.20250815.103348.log
      SQL>
    3. Restart the database for the changes to take effect.