Overview of RMAN
RMAN (Recovery Manager) performs physical backups and supports point-in-time recovery. It operates in two database modes:
- Archivelog mode: Allows both offfline (cold) and online (hot) backups.
- Noarchivelog mode: Only offline backups are permitted.
Using RMAN
Connect to the target database from the server:
rman target /
# or with a recovery catalog
rman target / catalog rman_user/password@catalog_db
From a remote client:
rman target sys/password@host:port/service_name
The connecting user must have SYSDBA privileges.
Check archiving status:
SELECT log_mode FROM v$database;
-- Enable archivelog mode
SHUTDOWN IMMEDIATE;
STARTUP MOUNT;
ALTER DATABASE ARCHIVELOG;
ALTER DATABASE OPEN;
Configure archive destination and format:
ALTER SYSTEM SET log_archive_dest_1 = 'LOCATION=/arch' SCOPE=SPFILE;
ALTER SYSTEM SET log_archive_format = 'arc_%t_%s_%r.arc' SCOPE=SPFILE;
Backup Strategies by Mode
Consistent backups occur when the database is cleanly shut down (SHUTDOWN IMMEDIATE, etc.). Inconsistent backups happen while the database is open or after a abort.
In noarchivelog mode, perform a cold backup:
SHUTDOWN IMMEDIATE;
STARTUP MOUNT;
ALTER DATABASE NOARCHIVELOG;
-- Then in RMAN:
BACKUP DATABASE FORMAT '/backup/db_%U';
In archivelog mode, online backups are possible:
BACKUP DATABASE PLUS ARCHIVELOG;
Extend control file record retention:
ALTER SYSTEM SET control_file_record_keep_time = 30;
Listing and Reporting Backups
Use LIST to inspect backups:
LIST BACKUP OF DATABASE;
LIST BACKUPSET TAG 'FULL_BACKUP';
LIST COPY OF DATAFILE 1;
LIST ARCHIVELOG ALL;
Use REPORT for analysis:
REPORT SCHEMA;
REPORT NEED BACKUP DAYS 3;
REPORT UNRECOVERABLE;
REPORT OBSOLETE;
To prevant unrecoverable operations, enable force logging:
ALTER DATABASE FORCE LOGGING;
Hot vs Cold Backups
- Hot backup: Database is open; requires archivelog mode.
- Cold backup: Database is shut down; works in any mode.
Manual cold backup involves copying all critical files: datafiles, control files, SPFILE, redo logs, and tempfiles—after cleanly shutting down the instance.
RMAN cold backup:
STARTUP MOUNT;
BACKUP DATABASE;
A backup set is a logical container; it consists of one or more backup pieces (physical files).
Crosscheck and Manual Cataloging
Verify backup existence:
CROSSCHECK BACKUP;
CROSSCHECK ARCHIVELOG ALL;
Statuses: A (available), X (expired). Clean up metadata:
DELETE EXPIRED BACKUPSET;
DELETE NOPROMPT OBSOLETE;
Manually register moved backups:
CATALOG BACKUPPIECE '/new_loc/backup_01.bkp';
CATALOG START WITH '/moved_backups/';
Register archived logs in SQL*Plus:
ALTER DATABASE REGISTER PHYSICAL LOGFILE '/arch/arc_1_123.arc';
Validating Database Integrity
Check for physical and logical corruption:
VALIDATE DATABASE;
VALIDATE TABLESPACE USERS;
VALIDATE DATAFILE 1 BLOCK 100;
VALIDATE CHECK LOGICAL DATABASE;
Alternatively, simulate backup validation without writing output:
BACKUP VALIDATE DATABASE;
BACKUP VALIDATE CHECK LOGICAL ARCHIVELOG ALL;
Use the dbv utility externally:
dbv file=system01.dbf
Block corruption types:
- Physical: Invalid checksum, zero-filled blocks, header/footer mismatch.
- Logical: Inconsistent row or index structures.
By default, RMAN detects only physical corruption; add CHECK LOGICAL to include logical checks.