On Linux terminal or DOS prompt on windows we can execute the below commands. RMAN can be used for backup of oracle database in 2 modes:
1. No Catalog Mode
2. Catalog Mode
In no catalog mode the information regarding the backup will be stored in target db control file. There is a limit to the amount of information can be stored in a control file. By default this information is stored for 7 days. We can increase this time by setting the below parameter.
1. No Catalog Mode
2. Catalog Mode
In no catalog mode the information regarding the backup will be stored in target db control file. There is a limit to the amount of information can be stored in a control file. By default this information is stored for 7 days. We can increase this time by setting the below parameter.
show parameter control_file_record_keep_time;
alter system set control_file_record_keep_time = 14 scope = both;
Once we login to RMAN the commands are same for both no catalog and catalog modes.
To use nocatalog mode do the followling:
export ORACLE_SID = prod
rman target / nocatalog
Once we login to RMAN the commands are same for both no catalog and catalog modes.
To use nocatalog mode do the followling:
export ORACLE_SID = prod
rman target / nocatalog
rman (enter)
rman> connect target /
RMAN> backup database;
It generates backup pieces and stores in
$ORACLE_HOME/dbs folder and backup set (backup info) into the target db
control file.
To see the datafiles and their respective numbers:
RMAN> report schema;
To backup a single datafile:
RMAN> backup datafile 4;
To backup a single tablespace:
RMAN> backup tablespace users;
RMAN> backup tablespace users;
To backup controlfile:
RMAN> backup current controlfile;
To backup all archivelog files:
RMAN> backup archivelog all;
RMAN> backup archivelog all;
To backup spfile:
RMAN> backup spfile;
RMAN> backup spfile;
To backup archivelogs and delete them:
RMAN> backup archivelog all delete input;
RMAN> backup archivelog all delete input;
To backup database and archivelog files together:
RMAN> backup database plus archivelog;
To backup database, controlfile and archivelog files in a single command:
RMAN> backup database include current controlfile plus archivelog;
To store backup (piece) in a particular location for one time:
RMAN> backup database format '/u01/bkp/full_bkp_%U';
RMAN> backup database format '/u01/bkp/full_bkp_%U';
List Report Commands : To get information about backups:
RMAN> list backup;
RMAN> list backup summary;
RMAN> list backup of datafile 2;
RMAN> list backup of archivelog all;
RMAN> list backup of tablespace users;
RMAN> report schema;
RMAN> report need backup;
RMAN> report obsolete;
RMAN> report need backup;
RMAN> report obsolete;
To delete the obsolete or old backups:
RMAN> delete obsolete;
RMAN> delete backup; (will delete complete backupsets and pieces)
RMAN> quit;
RMAN> delete backup; (will delete complete backupsets and pieces)
RMAN> quit;