RMAN commands for Non CDB and CDB pluggable database

RMAN commands in Oracle CDB or NON CDB

1. Connect with RMAN :

% rman
RMAN> CONNECT TARGET "sbu@prod AS SYSBACKUP"

2. Check the default configuration of RMAN and you can change it with configure commands as follows:

SHOW ALL;

-- increase the parallelism to 4
CONFIGURE DEVICE TYPE disk PARALLELISM 4;

-- Configure the device type
CONFIGURE DEFAULT DEVICE TYPE TO sbt;

-- configure the format of naming convention.
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/disk1/%U', '/disk2/%U';

--increase the copies of backup
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE sbt TO 2;
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 2;

3. Back up the database, NON-CDB, CDB or PDB.

--Backup only data files
Backup database;

--Backup whole database with archive and control file
BACKUP DATABASE PLUS ARCHIVELOG INCLUDE CURRENT CONTROLFILE

--Backup whole database plus archive
BACKUP DATABASE PLUS ARCHIVELOG;

--Backup tablespacee
BACKUP TABLESPACE users, tools;

--Backup datafiles
BACKUP DATAFILE 1,2,3,4;

--Backup controlfile
BACKUP CURRENT CONTROLFILE;

--Backup as copy controlfile.
BACKUP AS COPY CURRENT CONTROLFILE FORMAT '/tmp/control01.ctl';

--Backup spfile
BACKUP DEVICE TYPE sbt SPFILE;

--Backup up whole CDB
BACKUP DATABASE PLUS ARCHIVELOG;

-- Backup up the root container:
BACKUP DATABASE ROOT;

-- Backup pluggable database
BACKUP PLUGGABLE DATABASE sales, hr;

--Backup pluggable database plus archive log
CONFIGURE CONTROLFILE AUTOBACKUP ON;
BACKUP PLUGGABLE DATABASE my_pdb PLUS ARCHIVELOG TAG mypdb_bkup;

--Backup application root
connect with application root with RMAN
BACKUP DATABASE ROOT;

4. Backup archive logs

--Backup archive log from range of sequence
BACKUP ARCHIVELOG FROM SEQUENCE 121 UNTIL SEQUENCE 125;

--Backup all archive logs
BACKUP ARCHIVELOG ALL;

--Backup archive log in time range.
BACKUP ARCHIVELOG FROM TIME 'SYSDATE-30' UNTIL TIME 'SYSDATE-7';

--Backup archive log which is not backup 2 times
BACKUP ARCHIVELOG ALL NOT BACKED UP 2 TIMES;

--Backup archive log on tape drive with delete option
BACKUP DEVICE TYPE sbt ARCHIVELOG ALL DELETE ALL INPUT;

5. Image copy of the database as files present.

BACKUP AS COPY DATABASE;

6. Validating Database Files and Backups.

BACKUP VALIDATE CHECK LOGICAL DATABASE ARCHIVELOG ALL;

7. Listing Backups:

-- List backup summary
LIST BACKUP SUMMARY

--List backup
List backup;

--List backup of pluggable database
LIST BACKUP OF PLUGGABLE DATABASE hr_pdb, sales_pdb;

--List backup by backup set
LIST BACKUP OF DATABASE BY BACKUP

-- List backup by backup file
LIST BACKUP BY FILE

-- Lists backups of all files in database
LIST BACKUP OF DATABASE;

--lists specified backup set
LIST BACKUPSET 213;

--Expired backup present in repository but not present in OS location.
LIST EXPIRED COPY

--Lists data file backups or copies that have status AVAILABLE in the RMAN repository
LIST BACKUP RECOVERABLE

--Example for specfic file backup
LIST BACKUP OF DATABASE;
LIST COPY OF DATAFILE 1, 2;
LIST BACKUP OF ARCHIVELOG FROM SEQUENCE 10;
LIST BACKUPSET OF DATAFILE 1;

-- List backup of datafile 5 summary
LIST BACKUP OF DATAFILE 5 SUMMARY;

--List incarnation of database orcl
LIST INCARNATION OF DATABASE orcl;

8. Reporting on Database Files and Backups

--report which file need backup according to retention policy.
REPORT NEED BACKUP;
REPORT NEED BACKUP REDUNDANCY n;

--report obsolete backup according to retention policy
REPORT OBSOLETE

--Report tablespace and datafile
REPORT SCHEMA

--REPORT UNRECOVERABLE
REPORT UNRECOVERABLE

9. Cross-checking Backups
CROSSCHECK command to synchronize the logical records of RMAN backups and copies with the files on storage media

CROSSCHECK BACKUP;
CROSSCHECK COPY;

10. Deleting Obsolete Backups
DELETE command removes RMAN backups and copies and updates the status ot DELETED in control file repository and recovery catalog.

–Delete backup which are not longer needed.
DELETE OBSOLETE;

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.