Oracle備份的方法很多,下面為您介紹的是Windows環境下的Oracle備份方法,如果您對Oracle備份方面感興趣的話,不妨一看。
利用Oracle的備份命名rman備份,這樣就可以做完全備份和增量備份了,利用任務計劃設置備份策略,比如每周一做0級備份,周二至周日做1級備份。注意利用rman做備份,必須啟用歸檔日志模式。
1、建立0級備份批處理文件backup_0.bat,內容如下:
- set Oracle_sid=oaserver
- rman target / msglog c:\logs\%date:~0,10%.log cmdfile=oaserver_backup_0.txt
2、然後創建負責Oracle備份的文件backup_0.txt,內容如下
- run{
- allocate channel 'd1' type disk;
- allocate channel 'd2' type disk;
- allocate channel 'd3' type disk;
- allocate channel 'd4' type disk;
- backup incremental level 0 cumulative tag 'db0' format 'E:\oaserver\backup\db0%u_%s_%p' database;
- sql 'alter system archive log current';
- backup filesperset 4 archivelog all delete input;
- delete noprompt obsolete;
- release channel d1;
- release channel d2;
- release channel d3;
- release channel d4;
- }
- list backup;
- crosscheck backup;
- delete noprompt expired backup;
- delete noprompt obsolete;
- exit;
- EOF
- echo "-------------------------end------------------------------";date
3、添加一個任務計劃利用任務計劃向導,根據Oracle備份策略設置自動執行任務的時間頻率(例如每天零時),執行backup_0.bat
4、建立1級備份(增量備份)批處理文件backup_1.bat,內容如下:
- set Oracle_sid=oaserver
- rman target / msglog c:\logs\%date:~0,10%.log cmdfile=oaserver_backup_1.txt
5、然後創建負責備份的文件backup_1.txt,內容如下
- run{
- allocate channel 'd1' type disk;
- allocate channel 'd2' type disk;
- allocate channel 'd3' type disk;
- allocate channel 'd4' type disk;
- backup incremental level 1 cumulative tag 'db1' format 'E:\oaserver\backup\db1%u_%s_%p' database;
- sql 'alter system archive log current';
- backup filesperset 4 archivelog all delete input;
- delete noprompt obsolete;
- release channel d1;
- release channel d2;
- release channel d3;
- release channel d4;
- }
- list backup;
- crosscheck backup;
- delete noprompt expired backup;
- delete noprompt obsolete;
- exit;
- EOF
- echo "-------------------------end------------------------------";date
6、添加一個任務計劃利用任務計劃向導,根據備份策略設置自動執行任務的時間頻率(例如每天零時),執行backup_1.bat