In this post and the next one, I will discuss various methods by which we can improve the
performance of RMAN backup and recovery.
– Parallelism
– Maxpiecesize – Maximum size of each backup piece
– FIlesperset _ The number of datafiles in each backupset
– Maxopenfiles – Maximum No. of files which can be read from simultaneously
– Multiplexing level
– Asynchronous / Synchronous I/O
– Large pool Size-
database. So in all I will have 9 tablespaces .
create tablespace rman1
datafile ‘C:\APP\ADMINISTRATOR\ORADATA\ORCL\rman1.dbf’ size 100m;
create tablespace rman2
datafile ‘C:\APP\ADMINISTRATOR\ORADATA\ORCL\rman2.dbf’ size 100m;
create tablespace rman3
datafile ‘C:\APP\ADMINISTRATOR\ORADATA\ORCL\rman3.dbf’ size 100m;
create tablespace rman4
datafile ‘C:\APP\ADMINISTRATOR\ORADATA\ORCL\rman4.dbf’ size 100m;
create table hr.test2 tablespace rman2 as select * from hr.employees;
create table hr.test3 tablespace rman3 as select * from hr.employees;
create table hr.test4 tablespace rman4 as select * from hr.employees;
we can parallelize the backup/recovery operation by
– setting parallelism for the device
– Allocating multiple channels and
- . Let RMAN decide which file to backup/restore using which channel
- . BAcking up/Restoring specified files using specified channel
Each channel used will create its own backupset.
-- SET PARALLELSM FOR DEVICE –
RMAN>delete backup;
configure device type disk parallelism 3;
backup format ‘c:\%U.bak’ tablespace rman1, rman2, rman3;
list backup of tablespace rman1, rman2, rman3;
List of Datafiles in backup set 25
6 Full 1583594 12-SEP-12 C:\APP\ADMINISTRATOR\ORADATA\ORCL\RMAN1.DBF
List of Datafiles in backup set 26
7 Full 1583595 12-SEP-12 C:\APP\ADMINISTRATOR\ORADATA\ORCL\RMAN2.DBF
List of Datafiles in backup set 27
8 Full 1583596 12-SEP-12 C:\APP\ADMINISTRATOR\ORADATA\ORCL\RMAN3.DBF
——————————————————————————————-
- Allocating multiple channels and let RMAN decide which file to backup using which channel
———————————————————————————————-
— Note that RMan decides to backup rman1 and rman3 using c1 and rman2 using c2
RMAN>configure device type disk parallelism 1;
delete backup;
RMAN>run{
allocate channel c1 device type disk format ‘c:\%U.bak';
allocate channel c2 device type disk format ‘c:\%U.bak';
backup tablespace rman1, rman2, rman3;
}
channel c1: specifying datafile(s) in backup set
input datafile file number=00006 name=C:\APP\ADMINISTRATOR\ORADATA\ORCL\RMAN1.DBF
input datafile file number=00008 name=C:\APP\ADMINISTRATOR\ORADATA\ORCL\RMAN3.DBF
channel c2: specifying datafile(s) in backup set
input datafile file number=00007 name=C:\APP\ADMINISTRATOR\ORADATA\ORCL\RMAN2.DBF
-- Check that each channel created its own backupset
RMAN>list backup;
List of Datafiles in backup set 28
6 Full 1584178 12-SEP-12 C:\APP\ADMINISTRATOR\ORADATA\ORCL\RMAN1.DBF
8 Full 1584178 12-SEP-12 C:\APP\ADMINISTRATOR\ORADATA\ORCL\RMAN3.DBF
List of Datafiles in backup set 29
7 Full 1584179 12-SEP-12 C:\APP\ADMINISTRATOR\ORADATA\ORCL\RMAN2.DBF
————————————————————————————–
- Allocating multiple channels and backing up specified files using specified channels
————————————————————————————–
— Note that RMan backs up rman1 and rman2 using c1 and rman3 using c2 as specified
RMAN>delete backup;
run{
allocate channel c1 device type disk format ‘c:\%U.bak';
allocate channel c2 device type disk format ‘c:\%U.bak';
backup (tablespace rman1, rman2 channel c1)
(tablespace rman3 channel c2);
}
channel c1: specifying datafile(s) in backup set
input datafile file number=00006 name=C:\APP\ADMINISTRATOR\ORADATA\ORCL\RMAN1.DB
input datafile file number=00007 name=C:\APP\ADMINISTRATOR\ORADATA\ORCL\RMAN2.DB
channel c2: specifying datafile(s) in backup set
input datafile file number=00008 name=C:\APP\ADMINISTRATOR\ORADATA\ORCL\RMAN3.DB
– Check that each channel created its pwn backupset
RMAN>list backup;
List of Datafiles in backup set 30
6 Full 1584550 12-SEP-12 C:\APP\ADMINISTRATOR\ORADATA\ORCL\RMAN1.DBF
7 Full 1584550 12-SEP-12 C:\APP\ADMINISTRATOR\ORADATA\ORCL\RMAN2.DBF
List of Datafiles in backup set 31
8 Full 1584551 12-SEP-12 C:\APP\ADMINISTRATOR\ORADATA\ORCL\RMAN3.DBF
———————
-— FILESPERSET –
-———————
– This parameter decides how many files will be included in one backupset.
– If > 1 files are backed up and filesperset = 1, one backupset will be created for each file
rman>delete backup;
rman>backup datafile 7,8 filesperset 1 format ‘c:\%U.bak';
list backup ;
— Note that two backupsets are created with one datafile each
List of Backup Sets
===================
List of Datafiles in backup set 17
7 Full 1529096 11-SEP-12 C:\APP\ADMINISTRATOR\ORADATA\ORCL\RMAN2.DBF
List of Datafiles in backup set 18
8 Full 1529098 11-SEP-12 C:\APP\ADMINISTRATOR\ORADATA\ORCL\RMAN3.DBF
Using this parameter we can reduce the recovery time by limiting the no. of files per
backupset, since to restore a particular datafile we will have to restore a smaller file.
This is also beneficial in case the backup fails in the middle. Next time, we can backup
only those datafiles which could not be successfully backed up.
————————–
— MAXPIECESIZE –
————————–
– This parameter controls the maximum size a backup piece can have
– If we backup only one file, it will split into multiple pieces
- Check the size of datafiles.
– Note that datafile datafile for tablespace sysaux is 570m in size
rman>report schema;
File Size(MB) Tablespace RB segs Datafile Name
—- ——– ——————– ——- ————————
1 690 SYSTEM *** C:\APP\ADMINISTRATOR\ORADATA\ORCL\SYSTEM01.DBF
2 570 SYSAUX *** C:\APP\ADMINISTRATOR\ORADATA\ORCL\SYSAUX01.DBF
– Backup datafile for sysaux tablespace so that each piece size <= 200M
— Note that backup is spread over 3 backup pieces
rman>delete backup;
rman>run{
allocate channel c1 device type disk maxpiecesize 200m format ‘c:\%U.bak';
backup tablespace sysaux ;
}
list backup of tablespace sysaux;
List of Backup Pieces for backup set 21 Copy #1
BP Key Pc# Status Piece Name
——- — ———– ———-
21 1 AVAILABLE C:\0NNKUKP0_1_1.BAK
22 2 AVAILABLE C:\0NNKUKP0_2_1.BAK
23 3 AVAILABLE C:\0NNKUKP0_3_1.BAK
This option can be used
– to exercise the operating system limit on the file size.
– to split the backup of a datafile into multiple pieces if the backup does not fit in one
tape
– if backup is to be transferred over network.
————————–
— MAXOPENFILES -
–————————-
— This parameter decides how many files can be backed up simultaneously
i.e. data from how many files can be read at a time.
— Default value = 8
– Take backup of 2 datafiles with maxopenfiles = 1 so that level of multiplexing = 1 i.e.
. datafile 1 will be backed up first
. datafile 2 will be backed up next
so that data from 2 files will not be intermingled.
Rather first all data from datafile 1 will be written and
then data from datafile 2 will be written.
– While the backup is still going on issue the next sql query
RMAN> run{
allocate channel c1 device type disk maxopenfiles 1;
backup datafile 1,2;
}
— Note the change in filename from system01.dbf to sysaux01.dbf
— Note that buffers are allocated to datafile 1 first,
when that has been backed up, then buffers are allocated
to datafile 2
— Since multiplexing level = 1, total of 16 buffers of 1M each are
all allocated to each file one by one
sql>col filename for a25 word_wrapped
select type, status, filename, buffer_size, buffer_count
from v$backup_async_io
where type <> ‘AGGREGATE’
and status = ‘IN PROGRESS';
TYPE STATUS FILENAME BUFFER_SIZE BUFFER_COUNT
——— ———– ————————- ———– ————
INPUT IN PROGRESS C:\APP\ADMINISTRATOR\ORAD 1048576 16
ATA\ORCL\SYSTEM01.DBF
OUTPUT IN PROGRESS C:\APP\ADMINISTRATOR\FLAS 1048576 4
H_RECOVERY_AREA\ORCL\BACK
UPSET\2012_09_11\O1_MF_NN
NDF_TAG20120911T152958_84
Y2WZ7B_.BKP
SQL> /
TYPE STATUS FILENAME BUFFER_SIZE BUFFER_COUNT
——— ———– ————————- ———– ————
INPUT IN PROGRESS C:\APP\ADMINISTRATOR\ORAD 1048576 16
ATA\ORCL\SYSAUX01.DBF
OUTPUT IN PROGRESS C:\APP\ADMINISTRATOR\FLAS 1048576 4
H_RECOVERY_AREA\ORCL\BACK
UPSET\2012_09_11\O1_MF_NN
NDF_TAG20120911T152958_84
Y2WZ7B_.BKP
– Take backup of 2 datafiles with maxopenfiles = 2 so that level of multiplexing = 2 i.e.
. datafile 1 and 2 will be backed up simultaneously so that data from 2 files will be intermingled.
– While the backup is still going on issue the next sql query
RMAN> run{
allocate channel c1 device type disk maxopenfiles 2;
backup datafile 1,2;
}
— Note that buffers are allocated simultaneously to datafile 1 and 2
— Since multiplexing level = 2 (< 4), total of 16 buffers of 1M each are allocated.
— Each file gets 8 buffers each of the size of 1M
sql>col filename for a25 word_wrapped
select type, status, filename, buffer_size, buffer_count
from v$backup_async_io
where type <> ‘AGGREGATE’
and status = ‘IN PROGRESS';
TYPE STATUS FILENAME BUFFER_SIZE BUFFER_COUNT
——— ———– ————————- ———– ————
INPUT IN PROGRESS C:\APP\ADMINISTRATOR\ORAD 1048576 8
ATA\ORCL\SYSTEM01.DBF
INPUT IN PROGRESS C:\APP\ADMINISTRATOR\ORAD 1048576 8
ATA\ORCL\SYSAUX01.DBF
OUTPUT IN PROGRESS C:\APP\ADMINISTRATOR\FLAS 1048576 4
H_RECOVERY_AREA\ORCL\BACK
UPSET\2012_09_11\O1_MF_NN
NDF_TAG20120911T153330_84
Y33M40_.BKP
——————–
— MULTIPLEXING
——————–
Level of multiplexing means the no. of files whose data is intermingled
in the backup file. It depends on the following:
– # of files being backed up using one channel
– FIlesperset
– Maxopenfiles
Level of multiplexing = Minimum of the above 3.
We increase level of multiplexing so that data can be simultaneously read from multiple
files so that even if a process to wait to read from one of the files being backed up due to
contention, it can still read from the other files so that output tape drives gets
continuous input. Otherwise, due to lack of the input data, tape drive might overshoot
before stopping and will again have to come back to its earlier position when it gets next
stream of data.
Thus, increasing the level of multiplexing may increase the speed of backup. On the other
hand , it can reduce the restore speed as data for a file has to be extracted from the
intermingled data.
Thus , one has to decide the level of multiplexing based on whether performance of the
backup or recovery is more critial.
In case files being backed up are ASM files, level of multiplexing may be reduced as ASM
automatically takes care of the contention by striping the data.
Input buffers are allocated for the backup. The no. of buffers allocated per file depends
upon the level of multiplexing.
Multiplexing level Allocation rule
Level <= 4 1 MB buffers are allocated so that the total buffer size for all
input files is 16 MB.
4 < Level <= 8 512 KB are allocated so that the total buffer size for all files is
less than 16 MB.
Level > 8 RMAN allocates four 128 KB disk buffers per channel for each file,
so that the total size is 512 KB per channel for each file.
For multiplexing level 1 and 2 we have already seen that 1 MB buffers are allocated so that
the total buffer size for all input files is 16 MB.
—————————————–
Let’s verify for multiplexing level of 5 .
—————————————–
RMAN>delete backup;
=- Note that 512 KB are allocated so that the total buffer size for all files is less than
16 MB.
— AS backup progresses the files which have been backed up, buffers allocated to them gets
freed
RMAN> run{
allocate channel c1 device type disk maxopenfiles 5;
backup datafile 1,2,3,4,5;
}
sql>/
TYPE STATUS FILENAME BUFFER_SIZE BUFFER_COUNT
——— ———– ————————- ———– ————
INPUT IN PROGRESS C:\APP\ADMINISTRATOR\ORAD 524288 6
ATA\ORCL\SYSTEM01.DBF
INPUT IN PROGRESS C:\APP\ADMINISTRATOR\ORAD 524288 6
ATA\ORCL\SYSAUX01.DBF
INPUT IN PROGRESS C:\APP\ADMINISTRATOR\ORAD 524288 6
ATA\ORCL\UNDOTBS01.DBF
INPUT IN PROGRESS C:\APP\ADMINISTRATOR\ORAD 524288 6
ATA\ORCL\EXAMPLE01.DBF
INPUT IN PROGRESS C:\APP\ADMINISTRATOR\ORAD 524288 6
ATA\ORCL\USERS01.DBF
sql>/
TYPE STATUS FILENAME BUFFER_SIZE BUFFER_COUNT
——— ———– ————————- ———– ————
INPUT IN PROGRESS C:\APP\ADMINISTRATOR\ORAD 524288 6
ATA\ORCL\SYSTEM01.DBF
INPUT IN PROGRESS C:\APP\ADMINISTRATOR\ORAD 524288 6
ATA\ORCL\SYSAUX01.DBF
INPUT IN PROGRESS C:\APP\ADMINISTRATOR\ORAD 524288 6
ATA\ORCL\UNDOTBS01.DBF
INPUT IN PROGRESS C:\APP\ADMINISTRATOR\ORAD 524288 6
ATA\ORCL\EXAMPLE01.DBF
sql>/
TYPE STATUS FILENAME BUFFER_SIZE BUFFER_COUNT
——— ———– ————————- ———– ————
INPUT IN PROGRESS C:\APP\ADMINISTRATOR\ORAD 524288 6
ATA\ORCL\SYSTEM01.DBF
INPUT IN PROGRESS C:\APP\ADMINISTRATOR\ORAD 524288 6
ATA\ORCL\SYSAUX01.DBF
INPUT IN PROGRESS C:\APP\ADMINISTRATOR\ORAD 524288 6
ATA\ORCL\EXAMPLE01.DBF
sql>/
INPUT IN PROGRESS C:\APP\ADMINISTRATOR\ORAD 524288 6
ATA\ORCL\SYSTEM01.DBF
INPUT IN PROGRESS C:\APP\ADMINISTRATOR\ORAD 524288 6
ATA\ORCL\SYSAUX01.DBF
sql>/
TYPE STATUS FILENAME BUFFER_SIZE BUFFER_COUNT
——— ———– ————————- ———– ————
INPUT IN PROGRESS C:\APP\ADMINISTRATOR\ORAD 524288 6
ATA\ORCL\SYSTEM01.DBF
—————————————–
Let’s verify for multiplexing level of 9 (> 8) .
—————————————–
RMAN>delete backup;
RMAN> run{
allocate channel c1 device type disk maxopenfiles 9;
backup datafile 1,2,3,4,5,6,7,8,9;
}
— Note that buffers are allocated simultaneously to all the 9 datafiles so that data from all the files will be intermingled in the output file.
— Since multiplexing level = 9 ( Level > 8), RMAN allocates four 128 KB disk buffers per channel for each file, so that the total size is 512 KB per channel for each file.
sql>col filename for a25 word_wrapped
select type, status, filename, buffer_size, buffer_count
from v$backup_async_io
where type <> ‘AGGREGATE’
and status = ‘IN PROGRESS';
TYPE STATUS FILENAME BUFFER_SIZE BUFFER_COUNT
——— ———– ————————- ———– ————
INPUT IN PROGRESS C:\APP\ADMINISTRATOR\ORAD 131072 4
ATA\ORCL\SYSTEM01.DBF
INPUT IN PROGRESS C:\APP\ADMINISTRATOR\ORAD 131072 4
ATA\ORCL\SYSAUX01.DBF
INPUT IN PROGRESS C:\APP\ADMINISTRATOR\ORAD 131072 4
ATA\ORCL\UNDOTBS01.DBF
INPUT IN PROGRESS C:\APP\ADMINISTRATOR\ORAD 131072 4
ATA\ORCL\EXAMPLE01.DBF
INPUT IN PROGRESS C:\APP\ADMINISTRATOR\ORAD 131072 4
ATA\ORCL\RMAN1.DBF
INPUT IN PROGRESS C:\APP\ADMINISTRATOR\ORAD 131072 4
ATA\ORCL\RMAN2.DBF
INPUT IN PROGRESS C:\APP\ADMINISTRATOR\ORAD 131072 4
ATA\ORCL\RMAN3.DBF
INPUT IN PROGRESS C:\APP\ADMINISTRATOR\ORAD 131072 4
ATA\ORCL\RMAN4.DBF
INPUT IN PROGRESS C:\APP\ADMINISTRATOR\ORAD 131072 4
ATA\ORCL\USERS01.DBF
Conclusion :
Thanx for your time. Happy Tuning !!
References
http://docs.oracle.com/cd/B28359_01/backup.111/b28270/rcmcncpt.htm#BRADV89486
http://hemantoracledba.blogspot.in/2015/07/rman-5-useful-keywords-and-subclauses.html?utm_source=feedburner&utm_medium=email&utm_campaign=Feed:+blogspot/JcnHK+(Hemant%27s+Oracle+DBA+Blog)
http://hemantoracledba.blogspot.in/2015/07/rman-5b-more-useful-keywords-and.html?utm_source=feedburner&utm_medium=email&utm_campaign=Feed:+blogspot/JcnHK+(Hemant%27s+Oracle+DBA+Blog)
http://hemantoracledba.blogspot.in/2015/07/rman-5c-some-more-useful-keywords-and.html?utm_source=feedburner&utm_medium=email&utm_campaign=Feed:+blogspot/JcnHK+(Hemant%27s+Oracle+DBA+Blog)
Retention Policy and Control_file_record_keep_time
3 RMAN Parameters every DBA should know
Spreading RMAN Backups Across Multiple Disks
Triplexing RMAN Backups
———————————————————————————————————-