Oracle Cloud Infrastructure (OCI) provides a secure and scalable Object Storage solution for storing database backups. By integrating Oracle Recovery Manager (RMAN) with Oracle Cloud Infrastructure (OCI), organizations can achieve efficient, cost-effective, and reliable cloud-based backups for their Oracle databases.
In this blog, we will explore how to configure RMAN to back up directly to OCI Object Storage using the Oracle Cloud Infrastructure Command-Line Interface (CLI) and the Oracle Database Cloud Backup Module.
Prerequisites
Before proceeding, ensure you have the following:
- An Oracle Cloud Infrastructure (OCI) account.
- An existing Oracle Database instance.
- Oracle Recovery Manager (RMAN) installed and configured.
- OCI CLI was installed and configured on the database server.
- Access to the Oracle Database Cloud Backup Module.
- The appropriate OCI Auth Token is generated for authentication.
Step 1: Create an Object Storage Bucket
The first step is to create a bucket in OCI Object Storage:
- Log in to the OCI Console.
- Navigate to Storage > Object Storage.
- Click Create Bucket and provide a name.
- Choose a Storage Tier (Standard for frequently accessed backups, Archive for long-term storage).
- Click Create.
- Note the Bucket Namespace and Bucket Name, as they will be required in later configurations.
Step 2: Install the Oracle Database Cloud Backup Module
To enable RMAN to interact with OCI Object Storage, you need the Oracle Database Cloud Backup Module:
To download and install the Oracle Database Cloud Backup Module for OCI:
- Download the Oracle Database Cloud Backup Module for OCI from Oracle Technology Network (OTN):
- http://www.oracle.com/technetwork/database/availability/oracle-cloud-backup-2162729.html
- Accept the license agreement, click ‘All Supported Platforms,’ and provide your OTN username and password when prompted. Then, download the ZIP file that contains the installer (opc_installer.zip) to your system.
- Extract the contents of the zip file.
- The directory contains two files, oci_installer.jar, and a README file.
- Run the installer, oci_install.jar, from the oci_installer directory. Provide the required parameters in one line, with each parameter preceded by a hyphen and followed by its value.
Step 3: How to Obtain These on OCI Console
1. Make Sure You Have an OCI Account, then Sign In
Region Identifier (<region>)
- Log in to the OCI Console.
- Click on your Profile (top-right corner) > Tenancy: [Your Tenancy Name].
- The Region name is displayed. Example: us-ashburn-1.
- Use this in -host https://objectstorage.<region>.oraclecloud.com.
OCI Username (<your-oci-username>)
- Your OCI username is typically in the format:
tenancy_name/user_name - Find this under Profile > User Settings in the OCI Console.
Authentication Token (<your-auth-token>)
- Go to Profile > User Settings.
- Scroll down to Auth Tokens.
- Click “Generate Token,” copy it, and use it in -opcPass.
Object Storage Bucket Name (<bucket_name>)
- Navigate to Storage > Object Storage in the OCI Console.
- Click on the Bucket Name where you want to store backups.
- Use this bucket name in -container.
2. Run Installer: Execute the following command to configure the backup module:
java -jar oci_install.jar \
-host https://objectstorage.<region>.oraclecloud.com \
-opcId ‘<your-oci-username>’ \
-opcPass ‘<your-auth-token>’ \
-container <bucket_name>; \
-walletDir /u01/app/oracle/opc_wallet \
-libDir /u01/app/oracle/lib \
-debug
3. Modify the opc_wallet
Modify the opc<DBNAME>.ora file to specify the Oracle Cloud wallet location.
bash
vi /u01/app/oracle/product/19.3.0/dbs/opc<DBNAME>.ora
Replace OPC_WALLET value with the actual bucket name.
Save and exit:
:wq
Ensure that the backup module is installed successfully and the libopc.so file is placed in the correct directory.
Step 4: Configure RMAN for Cloud Backups
Update RMAN to use the newly installed Cloud Backup Module:
1. Set up RMAN with the cloud wallet directory:
export OPC_WALLET=/u01/app/oracle/opc_wallet
2. Start RMAN and connect to the database:
RMAN> CONNECT TARGET /
3. Configure the SBT library to use the OCI module:
RMAN> CONFIGURE DEVICE TYPE SBT_TAPE PARALLELISM 1 BACKUP TYPE TO BACKUPSET;
RMAN> CONFIGURE CHANNEL DEVICE TYPE SBT_TAPE PARMS ‘SBT_LIBRARY=/u01/app/oracle/lib/libopc.so, ENV=(OPC_WALLET=/u01/app/oracle/opc_wallet)’;
4. Set retention policies and encryption:
RMAN> CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;
RMAN> CONFIGURE ENCRYPTION FOR DATABASE ON;
Step 5: Perform a Backup to OCI Object Storage
Once configured, you can now perform a full database backup to OCI:
RMAN> BACKUP DATABASE TAG ‘OCI_FULL_BACKUP’;
For an incremental backup:
RMAN> BACKUP INCREMENTAL LEVEL 1 DATABASE;
To back up only the archive logs:
RMAN> BACKUP ARCHIVELOG ALL;
To validate a backup:
RMAN> VALIDATE BACKUPSET;
Step 6: Verify the Backup
To ensure your backup has been stored in OCI Object Storage, use:
RMAN> LIST BACKUP;
You can also check the OCI Console under Object Storage to see the backup files.
To cross-check backups and remove obsolete ones:
RMAN> CROSSCHECK BACKUP;
RMAN> DELETE OBSOLETE;
Conclusion
Integrating Oracle RMAN with OCI Object Storage provides a reliable and scalable solution for database backups. By leveraging cloud storage, you reduce on-premise infrastructure costs while ensuring data security and availability. With automation, you can simplify database maintenance and improve disaster recovery capabilities.
Start implementing OCI-based backups today and ensure the safety of your critical data!
Cut your database costs and maximize your resources with XTIVIA’s cost-effective DBA coverage.
For questions, please contact us.