rman備份的優化 - 使用section size

rdbms 19.0.0.0下測試

在11g之前,rman通過並行分配多個通道進行並行備份,每個通道成爲一個rman會話,但是每個通道一次最多隻能備份一個數據文件,意味着即使有多個通道,每個數據文件也只能通過一個通道進行備份。在11gr2的rman中,分配的通道可以把一個數據文件分成塊,也叫做片段(section),可以指定每個片段的大小。


以下測試一個例子,數據文件不到400M,分配兩個通道,也就是開了兩個並行進行備份。指定section size和不指定section size的區別。
經過測試,不啓用section size的時候,多個通道備份一個文件,僅僅有一個通道生效(也就是沒有用並行),當開啓了section size的時候,多個通道備份一個文件,多個通道會同時進行備份(也就是使用了並行),從而節約了時間。下面的測試,使用section size是1秒。未使用是3秒。
 

run
{
allocate channel c1 type disk format '/home/oracle/%U';
allocate channel c2 type disk format '/home/oracle/%U';
backup section size 200M datafile 2;
}

-- 兩個通道,並行爲2,section size200M,對一個文件進行備份,生成了兩個備份集/home/oracle/0duf6nlr_1_1和/home/oracle/0duf6nlr_2_1。備份時間是1秒。

RMAN> run
{
allocate channel c1 type disk format '/home/oracle/%U';
allocate channel c2 type disk format '/home/oracle/%U';
backup section size 200M datafile 2;
}2> 3> 4> 5> 6>

using target database control file instead of recovery catalog
allocated channel: c1
channel c1: SID=269 device type=DISK

allocated channel: c2
channel c2: SID=395 device type=DISK

Starting backup at 25-OCT-19
channel c1: starting full datafile backup set
channel c1: specifying datafile(s) in backup set
input datafile file number=00002 name=/u01/oradata/TEST/tbs_hmw01.dbf
backing up blocks 1 through 25600
channel c1: starting piece 1 at 25-OCT-19
channel c2: starting full datafile backup set
channel c2: specifying datafile(s) in backup set
input datafile file number=00002 name=/u01/oradata/TEST/tbs_hmw01.dbf
backing up blocks 25601 through 51200
channel c2: starting piece 2 at 25-OCT-19
channel c1: finished piece 1 at 25-OCT-19
piece handle=/home/oracle/0duf6nlr_1_1 tag=TAG20191025T104059 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:00
channel c2: finished piece 2 at 25-OCT-19
piece handle=/home/oracle/0duf6nlr_2_1 tag=TAG20191025T104059 comment=NONE
channel c2: backup set complete, elapsed time: 00:00:01
Finished backup at 25-OCT-19

Starting Control File and SPFILE Autobackup at 25-OCT-19
piece handle=/u01/archivelog/TEST/autobackup/2019_10_25/o1_mf_s_1022582461_gv4r5xff_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 25-OCT-19
released channel: c1
released channel: c2

RMAN>

--雖然開了兩個通道,但是是對同一個文件進行備份,沒有設置section size,其實起作用的還是一個通道(並行沒有用)。生成了一個備份集/home/oracle/nosection0guf6nqh_1_1。 備份時間是3秒,相比開了section size 多了1秒。

run
{
allocate channel c1 type disk format '/home/oracle/nosection%U';
allocate channel c2 type disk format '/home/oracle/nosection%U';
backup datafile 2;
}

RMAN> run
{
allocate channel c1 type disk format '/home/oracle/nosection%U';
allocate channel c2 type disk format '/home/oracle/nosection%U';
backup datafile 2;
}2> 3> 4> 5> 6>

allocated channel: c1
channel c1: SID=269 device type=DISK

allocated channel: c2
channel c2: SID=395 device type=DISK

Starting backup at 25-OCT-19
channel c1: starting full datafile backup set
channel c1: specifying datafile(s) in backup set
input datafile file number=00002 name=/u01/oradata/TEST/tbs_hmw01.dbf
channel c1: starting piece 1 at 25-OCT-19
channel c1: finished piece 1 at 25-OCT-19
piece handle=/home/oracle/nosection0guf6nqh_1_1 tag=TAG20191025T104329 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:03
Finished backup at 25-OCT-19

Starting Control File and SPFILE Autobackup at 25-OCT-19
piece handle=/u01/archivelog/TEST/autobackup/2019_10_25/o1_mf_s_1022582613_gv4rboqn_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 25-OCT-19
released channel: c1
released channel: c2

RMAN>

END

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章