connecting to RMAN via command line :

rman TARGET SYS/target_pwd@target_str  
-- if using catalog database: --
rman target sys/manager@testdb catalog catuser/catpass@catdb

Configuring RMAN Environment :

 
CONFIGURE DEFAULT DEVICE TYPE TO DISK;
CONFIGURE RETENTION POLICY TO REDUNDANCY 3; 
CONFIGURE DEVICE TYPE DISK PARALLELISM 2;
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT 'd:\orclbackupora_df%t_s%s_s%p';
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO 'd:\orclbackupora_cf%F';
CONFIGURE BACKUP OPTIMIZATION ON;

to view the configuration that has been made: Show all;

sample script to backup Database (compressed backupset) :

  run {
  ALLOCATE CHANNEL ch1 DEVICE TYPE DISK; 
  BACKUP AS COMPRESSED BACKUPSET DATABASE format '/backup/rman/orcl/db_%s_%d_%T_%U'
  PLUS ARCHIVELOG FORMAT '/backup/rman/orcl/arc_%s_%d_%T_%U';
  BACKUP CURRENT CONTROLFILE FOR STANDBY FORMAT '/backup/rman/orcl/controlorclbak.ctl';
  release channel ch1;
} 
 

Sample script to restore (with same mount point configuration):


RESTORE CONTROLFILE from '/backup/rman/orcl/controlorclbak.ctl';

run{
allocate channel dbrestore1 type disk;
allocate channel dbrestore2 type disk;
allocate channel dbrestore3 type disk;
allocate channel dbrestore4 type disk;
allocate channel dbrestore5 type disk;
CATALOG START WITH '/backup/rman/orcl';
restore database;
recover database;
release channel dbrestore1;
release channel dbrestore2;
release channel dbrestore3;
release channel dbrestore4;
release channel dbrestore5;
}

working with stored script:

- to list all scripts on recovery catalog -
list scripts names;

- to check script contents -
 print script bk_disk_arc_compress;

- create script -
CREATE SCRIPT bk_disk_all_compress
{allocate channel disk_all_1 type disk;
backup as compressed backupset database format '/backup/rman/df_%U.%d.bus' filesperset=1 plus archivelog format '/backup/rman/ar_%U.%d.bus' filesperset=40;
release channel disk_all_1;
}

- replace script -
REPLACE SCRIPT bk_disk_all_compress
{allocate channel disk_all_1 type disk;
backup as compressed backupset database format '/backup/rman/df_%U.%d.bus' filesperset=1 plus archivelog format '/backup/rman/ar_%U.%d.bus' filesperset=40;
release channel disk_all_1;
}

- Delete Script -
DELETE SCRIPT bk_disk_all_compress;

- To Run Script Manually -
run {
execute script bk_disk_all_compress;
}

hope this will help.

Advertisements