RMAN Database Backup and Recovery Script
Backup
Hot Backup
To Tape
$rman catalog rman_user/rman_password@rcat target /
RMAN> run {
allocate channel t1 type 'SBT_TAPE';
allocate channel t2 type 'SBT_TAPE';
backup
incremental level 0
skip inaccessible
tag hot_db_bk_level0
filesperset 5
format 'db_%s_%p_%t'
(database);
}
To Tape using stored script
We can store the above script in RMAN catalog as shown below.
RMAN> create script hot_database_backup_level0 {
allocate channel t1 type 'SBT_TAPE';
allocate channel t2 type 'SBT_TAPE';
backup
incremental level 0
skip inaccessible
tag hot_db_bk_level0
filesperset 5
format 'db_%s_%p_%t'
(database);
}
This can be executed as
RMAN > run { hot_database_backup_level0; }
Cold Backup
$ cat rman_cold_backup.sh
{
rman nocatalog <connect target /
shutdown immediate;
startup mount;
run {
allocate channel d1 type disk;
allocate channel d2 type disk;
allocate channel d3 type disk;
allocate channel d4 type disk;
allocate channel d5 type disk;
backup
format '/u01/oradata/ColdBack/%d_%s:%t:%p'
database
include current controlfile
;
}
exit
!
} >rman_backup.log
mailx -s "Backup ended for Q01" 1234567890@vtext.com <check logfile
!
!>
0 Comments:
Post a Comment
<< Home