Oracle Recovery Manager (RMAN) is the oracle utility for backup and recovery functions of oracle databases . It can be used in High availability redundant solutions , disaster recovery situations.
How to create a RMAN backup set
Connect to the RMAN command line
$ /usr/oracle/product/12.2.0/db/bin/rman
Connect to the target database with sys user and password.
RMAN> connect target sys/shareolitedb
Create a backup data set which includes control file also with below command
RMAN> backup AS COMPRESSED BACKUPSET database include current controlfile;
This is optional and can be used to delete some RMAN files which may not be used for recovery
RMAN> delete noprompt obsolete;
Above set of commands may be configured in scheduler jobs to created a automated backup
How to list the RMAN backup sets created
After connecting to RMAN command line , execute below command
RMAN> LIST BACKUP SUMMARY;
using target database control file instead of recovery catalog
List of Backups
===============
Key TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag
------- -- -- - ----------- --------------- ------- ------- ---------- ---
1378 B F A DISK 17-JAN-22 1 1 NO TAG20220117T01378
1379 B F A DISK 17-JAN-22 1 1 NO TAG20220117T01379
How to delete old RMAN backup sets
It is essential to keep a track on the backup sets when created as it may consume more space . A backup set retention policy is a must in such cases. Below command may be used to delete backup sets older than a specific date from current date
For example , to delete old backup sets older than 10 days
RMAN> DELETE BACKUP COMPLETED BEFORE 'SYSDATE-10';
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=190 instance=SHAREDB device type=DISK
List of Backup Pieces
BP Key BS Key Pc# Cp# Status Device Type Piece Name
------- ------- --- --- ----------- ----------- ----------
1330 1690 1 1 AVAILABLE DISK +RMAN/SHAREDB/AUTOBACKUP/2022_01_07/s_156327335.7878.898989
1331 1691 1 1 AVAILABLE DISK +RMAN/SHAREDB/AUTOBACKUP/2022_01_07/s_158936363.9824.106423