Creating Backup Sets   «Prev  Next»

Lesson 3 RMAN BACKUP command syntax
Objective Identify the syntax of the RMAN BACKUP command.

Oracle RMAN BACKUP Command Syntax

Recovery Manager (RMAN) uses the BACKUP command to create backup sets or image copies. The same command can protect an entire container database (CDB), one or more pluggable databases (PDBs), tablespaces, data files, archived redo logs, the current control file, the server parameter file, and existing RMAN backups.

RMAN must be connected to a target database before BACKUP can run. Destination channels can come from persistent CONFIGURE settings or from manual ALLOCATE CHANNEL commands inside a RUN block. This lesson focuses on recognizing the major parts of the command rather than memorizing every branch in Oracle's complete syntax diagrams.

A Practical Model of BACKUP Syntax

A useful teaching model separates the command into options, an object to protect, object-specific options, and an optional archived-log clause:

BACKUP
  [ backup options ]
  object-to-back-up
  [ object-specific options ]
  [ PLUS ARCHIVELOG ];

The exact position of a clause depends on its role in Oracle's formal grammar, but every practical command answers several recognizable questions:

  1. What output format should RMAN create? Use AS BACKUPSET, AS COMPRESSED BACKUPSET, or AS COPY.
  2. Which device should receive it? Use configured channels or select DEVICE TYPE DISK or DEVICE TYPE SBT.
  3. What should be protected? Specify DATABASE, PLUGGABLE DATABASE, TABLESPACE, DATAFILE, ARCHIVELOG, CURRENT CONTROLFILE, SPFILE, or another supported object.
  4. How should the output be named and organized? Use clauses such as FORMAT, TAG, FILESPERSET, or SECTION SIZE.
  5. Should any inputs be excluded? Use a documented SKIP option only when the omission is compatible with the recovery plan.

The simplest complete command relies on the configured device, backup type, and naming defaults:

BACKUP DATABASE;

Oracle AI Database 26ai has a preconfigured disk channel. If a fast recovery area is configured and no FORMAT is supplied, RMAN can create uniquely named disk backup pieces in that recovery area. Persistent settings can change the default device, format, parallelism, and backup type, so review the active configuration before interpreting a short command:

SHOW ALL;

Oracle AI Engineering

Using an Explicit RUN Block

Manual channel allocation must occur inside a RUN block. The following example explicitly creates a disk channel and a backup set, excludes read-only data files, and supplies a backup-piece naming pattern:

RUN {
  ALLOCATE CHANNEL c1 DEVICE TYPE DISK;
  BACKUP AS BACKUPSET
    SKIP READONLY
    DATABASE
    FORMAT '/u03/rman/%d_%T_%U.bkp';
  RELEASE CHANNEL c1;
}

Each line has a distinct purpose:

Annotated Oracle AI Database 26ai RMAN RUN block showing ALLOCATE CHANNEL, BACKUP AS BACKUPSET, SKIP READONLY, DATABASE, and FORMAT clauses.
Oracle AI Database 26ai RMAN BACKUP syntax using an explicit RUN block and the minimal configured form.

The image shows both forms because syntax requirements depend on configuration. Manual allocation is useful when a job requires channel-specific settings. It is unnecessary when automatic channels already provide the intended device, location, and behavior.

Choosing the Backup Output Format

Use AS BACKUPSET to state explicitly that RMAN should create one or more backup sets:

BACKUP AS BACKUPSET DATABASE;

Use AS COMPRESSED BACKUPSET when the operation should apply RMAN binary compression:

BACKUP AS COMPRESSED BACKUPSET DATABASE;

Use AS COPY to request image copies. Image copies can be written only to disk:

BACKUP AS COPY DATABASE;

An explicit output clause overrides the configured default for that operation. When the clause is omitted, RMAN uses the applicable persistent setting. The default disk backup type is normally an uncompressed backup set unless it has been reconfigured.

Selecting the Backup Object

The backup specification identifies what RMAN protects. Common examples include:

BACKUP DATABASE;

BACKUP PLUGGABLE DATABASE salespdb;

BACKUP TABLESPACE users;

BACKUP DATAFILE 7;

BACKUP ARCHIVELOG ALL;

BACKUP CURRENT CONTROLFILE;

BACKUP SPFILE;

DATABASE represents the complete target CDB when RMAN is connected to the root. PLUGGABLE DATABASE selects one or more PDBs, while TABLESPACE and DATAFILE provide narrower scopes. ARCHIVELOG selects archived redo according to the supplied record criteria.

A connection made only to a PDB limits RMAN operations to that PDB's scope. Archived redo logs belong to the CDB and cannot be included with PLUS ARCHIVELOG from a PDB-only connection. Connect to the CDB root with the required administrative privilege for CDB-level archived-log operations.


Oracle Autonomous AI Database

Using the FORMAT Clause

FORMAT specifies a pattern for physical backup-piece names or image-copy names. It is a clause, not a tag. The separate TAG clause applies a logical label to an RMAN backup.

A FORMAT clause on the overall BACKUP command supplies its general output pattern. A format attached to an individual backup specification applies to that specification. A format on an allocated or configured channel applies to output written through that channel.

The consolidated image uses this example:

FORMAT '/u03/rman/%d_%T_%U.bkp'

The directory is illustrative. It must exist on the database host, be writable by the Oracle software owner, and have sufficient capacity. When using Oracle Managed Files in the fast recovery area, omit FORMAT if RMAN should choose the recovery-area location and OMF-style filename.

Common RMAN FORMAT substitution variables
Variable Meaning Use
%d Database name Identifies the source database
%T Gregorian date in YYYYMMDD format Makes the creation date readable
%U System-generated unique filename Prevents piece-name collisions
%s Backup-set number Identifies the set
%p Backup-piece number within the set Identifies the piece
%t Backup-set timestamp value Provides an internal timestamp component, not a formatted date

Include %U, or an equivalent combination that guarantees uniqueness, whenever RMAN can create multiple pieces. A fixed filename can cause a later piece or backup to collide with an existing name. This is why the new image replaces the legacy %d%t pattern with %d_%T_%U.

Understanding SKIP

The SKIP clause tells RMAN to omit particular inputs rather than include them or stop for the applicable condition:

BACKUP SKIP OFFLINE DATABASE;

BACKUP SKIP READONLY DATABASE;

BACKUP SKIP INACCESSIBLE DATABASE;

SKIP changes the contents of the backup. It does not prove that the excluded files can be recovered. Before excluding read-only or offline files, confirm that usable backups remain within the retention strategy. Treat an inaccessible file as an operational warning that requires investigation, even when the job is intentionally allowed to continue.

Other Common BACKUP Clauses

The complete Oracle 26ai command supports many additional operands. Learners should recognize the following clauses without trying to memorize the entire railroad diagram:

Frequently used RMAN BACKUP clauses
Clause Purpose
INCREMENTAL LEVEL 0Creates an incremental-strategy base
INCREMENTAL LEVEL 1Backs up blocks changed since the applicable parent backup
CUMULATIVEMakes level 1 include changes since the most recent level 0
DEVICE TYPE DISKUses automatic disk channels for the operation
DEVICE TYPE SBTUses a configured media-management or supported cloud interface
TAG 'name'Applies a logical label used to identify the backup
FILESPERSET nLimits input files included in each backup set
SECTION SIZE sizeEnables multisection processing of large files
PLUS ARCHIVELOGBacks up archived redo around the specified operation
CHECK LOGICALAdds logical corruption checking
VALIDATEReads and checks input without creating ordinary backup output

Level 1 incremental backups use backup-set format. PLUS ARCHIVELOG also has connection-scope and clause-compatibility restrictions, so it should not be added mechanically to every database command.

Combining BACKUP Clauses

The following commands demonstrate recognizable combinations without attempting to cover every specialized option:

BACKUP DATABASE PLUS ARCHIVELOG;

BACKUP AS COMPRESSED BACKUPSET
  INCREMENTAL LEVEL 1
  DATABASE;

BACKUP PLUGGABLE DATABASE salespdb

  TAG 'salespdb_weekly';

BACKUP TABLESPACE users
  FORMAT '/u03/rman/users_%T_%U.bkp';

BACKUP ARCHIVELOG ALL;

Syntax validity is only the first requirement for a production backup. The command must also fit the database archiving mode, recovery objectives, retention policy, destination capacity, encryption policy, and restore-test procedure. In ARCHIVELOG mode, an online database backup normally requires redo during recovery to make the restored files consistent.

BACKUP Syntax Review

The consolidated image identifies the purpose of RUN, ALLOCATE CHANNEL, AS BACKUPSET, SKIP READONLY, DATABASE, and FORMAT in one complete command.

In the next lesson, you will learn how RMAN combines blocks from multiple input files in a backup piece and how multiplexing affects backup behavior.


SEMrush Software 3 SEMrush Banner 3