rman備份腳本和rman增量備份腳本分享
一、單獨備份
1、經(jīng)典整庫備份:backup as compressed backupset database include current controlfile plus archivelog delete all input;
2、tablespace:backup tablespace 名字;
3、數(shù)據(jù)文件:backup datafile n; (n:具體的數(shù)據(jù)文件編號select file_name,file_id,tablespace_name from dba_data_files;)
4、控制文件:backup current controlfile;或者backup database include current controlfile;
5、日志文件:backup archivelog all;或者 database plus archivelog;
6、參數(shù)文件:backup spfile;
7、全庫備份腳本:
run{
allocate channel c1 type disk;
backup full tag ‘dbfull' format ‘/backup/full%u_%s_%p' database
include current controlfile;
sql ‘a(chǎn)lter system archive log current'; #在數(shù)據(jù)庫進行全備份完成之后,需要執(zhí)行該條命令將當前日志歸檔,備份歸檔日志時應該包括最后生成的歸檔
backup filesperset 3 format ‘/backup/arch%u_%s_%p'#filesperset 3設(shè)定每個備份集里文件不超過3個
archivelog all delete input; #備份歸檔可選,可以單獨定期備份
release channel c1;
}
二、增量備份
1、0級增量備份
run{
allocate channel c1 type disk;
backup incremental level 0 tag ‘db0' format ‘/backup/db0%u_%s_%p'database
include current controlfile; ;
sql 'alter system archive log current';#在數(shù)據(jù)庫進行全備份完成之后,需要執(zhí)行該條命令將當前日志歸檔,備份歸檔日志時應該包括最后生成的歸檔
backup filesperset 3 format ‘/backup/arch%u_%s_%p'#filesperset 3設(shè)定每個備份集里文件不超過3個
archivelog all delete input; #備份歸檔可選,可以單獨定期備份
release channel c1;
}
2、1級備份腳本
run{
allocate channel c1 type disk;
backup incremental level 1 tag ‘db1' format ‘/backup/db1%u_%s_%p'
database skip readonly include current controlfile;
backup filesperset 3 format ‘/backup/arch%u_%s_%p'#filesperset設(shè)定每個備份集里文件不超過3個
archivelog all delete input; #備份歸檔可選,可以單獨定期備份
release channel c1;
}
相關(guān)文章
oracle數(shù)據(jù)遷移到db2數(shù)據(jù)庫的實現(xiàn)方法(分享)
下面小編就為大家?guī)硪黄猳racle數(shù)據(jù)遷移到db2數(shù)據(jù)庫的實現(xiàn)方法(分享)。小編覺得挺不錯的,現(xiàn)在就分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2017-04-04