Sunday, November 17, 2013

RMAN Commands (DISK, TAPE)

RMAN> list backupset;
RMAN> list backupset of database;
RMAN> list backupset of database completed before '14-JAN-11';
RMAN> list backupset of archivelog all;
RMAN> list backupset of
 tablespace users;
RMAN> list backupset of datafile 1;

RMAN> list backup summary;
RMAN> list backup;
RMAN> list backup of controlfile;
RMAN> list backup of tablespace SYSTEM;
RMAN> list backup by file;
RMAN> list backup of archivelog all ;

RMAN> list copy of database;
RMAN> list copy of database archivelog all;

RMAN>
 allocate channel for maintenance type disk;
RMAN> configure channel device type disk clear ;

RMAN> report need backup days=2 database;
RMAN> report need backup days=10 tablespace
 TEMP;
RMAN> report need backup days=4 datafile '/u01/app/
oracle/backup/sample/TEMP01.DBF';
RMAN> report
 schema;
RMAN> report
 obsolete;

RMAN> crosscheck backup;
RMAN> crosscheck backupset;
RMAN> crosscheck copy;
RMAN> crosscheck archivelog all;
RMAN> crosscheck controlfilecopy '/u01/app/oracle/admin/BACKUP/
demo/demo_controlfile_bak_03-15-11_19:59:11' ;

RMAN> delete noprompt
 expired backup ;
RMAN> delete noprompt obsolete;
RMAN> delete archivelog all;
RMAN> delete expired archivelog all;
RMAN> delete archivelog all completed before 'sysdate -1';
RMAN> delete noprompt archivelog until time 'sysdate - 1';
RMAN> delete archivelog all backed up 1 times to device type disk completed before 'sysdate-1';
 
***configure controlfile using RMAN
$ rman target / nocatalog
RMAN>configure controlfile autobackup on;
RMAN>configure
 retention policy to recovery window of 12 days;

***Init.ora or (spfile) Parameters shows Backup media and retention policy of controlfile
backup_
tape_io_slaves=TRUE
control_file_record_keep_time=12

***Init.ora parameters to speed up backup

sort_area_size = 20971520
sort_area_retained_size = 20971520

***Allocating Channels For disk Backup

RMAN>allocate channel c1 type disk format '/u01/app/oracle/backup/sample/%U';

***Allocating Channels for Tape Backup

RMAN> allocate channel ch1 type 'SBT_TAPE'
parms='ENV=(NB_
ORA_CLASS=RMAN_MTBackup_Tier3)';

***Backup database+archivelog+controlfile

$ rman target / nocatalog
RMAN>backup as
 compressed backupset
full
maxsetsize
 = 32G
filesperset
 = 1024
diskratio=0
tag
 'Full'

****Backup database + current controlfile

PLUS ARCHIVELOG skip inaccessible format '/u01/app/oracle/backup/sample/ar_%d_%t_%c_%s_%p';

***Backup database+archive log

$
 rman target / nocatalog
#Backup
 to disk
RMAN>
 backup device type disk format '/u01/app/oracle/backup/sample/%U' database
plus archivelog skip inaccessible delete input;

#Backup to Tape
RMAN> backup as compressed backupset
full
filesperset = 1024
diskratio = 0
tag = 'Full'
(
database format 'SBT_TAPE/RMAN_%d.%t.full.%c.%s.%p')
plus archivelog
skip inaccessible
delete input
format 'SBT_TAPE/RMAN_%d.%t.arch.%c.%s.%p';

***Backup database+controlfile

RMAN>backup as compressed backupset
full
maxsetsize = 32G
filesperset = 1024
diskratio = 0
tag = 'Full'
(database include current controlfile) keep until time 'SYSDATE+365' nologs;


***Backup Controlfile for standby database

RMAN> backup device type disk format '/u01/app/oracle/backup/sample/%U' current controlfile for
 standby;

***Backup Controlfile

Option # 1
RMAN>copy current controlfile to '/u01/app/oracle/backup/sample/backup/demo_controlfile.bak';

Option # 2
RMAN>backup current controlfile format '/u01/app/oracle/backup/sample/%d_controlfile_bak_%T_s%s';

*****Note : Control file is automatically backed up when
RMAN>configure controlfile autobackup on;


***Backup the archive log
#Backup to disk
RMAN>backup as compressed backupset
maxsetsize =5G
diskratio = 0
skip inaccessible
tag 'Archive Logs'
(archivelog all NOT BACKED UP 1 TIMES format '/u01/app/oracle/backup/sample/ar_%d_%t_%c_%s_%p');

#Backup To Tape
RMAN> backup as compressed backupset
maxsetsize = 5G
diskratio = 0
skip inaccessible
tag = 'Archive Logs'
(archivelog all delete input format'SBT_TAPE/RMAN_%d.%t.arch.%c.%s.%p');


***Command to maintain the backup by RMAN

delete force noprompt obsolete
 recovery window of 12 days;
crosscheck backup;
delete force noprompt expired backup;

***Report the backupsets
 
list backup;


No comments:

Post a Comment