備份優化

李行行丶發表於2022-03-18

一:備份集優化

###1.多通道提升備份速度
rman可以通過section size子句利用多個通道對其進行備份
##這種方式對於單個檔案較大,且檔案數量較少效能會有提升
run{
allocate channel c1 device type disk;
allocate channel c2 device type disk;
allocate channel c3 device type disk;
allocate channel c4 device type disk;
backup section size 175M datafile 1;
}
###2.資料塊跟蹤

對於增量備份使用資料塊跟蹤技術,在進行等級1的增量備份時rman無需掃描整個資料檔案,值需要掃描資料塊變更跟蹤檔案就可以發現那些資料塊需要備份了
##需要注意的是:對於rac環境下,我們目錄要設定到共享儲存上
##如果設定的位置是本地目錄,rac在啟動的時候另一個節點就無法正常open
##遇到一種情況,塊跟蹤目錄設定為共享儲存,另一個節點也無法正常開啟。

##開啟資料塊跟蹤
alter database enable block change tracking using file '/home/oracle/bak1/' reuse;
##關閉資料庫塊跟蹤
alter database disable block change tracking;
###3.v$backup_datafile檢視
使用v$backup_datafile檢視能夠驗證備份的效率,blocks_read與datafile_blocks的比值越小說明增量備份讀取的資料塊的數量佔檔案總資料塊的數量就越小,增量備份的效率就越高,啟用資料塊跟蹤的回報就越高。
##如果比值接近1,就沒有理由進行增量備份,不如直接全備,資料塊變更跟蹤檔案也不需要設定了
select file#,sum(blocks_read)/sum(datafile_blocks) ratio from v$backup_datafile
where incremental_level>0 group by file#;

二:映象複製優化
##映象複製就是相當於作業系統層面的copy檔案,最大的缺點就是浪費空間,資料檔案多大,映象複製就多大。
##但是還原資料庫的時候有一個特別的優點--映象複製利用檔案路徑的重新命名可以使還原操作的時間忽略不計(switch修改控制檔案資訊)--一般不會這麼操作
##使用增量備份更新映象複製
如果映象複製的檔案時間週期較長,比如一個周之前的,那麼就需要跑一個周的歸檔才能講資料還原出來
##第一次進行備份會將資料檔案全部copy
backup incremental level 0 for recover of copy with tag 'FLASH' database;
RMAN> backup incremental level 1 for recover of copy with tag 'FLASH' database;
Starting backup at 18-MAR-22
using channel ORA_DISK_1
no parent backup or copy of datafile 1 found
no parent backup or copy of datafile 3 found
no parent backup or copy of datafile 4 found
no parent backup or copy of datafile 5 found
no parent backup or copy of datafile 2 found
no parent backup or copy of datafile 7 found
channel ORA_DISK_1: starting datafile copy
input datafile file number=00001 name=/oradata/orcl/system01.dbf
output file name=/home/oracle/fra/ORCL/datafile/o1_mf_system_k38n80c2_.dbf tag=FLASH RECID=5 STAMP=1099675777
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
channel ORA_DISK_1: starting datafile copy
input datafile file number=00003 name=/oradata/orcl/sysaux01.dbf
output file name=/home/oracle/fra/ORCL/datafile/o1_mf_sysaux_k38n83gk_.dbf tag=FLASH RECID=6 STAMP=1099675782
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07
channel ORA_DISK_1: starting datafile copy
input datafile file number=00004 name=/oradata/orcl/undotbs01.dbf
output file name=/home/oracle/fra/ORCL/datafile/o1_mf_undotbs1_k38n8bjg_.dbf tag=FLASH RECID=7 STAMP=1099675786
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting datafile copy
input datafile file number=00005 name=/oradata/orcl/lhh02.dbf
output file name=/home/oracle/fra/ORCL/datafile/o1_mf_lhh_k38n8cl8_.dbf tag=FLASH RECID=8 STAMP=1099675787
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting datafile copy
input datafile file number=00002 name=/oradata/orcl/users02.dbf
output file name=/home/oracle/fra/ORCL/datafile/o1_mf_users_k38n8dmr_.dbf tag=FLASH RECID=9 STAMP=1099675788
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting datafile copy
input datafile file number=00007 name=/oradata/orcl/users01.dbf
output file name=/home/oracle/fra/ORCL/datafile/o1_mf_users_k38n8foh_.dbf tag=FLASH RECID=10 STAMP=1099675789
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 18-MAR-22
Starting Control File and SPFILE Autobackup at 18-MAR-22
piece handle=/home/oracle/fra/ORCL/autobackup/2022_03_18/o1_mf_s_1099675790_k38n8grb_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 18-MAR-22
##第二次備份的時候,產生了一個增量的備份檔案
backup incremental level 1 for recover of copy with tag 'FLASH' database;
Starting backup at 18-MAR-22
using channel ORA_DISK_1
channel ORA_DISK_1: starting incremental level 1 datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/oradata/orcl/system01.dbf
input datafile file number=00003 name=/oradata/orcl/sysaux01.dbf
input datafile file number=00007 name=/oradata/orcl/users01.dbf
input datafile file number=00004 name=/oradata/orcl/undotbs01.dbf
input datafile file number=00005 name=/oradata/orcl/lhh02.dbf
input datafile file number=00002 name=/oradata/orcl/users02.dbf
channel ORA_DISK_1: starting piece 1 at 18-MAR-22
channel ORA_DISK_1: finished piece 1 at 18-MAR-22
piece handle=/home/oracle/fra/ORCL/backupset/2022_03_18 /o1_mf_nnnd1_FLASH_k38n9qk6_.bkp tag=FLASH comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
Finished backup at 18-MAR-22
Starting Control File and SPFILE Autobackup at 18-MAR-22
piece handle=/home/oracle/fra/ORCL/autobackup/2022_03_18/o1_mf_s_1099675834_k38n9tjj_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 18-MAR-22

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/31462978/viewspace-2872579/,如需轉載,請註明出處,否則將追究法律責任。

相關文章