Overview

Oracle offers physical backup with RMAN (Recovery Manager) and logical export with Data Pump (expdp/impdp). Physical backup plus archived redo gives point-in-time recovery; Data Pump moves logical objects between databases. RMAN requires ARCHIVELOG mode for online backup of a running database.

What was executed

The gvenzl/oracle-free:23-slim image does not contain the rman binary (and no datapatch). The RMAN commands below come from Oracle documentation and are not executed. ARCHIVELOG mode, archived logs and the fast recovery area, plus Data Pump export and import, were executed.

Core concepts

  • ARCHIVELOG mode keeps every filled online redo log as an archived log. Turn it on (database mounted): STARTUP MOUNT; ALTER DATABASE ARCHIVELOG; ALTER DATABASE OPEN;. Set the fast recovery area (DB_RECOVERY_FILE_DEST and DB_RECOVERY_FILE_DEST_SIZE) to store backups and archives.
  • RMAN backup types: full or incremental (level 0 baseline, level 1 differential or cumulative), backup sets (compressed, multiplexed) or image copies, block change tracking for fast incrementals, BACKUP ... PLUS ARCHIVELOG.
  • Recovery: RESTORE copies files back, RECOVER applies redo. Point-in-time: SET UNTIL TIME ...; RESTORE DATABASE; RECOVER DATABASE; then ALTER DATABASE OPEN RESETLOGS. PDB-level and table-level recovery exist.
  • Validate: RESTORE DATABASE VALIDATE and BACKUP VALIDATE CHECK LOGICAL test readability without restoring; a real restore drill is the true test.
  • Retention policy: CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 14 DAYS; DELETE OBSOLETE removes what is no longer needed. Use a recovery catalog database for long history across many databases.
  • Data Pump exports schemas, tables or the whole database with metadata, in parallel; it is a logical copy, not a replacement for RMAN.

Worked example

Switching the Free container to ARCHIVELOG (executed, locally as / as sysdba, because a connection through the listener failed once I had shut the instance down):

STARTUP MOUNT;
ALTER DATABASE ARCHIVELOG;
ALTER DATABASE OPEN;
ALTER SYSTEM SET db_recovery_file_dest_size = 10G;
ALTER SYSTEM SET db_recovery_file_dest = '/opt/oracle/oradata/fra';
ALTER SYSTEM SWITCH LOGFILE;
SELECT sequence#, ROUND(blocks*block_size/1024/1024,1) mb, name FROM v$archived_log;
-- 26 | 9 MB | /opt/oracle/oradata/fra/FREE/archivelog/2026_11_24/o1_mf_1_26_....arc

Data Pump (executed): export of the KB schema (500,000-row table, 80 MB dump, 40 s) and import into a new schema with remapping (33 s):

expdp kb/***@//localhost:1521/FREEPDB1 schemas=kb directory=dp_dir dumpfile=kb.dmp logfile=kb_exp.log
impdp system/***@//localhost:1521/FREEPDB1 directory=dp_dir dumpfile=kb.dmp remap_schema=kb:kb_copy

The first import attempt failed with ORA-01918: user 'KB_COPY' does not exist; the target user must exist when the export was not a full or privileged one. After creating it, all 500,000 rows arrived. The same job as an unprivileged user failed with ORA-39122: Unprivileged users may not perform REMAP_SCHEMA remappings.

RMAN outline (not executed):

RMAN> BACKUP AS COMPRESSED BACKUPSET DATABASE PLUS ARCHIVELOG;
RMAN> LIST BACKUP SUMMARY;
RMAN> RESTORE DATABASE VALIDATE;

Pitfalls and production notes

  • A database in NOARCHIVELOG can only be backed up cold and restored to the backup time; production needs ARCHIVELOG (oracle-architecture).
  • A full fast recovery area stops the database from archiving, which halts DML; monitor V$RECOVERY_AREA_USAGE and delete obsolete backups.
  • Back up the spfile, control file (CONFIGURE CONTROLFILE AUTOBACKUP ON) and encryption wallet (oracle-security).
  • Keep backups in a separate failure domain; document and time restores.
  • Compare with SQL Server and PostgreSQL (sqlserver-backup-recovery, pg-backup-pitr); for logical rewinds see oracle-flashback.

Practice questions

  1. Why can’t you do an online backup in NOARCHIVELOG mode?
  2. Differences between RESTORE and RECOVER?
  3. When is Data Pump the right tool and when is it not?

References

  • Oracle Database Backup and Recovery User’s Guide; Utilities guide, Data Pump Export/Import

oracle-redo-undo · oracle-flashback · sqlserver-backup-recovery · pg-backup-pitr