_RMAN Backup Script for Full DB, Archives &Control Files
_RMAN Backup Script for Full DB, Archives &Control Files
run {
crosscheck backup;
}
====== =====================
This is an RMAN (Recovery Manager) script for Oracle databases, used to perform a
backup of the database, archive logs, and control files. Here's a detailed explanation of
each part:
1. RUN Block
The RUN block is used to group RMAN commands into a single executable block.
2. Allocate Channels
allocate channel c1 type disk;
1. Purpose: Allocates channels, which are RMAN connections to the database and
target storage.
2. type disk: Specifies that the backups will be written to disk.
3. Here, five channels (c1 to c5) are allocated for parallel processing, enabling faster
backups by distributing the workload.
1. Purpose: Manually forces the database to switch its current redo log file to the next
one in the redo log group.
2. This ensures that all redo information is written to disk and included in the backup,
making the backup consistent.
4. Perform a Checkpoint
sql 'alter system checkpoint';
1. Purpose: Forces a checkpoint, ensuring that all dirty buffers in the memory (SGA)
are written to the datafiles.
2. This guarantees that the database is in a consistent state for the backup.
5. Crosscheck Backup
crosscheck backup;
1. Purpose: Verifies the availability and status of existing backups in the RMAN
repository.
2. Any missing or corrupt backups will be marked accordingly in the RMAN catalog.
1. Purpose: Creates a copy of the current control file before performing the
database backup.
2. Format: The %T in the file name is a substitution variable that inserts the current
date in YYYYMMDD format.
1. Purpose: Creates a copy of the control file after the database backup.
2. This is essential to capture any changes that occurred during the backup process,
such as new archived logs being generated.
1. Purpose: Frees up the allocated RMAN channels once the backup process is
complete.
2. This is a best practice to avoid resource contention.
Summary of the Script
This script is designed for full database backups along with archive logs, ensuring the
database is recoverable to a consistent state.
https://www.linkedin.com/in/rashid-khan-856b53232