apps-dba journal

A working journal for Oracle DBAs.

October 02, 2026

Oracle DBA Lesson 31B — Create and Find an RMAN Backup

An online backup copies data files while transactions continue. Redo brings those files to a consistent point. This part creates the backup and finds every file you must keep.

Oracle DBA Lesson 31B — Create and find an RMAN backup

What the command does

The database stays open, so data files change while RMAN copies them. Redo makes the restored copies consistent. BACKUP DATABASE PLUS ARCHIVELOG does five things:

  1. Archive the current log.
  2. Back up the archived logs that are available.
  3. Back up the data files.
  4. Archive the current log again.
  5. Back up the new archived logs.

The second archive captures redo generated during the data-file backup. Transactions after that archive need later redo. Optimization and archived-log deletion policy can skip logs that are already backed up, so recovery may also need pieces from an earlier run. See backing up the database.

A backup set is RMAN's container. A backup piece is a file in that set. One set can hold several pieces. BS Key identifies the set in the repository you are connected to. Piece Name on disk, or Handle on another device, names the stored file. Keep every handle. See LIST.

Confirm the lab

Use the disposable ARCHIVELOG CDB for this exercise. The commands change the autobackup setting and write backup files. Do not run them on production.

Before RMAN:

  • Confirm database name, DBID, release, edition, and host. A local OS connection targets the Oracle environment on that host.
  • Connect as an authorized backup user. Root scope is required so archived logs are included. SYSBACKUP needs the OSBACKUPDBA group when you use OS authentication.
  • The database is open, archive destinations are healthy, and the redo this online backup needs is readable.
  • Channels are DISK and the backup type is BACKUPSET. Backup storage has room. Encryption keys for existing backups are available.
  • Note excluded tablespaces, optimization, and the archived-log deletion policy. Account for every data file and for any redo this run skips.
  • Backup storage and the external record survive the failure you will restore from later. A second directory on the same disk is not a second copy.
  • Retention must keep these pieces until the restore drill. Fast recovery area cleanup can remove them if you do not.

In SQL*Plus, connected to the root:

SHOW CON_NAME
SELECT name, dbid, log_mode, open_mode FROM v$database;
SHOW PARAMETER spfile

Expect CDB$ROOT, the agreed DBID, ARCHIVELOG, and READ WRITE. A value for spfile means the instance uses a server parameter file. A blank value means a text PFILE. Record that file and protect it separately. Stop if the target is wrong or an archive destination is down. Do not change log mode for this exercise.

Start RMAN with a log file you have not used yet:

rman log=lab31b_rman_01.log

At the RMAN prompt:

CONNECT TARGET "/ AS SYSBACKUP";
SHOW ALL;

Confirm the database name and DBID in the connection banner. Keep the full SHOW ALL output, including the current control-file autobackup line, so you can put the setting back. Do not assume a default. See configuring RMAN.

Create the backup

At the RMAN prompt:

CONFIGURE CONTROLFILE AUTOBACKUP ON;
BACKUP DATABASE PLUS ARCHIVELOG TAG 'COURSE_BASELINE';

The first command turns on a separate control-file autobackup. That autobackup holds the new backup records and includes the SPFILE when the instance uses one. The second command backs up the data files and runs the archived-redo steps above. COURSE_BASELINE is a label you can reuse. The command does not delete source archived logs. Settings already in place can skip files or manage space.

Save the whole job log. Read every step: completion messages, piece handles, and the autobackup time and destination. A finished data-file step can still be followed by an error. Do not call the run good until the log is clean. See BACKUP.

Match records to files

At the RMAN prompt:

LIST BACKUP TAG 'COURSE_BASELINE';
LIST BACKUP OF CONTROLFILE;
LIST BACKUP OF SPFILE;

A tag can match many runs. Use completion time and BS Key to pick this run. For each set, record every piece handle, device, contents, completion time, and status. For archived redo, record thread, sequence, and the SCN or time range. If policy skipped logs that were already backed up, record those earlier pieces too.

The video uses BS Key 42 for data files and BS Key 43 for archived logs, with short names such as db_42_1.bkp. Those are an example. Your keys, grouping, and piece count will differ.

Match the control-file and SPFILE rows to this run's autobackup time and handle in the job log. The autobackup often has a different tag. When the instance uses an SPFILE, the list shows Control File Included and SPFILE Included. If there is no SPFILE, record the text parameter file instead.

PurposeBS KeyHandle, device, locationCoverage
Data filesFile list
Required archived redoThread, sequence, SCN or time
Control file autobackupNew backup records
SPFILE, or the text PFILEStartup settings

With the approved storage check, match each disk handle to the file at that path. Do not move, rename, or delete it. For ASM or another storage service, use that service's tool. A handle is not always a Linux path. The inventory is complete only when every required piece is accounted for.

Record it outside the database

Copy the job log, the inventory, the DBID, the autobackup destination, the naming format, and how to reach that storage into the external recovery record. Include the recovery target and the backup time with timezone. Oracle uses the DBID to find a control-file or SPFILE autobackup. See complete database recovery.

Also keep the items from Lesson 31A that this command does not back up: a text PFILE if that is what you use, the password file, the TDE keystore and its keys, and network configuration.

The tag alone cannot find the files after the control-file repository is lost. The tag lives in the backup records. Keep the piece inventory, and keep the autobackup location, naming format, and DBID, so recovery can rebuild access to those records.

Done when

You can name the data-file pieces, the archived-redo coverage, the control-file autobackup, the SPFILE or PFILE, and the remaining external files. Every required handle matches a file on storage. You can say which external records find the backup after the repository is gone.

Exit RMAN after the evidence is saved:

EXIT;

Put the autobackup setting back only when the exercise owner says so. If it was already ON, leave it ON. If it was OFF, reapply that exact setting. Keep every piece until the restore exercise has used it and the owner decides retention. This lesson has no delete step. A finished backup gives you files. A restore exercise tests recovery.

Recap

Back up the data files and the redo that backup needs. Trace each backup set to every piece. Preserve the control-file autobackup and the records that find it: location, naming format, and DBID.

Quiz

1. Can the tag alone locate every backup file after the control file repository is lost?

2. Why does PLUS ARCHIVELOG archive the current log a second time?

3. What is a backup piece?

4. What does the control file autobackup contain?

5. LIST BACKUP TAG 'COURSE_BASELINE' returns several runs. How do you pick yours?

No comments:

Post a Comment

Oracle DBA Lesson 33A — Follow a Client Into the Right PDB

A successful remote connection passes through naming, the listener, and the requested service before creating a database session. Follo...