您好,登錄后才能下訂單哦!
RMAN備份filesperset用法
用filesperset控制備份集的尺寸
當(dāng)指定filesperset參數(shù)時(shí),rman比較filesperset與自動(dòng)計(jì)算出來的值(對(duì)每個(gè)已分配通道的文件數(shù)目)
并取其中較小的那個(gè)值來保證所有的通道被使用。
如果指定或者通過組合backupSpec語句暗示的文件數(shù)目比filesperset要大,
那么rman創(chuàng)建多個(gè)備份集來維護(hù)正確的速率(ratio);
如果沒有指定filesperset,rman比較計(jì)算出來的值(文件數(shù)目除以已分配的通道)和默認(rèn)值64,
并取其中較小的那個(gè)值來保證所有通道可用。
Rman通常嘗試創(chuàng)建足夠的備份集以使所有已分配的通道有事可做。
一個(gè)例外是通道比要備份的文件還要多
allocate channel 提供備份并發(fā)度,若平均文件數(shù)<filesperset則會(huì)按照 平均文件數(shù)/備份集 進(jìn)行備份,若超過則按照filesperset的數(shù)量生成備份集;例如:
1、run {
allocate channel ch2 type disk;
allocate channel ch3 type disk;
backup datafile 3,4,5,6 filesperset 3;
release channel ch2;
release channel ch3;
}
平均數(shù)是 4(文件數(shù))/2(channel數(shù)) = 2 ,小于filesperset 3,則生成2個(gè)備份集,每個(gè)備份集包含2個(gè)數(shù)據(jù)文件
2、run {
allocate channel ch2 type disk;
allocate channel ch3 type disk;
backup datafile 3,4,5,6 filesperset 1;
release channel ch2;
release channel ch3;
}
則生成4個(gè)備份集,每個(gè)包含一個(gè)數(shù)據(jù)文件
創(chuàng)建RMAN備份 恢復(fù)目錄數(shù)據(jù)庫(kù)
這是前段時(shí)間給客戶做的RMAN備份策略,今天有時(shí)間整理出來,希望對(duì)大家有些幫助,如有不對(duì)的地方歡迎大家給予指點(diǎn),謝謝!
1.創(chuàng)建恢復(fù)目錄數(shù)據(jù)庫(kù)
如果不是在本地配置RMAN恢復(fù)目錄,
在一臺(tái)WINDOW2000電腦上安裝ORACLE數(shù)據(jù)庫(kù),最好保證數(shù)據(jù)庫(kù)版本與目標(biāo)數(shù)據(jù)庫(kù)的版本想同。
建立RMAN 數(shù)據(jù)庫(kù)用戶及表空間:
RECOVER CATALOG 表空間(cattbs):1G
系統(tǒng)表空間: 100M
UNDO表空間: 100M
臨時(shí)表空間(TEMP): 100M
用以下命令創(chuàng)建RMAN 用戶并授予權(quán)限:
create user rman identified rman default tablespace cattbs temporary tablespace temp;
授予權(quán)限:
Grant connect, resource to rman;
Grant recovery_catalog_owner to rman
創(chuàng)建恢復(fù)目錄:
進(jìn)入RMN 如果恢復(fù)目錄與目標(biāo)數(shù)據(jù)庫(kù)不在同一臺(tái)機(jī)子上,用以下:
Rman catalog rman/rman@192.168.100.144.
Rman> create catalog
C:/rman target sys/a123456@192.168.100.2 catalog rman /rman
Rman> register database;
如果想重新注冊(cè),查詢數(shù) 據(jù)字典DB 得到DB_KEY與DB_ID 執(zhí)行DBMS_RCVAT.UNREGISTERDATABASE 命令取消注冊(cè)。重新注冊(cè)。
Sql> conn rman/rman
Sql> select * from db;
Sql> exec dbms_rcvcat.unregisterdatabase(DB_KEY,DB_ID);
Rman> resync catalog;
每半年做一個(gè)數(shù)據(jù)庫(kù)的全備份(包含只讀表空間)
每個(gè)月做一次零級(jí)備份(不包含只讀表空間)
每個(gè)星期做一次一級(jí)備份
每天做一個(gè)二級(jí)備份
數(shù)據(jù)庫(kù)全備份腳本:
run {
allocate channel c1 type disk;
allocate channel c2 type disk;
allocate channel c3 type disk;
backup full tag 'dbfull' format '/backup/ncfc/full%d%p%t' database ;
sql 'alter system archive log current' ;
backup format /backup/ncfc/dbL0/dbL0%d%p%t.arc' filesperset 5 archivelog all delete input;
release channel c1;
release channel c2;
release channel c3;
}
零級(jí)備份腳本(只讀表空間除外)
run {
allocate channel c1 type disk maxpiecesize =20G;
allocate channel c2 type disk maxpiecesize =20G;
allocate channel c3 type disk maxpiecesize =20G;
backup incremental level 0 filesperset 10 tag 'dbL0' format '/backup/ncfc/dbL0/dbL0%u%p%c ' database skip readonly;
sql 'alter system archive log current' ;
backup format '/backup/ncfc/dbL0/arch%u%p%c.arc' filesperset 5 archivelog from time "sysdate-1" all;
release channel c1;
release channel c2;
release channel c3;
}
一級(jí)備份腳本
run {
allocate channel c1 type disk maxpiecesize =20G;
allocate channel c2 type disk maxpiecesize =20G;
allocate channel c3 type disk maxpiecesize =20G;
backup incremental level 1 filesperset 5 tag 'dbL1' format '/backup/ncfc/dbL1/dbL1%d%p%t ' ddatabase skip readonly;
sql 'alter system archive log current' ;
backup format '/backup/ncfc/dbL1/dbL1%d%p%t.arc' filesperset 5 archivelog from time "sysdate-1" all;
release channel c1;
release channel c2;
release channel c3;
}
二級(jí)備份腳本
run {
allocate channel c1 type disk maxpiecesize =20G;
allocate channel c2 type disk maxpiecesize =20G;
allocate channel c3 type disk maxpiecesize =20G;
backup incremental level 2 filesperset 5 tag 'dbL2' format '/backup/ncfc/dbL2/dbL2%u%p%c' ddatabase skip readonly;
sql 'alter system archive log current' ;
backup format '/backup/ncfc/dbL2/dbL2%d%p%t.arc' filesperset 5 archivelog from time "sysdate-1" all;
release channel c1;
release channel c2;
release channel c3;
}
歸檔文件備份腳本
run {
allocate channel dev1 type disk maxpiecesize =20G;
allocate channel dev2 type disk maxpiecesize =20G;
allocate channel dev3 type disk maxpiecesize =20G;
sql 'alter system archive log current' ;
backup format '/backup/ncfc/arc/arch%u%p%c ' archivelog from time "sysdate-1" all;
release channel dev1;
release channel dev2;
release channel dev3;
}
表空間備份腳本(以u(píng)sers表空間為例)
run {
allocate channel c1 type disk;
allocate channel c2 type disk;
allocate channel c3 type disk;
backup tag 'tabsp' format '/backup/ncfc/tabsp/tabsp%u%p%c' tablespace users;
sql 'alter system archive log current' ;
backup format 'e:\oradata\%d%p%t.arc' filesperset 5 archivelog all delete input;
release channel c1;
release channel c2;
release channel c3;
}
則每天所需要備份的數(shù)據(jù)量只有一天的改變量。而做恢復(fù)時(shí)最多只要恢復(fù)當(dāng)月的一個(gè)零級(jí)備份+三個(gè)一級(jí)備份+6個(gè)二級(jí)備份+當(dāng)天的歸檔文件。如果不能接受這樣的恢復(fù)時(shí)間,就只能夠減少零級(jí)備份之間的時(shí)間間隔(如可以每個(gè)星期做一個(gè)零級(jí)備份,這樣恢復(fù)時(shí)最多只需要恢復(fù)一個(gè)星期的數(shù)據(jù)量)。
備份CATALOG數(shù)據(jù)庫(kù)(數(shù)據(jù)庫(kù)邏輯輸出)
exp pafile=exp.dat
其中exp.dat如下
userid=rman/rman
file=rmanexp.dmp
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。