Anda di halaman 1dari 3

RMAN backup of Oracle Database

Backing up Oracle Database using RMAN in background :HOT Backup( Database in Archive log mode) :1. Create a RCV file for backup.
[cognos@rac1 ~]$ vi compressed_bkp_20_OCT_12.rcv
contents inside this file :run
{
allocate channel t1 type disk;
allocate channel t2 type disk;
allocate channel t3 type disk;
allocate channel t4 type disk;
allocate channel t5 type disk;
sql 'alter system archive log current';
backup as compressed backupset database plus archivelog delete input format
'/backup/BKPSETS_20OCT12_%U' filesperset 8;
backup as compressed backupset format '/backup/BKPSETS_20OCT12_CONTROLFILE_%U'
current controlfile;
release channel t1;
release channel t2;
release channel t3;
release channel t4;
release channel t5;
}
2. create a new file backup.
[cognos@rac1 ~]$ vi rman_hotbackup.sh
contents inside this file
cd
. ./.bash_profile
rman target / cmdfile=compressed_bkp_20_OCT_12.rcv log=backup_20_OCT_12.log << EOF
exit
3. Run this file from oracle user prompt to start backup
[cognos@rac1 ~]$ sh rman_hotbackup.sh >> rman_hotbackup.txt &
COLD Backup( Database in NOArchive log mode) :1. create a RCV file for backup.
[cognos@rac1 ~]$ vi compressed_bkp_20_OCT_12.rcv
contents inside this file :-

run
{
allocate channel t1 type disk;
allocate channel t2 type disk;
allocate channel t3 type disk;
allocate channel t4 type disk;
allocate channel t5 type disk;
backup as compressed backupset database format '/backup/BKPSETS_20OCT12_%U'
filesperset 8;
backup as compressed backupset format '/backup/BKPSETS_20OCT12_CONTROLFILE_%U'
current controlfile;
release channel t1;
release channel t2;
release channel t3;
release channel t4;
release channel t5;
}
2. create a new file backup.
[cognos@rac1 ~]$ vi rman_coldbackup.sh
contents inside this file
cd
. ./.bash_profile
rman target / cmdfile=compressed_bkp_20_OCT_12.rcv log=backup_20_OCT_12.log << EOF
exit
3. Run this file from oracle user prompt to start backup
[cognos@rac1 ~]$ sh rman_coldbackup.sh >> rman_coldbackup.txt &
NOTE :-- For taking Cold backup(Consistent backup) through RMAN database must be in
MOUNT mode.
Backup of only Archive logs through RMAN :1. Backup all Archive logs :[cognos@rac1 ~]$ rman target /
Recovery Manager: Release 11.2.0.1.0 - Production on Sat Oct 20 18:35:40 2012
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database: ORCL (DBID=1318569746)
RMAN> run
{
allocate channel t1 type disk;
allocate channel t2 type disk;

allocate channel t3 type disk;


allocate channel t4 type disk;
backup as compressed backupset archivelog all delete input format '/backup/archive/arc_%U';
release channel t1;
release channel t2;
release channel t3;
release channel t4;
}
2. Backup all archivelogs between dates eg :- created more than 7 and less than 30 days
ago.
RMAN> run
2> {
3> allocate channel t1 type disk;
4>allocate channel t2 type disk;
5>allocate channel t3 type disk;
6>allocate channel t4 type disk;
7>
backup as compressed backupset
archivelog from time 'SYSDATE-30' until time 'SYSDATE - 7' format '/backup/archive/arc_%U';
8>release channel t1;
9>release channel t2;
10>release channel t3;
11>release channel t4;
12 }
3. Backup archivelogs between log sequence eg:- from sequence 120 to 220
RMAN> run
2> {
3> allocate channel t1 type disk;
4>allocate channel t2 type disk;
5>allocate channel t3 type disk;
6>allocate channel t4 type disk;
7>
backup as compressed backupset
archivelog from logseq 120 until logseq 220 thread 1 format '/backup/archive/arc_%U';
8>release channel t1;
9>release channel t2;
10>release channel t3;
11>release channel t4;
12 }
I Hope this article helped you.
Regards,
Amit Rath

Anda mungkin juga menyukai