Saturday, August 2, 2025

Automate RMAN Backup Upload to Oracle Cloud Object Storage via Pre-authenticated Request (PAR)

 

๐Ÿ”น Introduction

When managing backups for Oracle databases, especially in cloud or hybrid environments, uploading RMAN backups to Oracle Cloud Object Storage is a cost-effective and scalable solution. In this blog, I’ll walk you through an easier and lightweight method—using Pre-authenticated Requests (PARs) instead of configuring the full backup module.

Ideal for:

  • One-time uploads

  • Lightweight databases

  • Automation without exposing full credentials

๐Ÿ”น What is a Pre-authenticated Request (PAR)?

A PAR is a temporary URL that allows access to a specific Object Storage bucket or object without needing a user login or an API key. You can upload, download, or delete files securely with an expiry date

๐Ÿ”น Use Case

✔️ You take local RMAN backups on a DB server (on-prem or OCI VM)
✔️ You want to push them to Oracle Object Storage for disaster recovery
✔️ You don’t want to configure Oracle Backup Module or DB System native integration

๐Ÿ”น Step-by-Step: Create PAR and Upload RMAN Backup

 ✅ Step 1: Take Your RMAN Backup

Example RMAN command (level 0 full backup):

rman target / BACKUP DATABASE FORMAT '/u01/app/oracle/backup/rman_%U.bkp';

✅ Step 2: Create a Bucket in OCI

From the OCI Console:

  • Go to Object StorageBuckets

  • Click Create Bucket

    • Name: rman-backups

    • Storage Tier: Standard

    • Encryption: Default

✅ Step 3: Create a Pre-authenticated Request (PAR)

Go to the bucket → Pre-authenticated RequestsCreate PAR

  • Name: upload-rman-backup

  • Access Type: Permit uploads to this bucket

  • Expiration: e.g., 7 days

  • Click Create Pre-authenticated Request

You’ll get a URL like:

https://objectstorage.ap-mumbai-1.oraclecloud.com/p/PARKEY/n/namespace-string/b/rman-backups/o/

✅ Step 4: Upload Using curl or rclone

Assuming your RMAN backup is /u01/app/oracle/backup/rman_abc123.bkp:

curl -T rman_abc123.bkp "https://objectstorage.ap-mumbai-1.oraclecloud.com/p/PARKEY/n/namespace-string/b/rman-backups/o/rman_abc123.bkp"

Done! Your backup is now in OCI Object Storage.

✅ Optional: Automate the Upload in Shell Script

#!/bin/bash BACKUP_DIR="/u01/app/oracle/backup" PAR_URL="https://objectstorage.ap-mumbai-1.oraclecloud.com/p/PARKEY/n/namespace-string/b/rman-backups/o/" for file in $BACKUP_DIR/*.bkp; do filename=$(basename "$file") curl -T "$file" "${PAR_URL}${filename}" done

Schedule via cron to run after your backup job.

๐Ÿ” Security Note

  • Never share PAR URLs publicly—they provide direct access.

  • Always set an expiration on PAR.

  • Delete the PAR once upload is completed (via Console or CLI).

๐Ÿ’ก Vignesh’s Tip

You can also create PARs using the OCI CLI:

oci os preauth-request create --access-type ObjectWrite --bucket-name rman-backups --name upload-rman-backup --time-expires "<RFC3339 timestamp>"

Useful for scripting and DevOps workflows.

๐Ÿ”น Conclusion

Using Pre-authenticated Requests for RMAN backup uploads is a fast, secure, and flexible alternative to more complex OCI-native integrations. Whether you are an on-prem DBA or working in OCI VMs, this method helps you back up to the cloud without complexity.

No comments:

Post a Comment

Oracle OS Management Hub in OCI – A Complete Overview

  Oracle OS Management Hub in OCI – A Complete Overview In any enterprise IT landscape, managing operating systems across hundreds of compu...