What is Oracle RMAN? (The 30-Second Explanation)
RMAN stands for Recovery Manager. It's Oracle's built-in tool for backing up, restoring, and recovering databases.
Think of RMAN as your database's personal bodyguard + time machine:
- ๐ก๏ธ Bodyguard: Protects your data from disasters
- โฐ Time Machine: Lets you travel back to any point in time
Before RMAN existed (pre-Oracle 8), DBAs had to write complex shell scripts, manually track files, and pray everything worked during recovery. RMAN changed everything.
PITR and recovery to a time/SCN between backups require ARCHIVELOG mode. In NOARCHIVELOG you can still take offline backups, but recovery is generally limited to the last consistent backup (no roll-forward with archived redo). Check with: SELECT LOG_MODE FROM V$DATABASE;
Why Not Just Copy Files?
Great question! Here's why RMAN beats manual file copying:
| Feature | Manual Backup | RMAN |
|---|---|---|
| Block Handling | Copies ALL blocks (even empty) | โ Only backs up USED blocks |
| Corruption Detection | โ None | โ Automatic block validation |
| Scripting | Complex shell scripts required | โ Simple, intuitive commands |
| Catalog Management | Manual tracking | โ Automatic backup metadata |
| Recovery | Manual, error-prone | โ Point-in-time recovery built-in |
| Compression | External tools needed | โ Native compression |
๐๏ธ RMAN Architecture Overview
Understanding how RMAN components work together is crucial. Here's the big picture:
Key Components Explained
| Component | Description | Required? |
|---|---|---|
| RMAN Client | Command-line interface you interact with | โ Yes |
| Target Database | The database being backed up/recovered | โ Yes |
| Recovery Catalog | Separate DB storing backup metadata | Optional (recommended) |
| Channels | Server processes performing I/O operations | โ Yes (auto-allocated) |
| Media Management | Interface to tape/cloud storage | Optional |
Core Concepts: The Building Blocks
Before we dive into commands, let's nail down the vocabulary. Trust me, this will save you hours of confusion later.
1. Target Database
The database you want to backup or recover. When you connect RMAN to a database, you're connecting to a "target."
rman target /
# or
rman target sys/password@orcl
2. Recovery Catalog (Optional but Recommended)
A separate database that stores metadata about your backups. Think of it as RMAN's external memory.
Without catalog: RMAN stores info in the target database's control file (limited history)
With catalog: Unlimited history, centralized management for multiple databases
3. Backup Sets vs. Image Copies
This is a critical concept! Understanding when to use each can significantly impact your backup strategy.
-- Backup Set (default)
BACKUP DATABASE;
-- Image Copy
BACKUP AS COPY DATABASE;
4. Channels
Channels are the workers that perform backup/restore operations. More channels = parallel processing = faster backups.
RUN {
ALLOCATE CHANNEL c1 DEVICE TYPE DISK;
ALLOCATE CHANNEL c2 DEVICE TYPE DISK;
ALLOCATE CHANNEL c3 DEVICE TYPE DISK;
ALLOCATE CHANNEL c4 DEVICE TYPE DISK;
BACKUP DATABASE;
}
5. Incremental Backups
Why backup everything every time? Incremental backups only capture changes.
- Level 0: Full backup (the baseline) - backs up all blocks that have ever been used
- Level 1 Differential (default): Changes since last Level 0 OR Level 1
- Level 1 Cumulative: All changes since last Level 0 only (use
CUMULATIVEkeyword)
Level 0
100 GB"] MON["MON
Level 1
5 GB"] TUE["TUE
Level 1
8 GB"] WED["WED
Level 1
3 GB"] THU["THU
Level 1
6 GB"] FRI["FRI
Level 1
4 GB"] SAT["SAT
Level 1
7 GB"] end SUN --> MON --> TUE --> WED --> THU --> FRI --> SAT SAT -.->|Next Week| SUN2["โ๏ธ SUN
Level 0
100 GB"] style SUN fill:#f59e0b,stroke:#d97706,color:#000,stroke-width:2px style SUN2 fill:#f59e0b,stroke:#d97706,color:#000,stroke-width:2px style MON fill:#4ecdc4,stroke:#14b8a6,color:#000,stroke-width:2px style TUE fill:#4ecdc4,stroke:#14b8a6,color:#000,stroke-width:2px style WED fill:#4ecdc4,stroke:#14b8a6,color:#000,stroke-width:2px style THU fill:#4ecdc4,stroke:#14b8a6,color:#000,stroke-width:2px style FRI fill:#4ecdc4,stroke:#14b8a6,color:#000,stroke-width:2px style SAT fill:#4ecdc4,stroke:#14b8a6,color:#000,stroke-width:2px
๐ฌ Your First RMAN Session
Let's get our hands dirty! Fire up your terminal and follow along.
Connect to RMAN
# Connect as SYSDBA to local database
$ rman target /
Recovery Manager: Release 19.0.0.0.0 - Production
Copyright (c) 1982, 2019, Oracle. All rights reserved.
connected to target database: ORCL (DBID=1234567890)
RMAN>
You're in! That RMAN> prompt is where the magic happens.
Check Your Database Status
RMAN> REPORT SCHEMA;
Report of database schema for database with db_unique_name ORCL
List of Permanent Datafiles
===========================
File Size(MB) Tablespace RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1 900 SYSTEM YES /u01/oradata/ORCL/system01.dbf
2 500 SYSAUX NO /u01/oradata/ORCL/sysaux01.dbf
3 100 UNDOTBS1 YES /u01/oradata/ORCL/undotbs01.dbf
4 50 USERS NO /u01/oradata/ORCL/users01.dbf
Configure RMAN Settings
-- Set backup destination
RMAN> CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/u01/backup/%U';
-- Enable automatic control file backup (CRITICAL!)
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON;
-- Set retention policy (keep 7 days)
RMAN> CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;
-- Enable compression (saves 50-75% space)
RMAN> CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO COMPRESSED BACKUPSET;
-- View all configurations
RMAN> SHOW ALL;
Your First Full Backup! ๐
RMAN> BACKUP DATABASE PLUS ARCHIVELOG;
Starting backup at 12-DEC-24
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
...
channel ORA_DISK_1: backup set complete, elapsed time: 00:02:35
Finished backup at 12-DEC-24
You just backed up your entire database. Let that sink in โ a single command protected gigabytes of critical data.
Essential RMAN Commands: Your Daily Toolkit
Here are the commands you'll use 90% of the time:
Backup Commands
-- Full database backup
BACKUP DATABASE;
-- Database + archive logs (recommended for production)
BACKUP DATABASE PLUS ARCHIVELOG;
-- Only specific tablespace
BACKUP TABLESPACE users;
-- Only specific datafile
BACKUP DATAFILE 4;
-- Archive logs only
BACKUP ARCHIVELOG ALL;
-- Incremental backups
BACKUP INCREMENTAL LEVEL 0 DATABASE; -- baseline (full)
BACKUP INCREMENTAL LEVEL 1 DATABASE; -- changes only
-- Compressed backup (saves 50-75% space!)
BACKUP AS COMPRESSED BACKUPSET DATABASE;
-- Tag your backups for easy identification
BACKUP DATABASE TAG 'WEEKLY_FULL_20241212';
Listing and Reporting
-- List all backups
LIST BACKUP;
-- List backups of specific database
LIST BACKUP OF DATABASE;
-- List backup of tablespace
LIST BACKUP OF TABLESPACE users;
-- Find files needing backup
REPORT NEED BACKUP;
-- Find obsolete backups (based on retention)
REPORT OBSOLETE;
-- Check for corruptions (DO THIS REGULARLY!)
VALIDATE DATABASE;
Maintenance Commands
-- Delete obsolete backups (based on retention policy)
DELETE OBSOLETE;
-- Delete specific backup
DELETE BACKUPSET 123;
-- Crosscheck (verify backups still exist on disk)
CROSSCHECK BACKUP;
-- Remove catalog entries for missing files
DELETE EXPIRED BACKUP;
๐ Recovery Scenarios: When Things Go Wrong
Here's where RMAN truly shines. When disaster strikes, use this decision tree:
Scenario 1: Complete Database Recovery
Your database crashed. Server rebooted. Time to recover.
-- Start database in mount mode
RMAN> STARTUP MOUNT;
-- Restore all datafiles from backup
RMAN> RESTORE DATABASE;
-- Apply all archived logs to catch up to failure point
RMAN> RECOVER DATABASE;
-- Open the database
RMAN> ALTER DATABASE OPEN;
If you lost the control file (or control file is corrupt) and you enabled CONFIGURE CONTROLFILE AUTOBACKUP ON, you can usually restore it first, then proceed with restore/recover.
-- If you know DBID (recommended to record it!)
RMAN> SET DBID 1234567890;
RMAN> STARTUP NOMOUNT;
RMAN> RESTORE CONTROLFILE FROM AUTOBACKUP;
RMAN> ALTER DATABASE MOUNT;
RMAN> RESTORE DATABASE;
RMAN> RECOVER DATABASE;
RMAN> ALTER DATABASE OPEN;
Scenario 2: Single Datafile Recovery (Database Online!)
A single datafile got corrupted, but the database is still running.
-- Take the datafile offline (use IMMEDIATE if file is corrupted/inaccessible)
RMAN> SQL 'ALTER DATABASE DATAFILE 4 OFFLINE IMMEDIATE';
-- Restore just that file
RMAN> RESTORE DATAFILE 4;
-- Recover to current point (applies all archived logs)
RMAN> RECOVER DATAFILE 4;
-- Bring it back online
RMAN> SQL 'ALTER DATABASE DATAFILE 4 ONLINE';
Users on other tablespaces continue working while you fix the corrupted file.
Scenario 3: Point-in-Time Recovery (The Time Machine!)
Someone accidentally dropped a critical table at 2:30 PM. It's now 3:00 PM.
-- Shut down and mount
RMAN> SHUTDOWN IMMEDIATE;
RMAN> STARTUP MOUNT;
-- Restore to just before the disaster
RMAN> RUN {
SET UNTIL TIME "to_date('2024-12-12 14:25:00','YYYY-MM-DD HH24:MI:SS')";
RESTORE DATABASE;
RECOVER DATABASE;
}
-- Alternative: use NLS_DATE_FORMAT compatible string
-- SET UNTIL TIME '12-DEC-2024 14:25:00';
-- Open with reset logs (required after incomplete recovery)
RMAN> ALTER DATABASE OPEN RESETLOGS;
OPEN RESETLOGS creates a new incarnation and discards redo beyond the target time/SCN. Take a fresh full backup immediately after an incomplete recovery.
โญ RMAN Best Practices
1. Always Backup Control File and SPFILE
-- Enable automatic controlfile backup (includes SPFILE)
CONFIGURE CONTROLFILE AUTOBACKUP ON;
-- Then every backup automatically includes controlfile + spfile
BACKUP DATABASE PLUS ARCHIVELOG;
-- Or explicitly backup spfile separately
BACKUP SPFILE;
Without these, recovery becomes significantly harder. The CONTROLFILE AUTOBACKUP setting ensures you always have a recoverable controlfile and SPFILE.
2. Use Block Change Tracking for Faster Incrementals
-- Enable (one-time setup)
ALTER DATABASE ENABLE BLOCK CHANGE TRACKING
USING FILE '/u01/oradata/ORCL/bct.dbf';
3. Validate Your Backups Regularly
-- Check backup integrity without restoring
RESTORE DATABASE VALIDATE;
RESTORE ARCHIVELOG ALL VALIDATE;
-- Validate with logical corruption check (more thorough)
RESTORE DATABASE VALIDATE CHECK LOGICAL;
-- Validate specific backup set
VALIDATE BACKUPSET 123;
-- Validate entire database for physical/logical corruption
VALIDATE DATABASE;
A backup that can't be restored is NOT a backup. Validate weekly!
4. Use Backup Optimization
CONFIGURE BACKUP OPTIMIZATION ON;
RMAN skips files that haven't changed since the last backup.
5. Implement a Sensible Retention Policy
-- Keep backups for 30 days
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 30 DAYS;
-- OR keep last 3 backups
CONFIGURE RETENTION POLICY TO REDUNDANCY 3;
6. Test Recovery Quarterly
The best backup strategy is useless if you can't restore. Schedule quarterly recovery drills.
๐ Advanced Topics
Once you've mastered the basics, these advanced features will take your backup strategy to the next level.
1. RMAN Encrypted Backups
Protect your backups from unauthorized access with encryption. Oracle supports three encryption modes:
| Mode | Key Management | Use Case |
|---|---|---|
| Transparent (TDE) | Oracle Wallet / Key Vault | Production environments with TDE already enabled |
| Password-based | User-supplied password | Shipping backups to third parties |
| Dual-mode | Wallet + Password | Maximum flexibility for disaster recovery |
-- Configure transparent encryption (requires TDE wallet)
CONFIGURE ENCRYPTION FOR DATABASE ON;
CONFIGURE ENCRYPTION ALGORITHM 'AES256';
-- Password-based encryption for a single backup
RMAN> SET ENCRYPTION ON IDENTIFIED BY 'MySecurePassword123' ONLY;
RMAN> BACKUP DATABASE;
-- Dual-mode encryption (can restore with wallet OR password)
RMAN> SET ENCRYPTION ON IDENTIFIED BY 'MySecurePassword123';
RMAN> BACKUP DATABASE;
-- Restore encrypted backup with password
RMAN> SET DECRYPTION IDENTIFIED BY 'MySecurePassword123';
RMAN> RESTORE DATABASE;
If you lose the encryption password and don't have the wallet, your backups are permanently unrecoverable. Store passwords securely in a vault or password manager!
2. Multitenant Architecture (CDB/PDB) Backups
Oracle 12c+ introduced the multitenant architecture. Here's how to backup Container Databases and Pluggable Databases:
-- Connect to CDB root
$ rman target sys/password@cdb1
-- Backup entire CDB (includes all PDBs)
RMAN> BACKUP DATABASE PLUS ARCHIVELOG;
-- Backup specific PDB only
RMAN> BACKUP PLUGGABLE DATABASE pdb1;
-- Backup tablespace within a PDB
RMAN> BACKUP TABLESPACE pdb1:users;
-- Recover a single PDB to point-in-time
RMAN> RUN {
SET UNTIL TIME "to_date('2024-12-12 14:00:00','YYYY-MM-DD HH24:MI:SS')";
RESTORE PLUGGABLE DATABASE pdb1;
RECOVER PLUGGABLE DATABASE pdb1;
ALTER PLUGGABLE DATABASE pdb1 OPEN RESETLOGS;
}
From Oracle 12.2+, you can perform point-in-time recovery on individual PDBs without affecting other PDBs in the CDB. This is a game-changer for multi-tenant environments!
3. Data Guard Integration
In Data Guard environments, you can offload backups to the standby database, reducing load on production:
-- On STANDBY database: Enable backup mode
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
-- Connect RMAN to standby
$ rman target sys/password@standby_db
-- Backup from standby (preferred for large databases)
RMAN> BACKUP DATABASE PLUS ARCHIVELOG;
-- Resume managed recovery
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT;
-- IMPORTANT: Register backup in primary's catalog
$ rman target sys/password@primary_db
RMAN> CATALOG START WITH '/standby/backup/location/';
With Active Data Guard, you can backup from a read-only standby without stopping recovery, providing zero-impact backups on your production primary database.
4. Cloud Integration (OCI Object Storage)
Object storage backups are typically done via an SBT media management library (Oracle module or third-party). Exact installation parameters vary by Oracle version and module release, so treat the installer step as vendor-specific and verify with official docs.
-- Install Oracle Database Backup Cloud Module
-- (Vendor-specific) Install the cloud backup module to obtain:
-- 1) an SBT library (e.g., libopc.so) and 2) a config file (e.g., opc.ora)
-- Configure RMAN for OCI backup
RMAN> CONFIGURE CHANNEL DEVICE TYPE SBT PARMS
'SBT_LIBRARY=/u01/app/oracle/lib/libopc.so,
SBT_PARMS=(OPC_PFILE=/u01/app/oracle/wallet/opc.ora)';
-- Backup to OCI Object Storage
RMAN> BACKUP DEVICE TYPE SBT DATABASE PLUS ARCHIVELOG;
-- Hybrid approach: Local + Cloud
RMAN> BACKUP DATABASE PLUS ARCHIVELOG; -- Local (fast recovery)
RMAN> BACKUP DEVICE TYPE SBT BACKUPSET ALL
NOT BACKED UP 1 TIMES; -- Backup-of-backupset (replicate to object storage)
5. Fast Recovery Area (FRA) Configuration
The Fast Recovery Area is Oracle's recommended approach for managing all recovery-related files:
-- Configure FRA location and size
ALTER SYSTEM SET DB_RECOVERY_FILE_DEST = '/u01/fra' SCOPE=BOTH;
ALTER SYSTEM SET DB_RECOVERY_FILE_DEST_SIZE = 500G SCOPE=BOTH;
-- FRA automatically manages:
-- โข Archived redo logs
-- โข RMAN backups (when using default location)
-- โข Flashback logs
-- โข Control file autobackups
-- Monitor FRA usage
SELECT
NAME,
SPACE_LIMIT/1024/1024/1024 AS SIZE_GB,
SPACE_USED/1024/1024/1024 AS USED_GB,
ROUND(SPACE_USED/SPACE_LIMIT*100,2) AS PCT_USED
FROM V$RECOVERY_FILE_DEST;
-- Check what's consuming FRA space
SELECT
FILE_TYPE,
PERCENT_SPACE_USED AS PCT_USED,
NUMBER_OF_FILES AS NUM_FILES
FROM V$RECOVERY_AREA_USAGE;
๐ค Automation Scripts
Production environments need automated, scheduled backups. Here are ready-to-use scripts:
DELETE INPUT (Read This Before Copy/Paste)DELETE INPUT removes archived redo logs after they are backed up. This is common, but only safe if it matches your HA/DR design.
- Data Guard: ensure archived logs are shipped and applied to required standbys before deleting (consider
CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON ALL STANDBY;). - Offsite backups: ensure the archivelogs are backed up to your required media (disk/tape/cloud) and verified per retention/RPO.
- Operational safety: if you're unsure, remove
DELETE INPUTand manage log deletion separately.
Linux/Unix Shell Script
#!/bin/bash
#############################################
# RMAN Automated Backup Script
# Schedule with cron: 0 2 * * * /scripts/rman_backup.sh
#############################################
# Environment variables
export ORACLE_SID=ORCL
export ORACLE_HOME=/u01/app/oracle/product/19c/dbhome_1
export PATH=$ORACLE_HOME/bin:$PATH
# Directories
BACKUP_DIR=/u01/backup
LOG_DIR=/u01/backup/logs
DATE=$(date +%Y%m%d_%H%M%S)
LOG_FILE=$LOG_DIR/rman_backup_$DATE.log
# Create log directory if not exists
mkdir -p $LOG_DIR
# Determine backup type based on day of week
DOW=$(date +%u)
if [ $DOW -eq 7 ]; then
BACKUP_TYPE="INCREMENTAL LEVEL 0"
BACKUP_TAG="WEEKLY_L0_$DATE"
else
BACKUP_TYPE="INCREMENTAL LEVEL 1"
BACKUP_TAG="DAILY_L1_$DATE"
fi
# Execute RMAN backup
rman target / <<EOF >> $LOG_FILE 2>&1
RUN {
ALLOCATE CHANNEL c1 DEVICE TYPE DISK;
ALLOCATE CHANNEL c2 DEVICE TYPE DISK;
BACKUP $BACKUP_TYPE DATABASE
TAG '$BACKUP_TAG'
FORMAT '$BACKUP_DIR/%U';
BACKUP ARCHIVELOG ALL
NOT BACKED UP 1 TIMES
TAG 'ARCH_$DATE'
DELETE INPUT;
DELETE NOPROMPT OBSOLETE;
RELEASE CHANNEL c1;
RELEASE CHANNEL c2;
}
EXIT;
EOF
# Check for errors
if grep -i "RMAN-" $LOG_FILE | grep -v "RMAN-08138"; then
echo "RMAN Backup FAILED - Check $LOG_FILE" | mail -s "RMAN Backup FAILED: $ORACLE_SID" [email protected]
else
echo "RMAN Backup completed successfully" >> $LOG_FILE
fi
Windows PowerShell Script
# RMAN Automated Backup Script for Windows
# Schedule with Task Scheduler
$env:ORACLE_SID = "ORCL"
$env:ORACLE_HOME = "C:\app\oracle\product\19c\dbhome_1"
$env:PATH = "$env:ORACLE_HOME\bin;$env:PATH"
$BackupDir = "D:\backup"
$LogDir = "D:\backup\logs"
$Date = Get-Date -Format "yyyyMMdd_HHmmss"
$LogFile = "$LogDir\rman_backup_$Date.log"
# Create directories
New-Item -ItemType Directory -Force -Path $LogDir | Out-Null
# Determine backup type
$DayOfWeek = (Get-Date).DayOfWeek
if ($DayOfWeek -eq "Sunday") {
$BackupType = "INCREMENTAL LEVEL 0"
$BackupTag = "WEEKLY_L0_$Date"
} else {
$BackupType = "INCREMENTAL LEVEL 1"
$BackupTag = "DAILY_L1_$Date"
}
# RMAN script content
$RmanScript = @"
RUN {
ALLOCATE CHANNEL c1 DEVICE TYPE DISK;
ALLOCATE CHANNEL c2 DEVICE TYPE DISK;
BACKUP $BackupType DATABASE
TAG '$BackupTag'
FORMAT '$BackupDir\%U';
BACKUP ARCHIVELOG ALL
NOT BACKED UP 1 TIMES
TAG 'ARCH_$Date'
DELETE INPUT;
DELETE NOPROMPT OBSOLETE;
}
EXIT;
"@
# Execute RMAN
$RmanScript | & rman target / | Out-File $LogFile -Encoding UTF8
# Check for errors
if (Select-String -Path $LogFile -Pattern "RMAN-" -SimpleMatch) {
Send-MailMessage -To "[email protected]" -From "[email protected]" `
-Subject "RMAN Backup FAILED: $env:ORACLE_SID" `
-Body "Check log: $LogFile" -SmtpServer "smtp.company.com"
}
RMAN Stored Scripts (Catalog)
Store frequently used scripts in the recovery catalog for consistency across databases:
-- Connect to catalog
$ rman target / catalog rman/password@catdb
-- Create a stored script
RMAN> CREATE SCRIPT full_backup {
BACKUP INCREMENTAL LEVEL 0 DATABASE PLUS ARCHIVELOG;
DELETE NOPROMPT OBSOLETE;
}
-- Create an incremental script
RMAN> CREATE SCRIPT incr_backup {
BACKUP INCREMENTAL LEVEL 1 DATABASE;
BACKUP ARCHIVELOG ALL NOT BACKED UP 1 TIMES DELETE INPUT;
}
-- List all stored scripts
RMAN> LIST SCRIPT NAMES;
-- Execute a stored script
RMAN> RUN { EXECUTE SCRIPT full_backup; }
-- Execute from command line
$ rman target / catalog rman/password@catdb <<EOF
RUN { EXECUTE SCRIPT incr_backup; }
EOF
A typical enterprise schedule:
- Sunday 2:00 AM: Level 0 (Full) backup
- Mon-Sat 2:00 AM: Level 1 (Incremental) backup
- Every 30 minutes: Archive log backup
- Monthly: Full backup to tape/cloud for long-term retention
๐ง Common RMAN Errors and Solutions
ORA-19502: Write error on file, block number
Cause: Disk full or permission issue
Solution: Check disk space and permissions on backup destination
df -h /u01/backup/
ls -la /u01/backup/
RMAN-06059: Expected archived log not found
Cause: Missing archive logs needed for recovery
Solution: Check if logs were deleted. If using Data Guard, fetch from standby.
LIST ARCHIVELOG ALL;
ORA-01152: File not restored from a sufficiently old backup
Cause: Datafile is newer than backup being restored
Solution: Use a more recent backup or restore to a later point in time
RMAN-06004: Recovery Manager error
Cause: Many possible causes
Solution: Check the full error stack and Oracle alert log
tail -100 $ORACLE_BASE/diag/rdbms/orcl/ORCL/trace/alert_ORCL.log
ORA-19809 / ORA-19804: Recovery area full
Cause: Fast Recovery Area (FRA) has reached its size limit
Solution: Delete obsolete backups, increase FRA size, or move backups to tape
-- Check FRA usage
SELECT * FROM V$RECOVERY_FILE_DEST;
-- Delete obsolete backups to free space
RMAN> DELETE OBSOLETE;
-- Or increase FRA size
ALTER SYSTEM SET DB_RECOVERY_FILE_DEST_SIZE = 200G;
RMAN-06023: No backup or copy of datafile found
Cause: RMAN cannot find a backup for the requested datafile
Solution: Verify backup exists and is accessible; catalog backups if relocated
-- List available backups
LIST BACKUP OF DATAFILE 4;
-- Catalog backups from a directory (if moved)
CATALOG START WITH '/new/backup/location/';
๐ Quick Reference: RMAN Cheat Sheet
Save this for your wall! ๐
CONNECT
rman target /rman target sys/pwd@db catalog rman/pwd@catdb
BACKUP
BACKUP DATABASE PLUS ARCHIVELOG;BACKUP INCREMENTAL LEVEL 0 DATABASE;BACKUP INCREMENTAL LEVEL 1 DATABASE;BACKUP AS COMPRESSED BACKUPSET DATABASE;BACKUP TABLESPACE users;BACKUP CURRENT CONTROLFILE;
RESTORE & RECOVER
RESTORE DATABASE;RECOVER DATABASE;RESTORE TABLESPACE users;RECOVER TABLESPACE users;
REPORTING
LIST BACKUP;LIST BACKUP OF DATABASE;REPORT NEED BACKUP;REPORT OBSOLETE;REPORT SCHEMA;
MAINTENANCE
CROSSCHECK BACKUP;DELETE OBSOLETE;DELETE EXPIRED BACKUP;
VALIDATION
VALIDATE DATABASE;VALIDATE BACKUPSET 123;RESTORE DATABASE VALIDATE;RESTORE DATABASE VALIDATE CHECK LOGICAL;
CONFIGURATION
SHOW ALL;CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;CONFIGURE CONTROLFILE AUTOBACKUP ON;CONFIGURE BACKUP OPTIMIZATION ON;
ENCRYPTION
CONFIGURE ENCRYPTION FOR DATABASE ON;SET ENCRYPTION ON IDENTIFIED BY 'password' ONLY;SET DECRYPTION IDENTIFIED BY 'password';
MULTITENANT (CDB/PDB)
BACKUP PLUGGABLE DATABASE pdb1;RESTORE PLUGGABLE DATABASE pdb1;RECOVER PLUGGABLE DATABASE pdb1;BACKUP TABLESPACE pdb1:users;
๐ฏ Wrapping Up: Your RMAN Journey Starts Here
RMAN might seem intimidating at first, but it's genuinely one of the most powerful tools in a DBA's arsenal. What we covered today:
- โ What RMAN is โ Oracle's built-in backup and recovery solution
- โ Architecture โ How all the components work together
- โ Core concepts โ Backup sets, image copies, channels, incrementals
- โ Essential commands โ Backup, restore, recover, list, report
- โ Recovery scenarios โ From single file to point-in-time
- โ Best practices โ Tips that separate good DBAs from great ones
- โ Advanced topics โ Encryption, CDB/PDB, Data Guard, Cloud integration
- โ Automation โ Production-ready backup scripts
Your Next Steps
- Set up a test environment โ Never practice on production!
- Run your first backup โ
BACKUP DATABASE PLUS ARCHIVELOG; - Test recovery โ Restore to a different location
- Document your procedures โ Future you will thank present you
- Automate with scripts โ Schedule backups with cron/Task Scheduler
"Backups are worthless. Restores are priceless." โ Every DBA who's been through a disaster
The best time to learn RMAN was yesterday. The second best time is right now.
RMAN is powerful, but when backups fail or don't exist, you need specialized tools. DBRECOVER for Oracle can extract data directly from corrupted datafiles without requiring a running instance, control files, or redo logs โ the ultimate last resort for database recovery.