Full Backups:
- The below command will take the backup of full database along with archive log files.
RMAN> backup database plus archivelog;
- The below command will take the backup of only that datafile which is number 8.
RMAN> backup datafile 8;
- The below command will take the backup of only tablespace named user;
RMAN> backup tablespace user;
Incremental Backups:
- We need to take full backup using level 0 initially and then level 1.
- Incremental backup is of two types they are Differential incremental and Cumulative incremental
Differential backup: Differential backup means copies all the changed blocks since last level 0 or level 1 backups, this takes reference as last backup which may be any thing full or normal backup.
RMAN> backup incremental level 0 database;
RMAN> backup incremental level 1 database;
Cumulative Backups: Cumulative backup means copies all the changed blocks since last level 0 backups only, that is this takes reference as last full backup
RMAN> backup incremental level 1 cumulative database;
BACKUP-SET:
- Backup is done using backupset, backup will be compressed and saved as backupset.
- The below command will take the backup of whole database as copy in the default place.
RMAN> backup as backupset database;
- The below command will take the backup as backupset in specified path
RMAN> backup as backupset format '/BACKUP/df_%d_%s_%p.bus' datafile;
IMAGE COPY
- Normally backup is compressed and saved but backup as image copy is something like the same set of things in database will be copied as it is without compressing.
- The image copy can be taken as full backup (or) individual tablespace (or) individual datafiles.
- Image copy backup can also be taken using configure and channels command.
- The command below will take the backup of whole database as copy in the default place.
RMAN> backup as copy database;
- The command below will take the backup as copy in the specified path.
RMAN> backup as copy database format '/u01/app/oracle/copy/%U';
- The below command will list all the copy of backups of datafile.
RMAN> list datafilecopy all;
- The below command will list all the controlfiles copies.
RMAN> list copy of controlfile;
- The below command will delete all the image copies of datafiles (or) can also specify file with the number at the end instead of all keyword.
RMAN> delete datafilecopy all;
- The below command will delete all the image copies of control files and can also specify file with the number at the end.
RMAN> delete controlfile copy;
Some RMAN commands used frequently:
- Set the environment initially and then connect to rman using the below commands:
$ . oraenv
$ rman target /
- Configure controlfile auto backup
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON|OFF;
- Backing up the databases.
RMAN> BACKUP DATABASE PLUS ARCHIVELOG;
RMAN> BACKUP DATABASE
RMAN> BACKUP AS COPY DATAFILE 15 FORMAT '/oradata/orcl/add_tbs_02.dbf' ;
RMAN> BACKUP AS COPY ARCHIVELOG LIKE 'arch%';
RMAN> BACKUP AS COPY DATABASE FORMAT '/u01/app/oracle/copy/%U'
RMAN> BACKUP DEVICE TYPE DISK AS COPY;
RMAN> BACKUP AS BACKUPSET FORMAT '/BACKUP/df_%d_%s_%p.bus' TABLESPASE <NAME>
- Listing the backups
RMAN> LIST BACKUP DATAFILE | TABLESPACE <NAME_WITH_PATH OR FILE#>
RMAN> LIST BACKUP OF DATABASE;
RMAN> LIST COPY OF DATABASE;
RMAN> LIST BACKUP OF DATAFILE 15 |ARCHIVELOG ALL | CONTROLFILE|SPFILE ;
RMAN> LIST BACKUP SUMMARY;
- Checking configurations
RMAN> SHOW ALL;
RMAN> CONFIGURE retention policy to redundancy 1;
RMAN> CONFIGURE retention policy CLEAR;
RMAN> CONFIGURE DEFAULT DEVICE TYPE TO DISK;
RMAN> CONFIGURE DEFAULT DEVICE TYPE TO TYPE;
- Reports
RMAN> REPORT NEED BACKUP;
RMAN> REPORT OBSOLETE;
- Deleting the obsolete backups
RMAN> DELETE OBSOLETE;
- Restoring and recovering the databases
RMAN> RESTORE DATAFILE | DATABASE | TABLESPACE <NAME>;
RMAN> RECOVER DATAFILE | DATABASE | TABLESPACE <NAME>;
Comments
Post a Comment