您好,登錄后才能下訂單哦!
這篇文章給大家分享的是有關Oracle中RMAN的BACKUP常用參數有哪些的內容。小編覺得挺實用的,因此分享給大家做個參考,一起跟隨小編過來看看吧。
backup命令用來生成備份,可以在執行backup時為備份指定很多屬性。官方文檔上backup命令語法功能非常豐富,但是沒有必要一一的掌握。先要了解一些基本用法,特殊的參數,用到的時候臨時抱佛腳就行了。
下面我們挑一些常用的參數,做以說明。
BACKUP參數選項
full | 服務器會話將所有塊都復制到備份集中,只跳過從未使用過的數據文 件塊。在備份歸檔重做日志或控制文件時,服務器會話不會跳過任何塊。完全備份不是增量備份。 |
incremental level integer | 服務器會話復制自上次n 級增量備份以來更改過的數據塊,其中n 是從1 到4 之間的任意整數。要執行大于0 級的增量備份時,服務器進程會在BACKUP 命令中檢查每個數據文件的0 級備份或0 級副本是否存在。如果指定增量,則必須在備份說明中設置以下參數之一:DATA FILE、DATA FILECOPY、TABLESPACE 或DATABASE。恢復管理器不支持控制文件、歸檔重做日志或備份集的增量備份。 |
filesperset integer | 如果指定了FILESPERSET 參數,恢復管理器就會將FILESPERSET值與計算的值(備份的文件數與通道數的比值)進行比較,并采用兩者中的較小值,從而確保使用所有的通道。如果不指定FILESPERSET,恢復管理器就會將計算的值(文件數與分配的通道數的比值)與缺省值64 進行比較并采用兩者中的較小值。當通道多于要備份的文件時,多余的通道將保持空閑。輸入文件不能在通道之間進行分割。 |
skip | 指定該參數可將某些數據文件或歸檔重做日志排除在備份集之外。該參數具有以下選項: offline:將脫機數據文件排除在備份集之外。 readonly:排除屬于只讀表空間的數據文件。 inaccessible:排除由于I/O 錯誤而無法讀取的數據文件或歸檔重 做日志。 |
maxsetsize integer | 以字節(缺省)、千字節(K)、兆字節(M) 或千兆字節(G) 來指定備份集的最大大小。恢復管理器會盡量將所有的備份集限制為指定的大小。 |
delete input | 在成功創建備份集后刪除輸入文件。僅當備份歸檔重做日志、數據文 件副本或備份集時才指定該選項。它相當于對所有輸入文件執行 CHANGE . . . DELETE 命令。 |
include current controlfile | 創建當前控制文件的快照并將其放置在該子句生成的各備份集中。 |
Format | 輸出名稱的格式。可以單獨使用或組合使用格式參數。 |
PLUS ARCHIVELOG | 連帶ARCHIVELOG一起備份 |
COPIES integer | 多重備份,即備份集寫多份。integer 取值(1-4),默認是1 |
下面演示一下skip、filesperset、maxsetsize、COPIES等用法
skip 跳過只讀文件
SQL> ALTER TABLESPACE IDX READ ONLY; Tablespace altered. RMAN> BACKUP DATABASE SKIP READONLY; Starting backup at 2015/07/09 03:39:49 allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=1 device type=DISK skipping read-only file 6 channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set input datafile file number=00001 name=/u01/app/oracle/oradata/devdb/system01.dbf input datafile file number=00002 name=/u01/app/oracle/oradata/devdb/sysaux01.dbf input datafile file number=00005 name=/u01/app/oracle/oradata/devdb/example01.dbf input datafile file number=00003 name=/u01/app/oracle/oradata/devdb/undotbs01.dbf input datafile file number=00004 name=/u01/app/oracle/oradata/devdb/users01.dbf channel ORA_DISK_1: starting piece 1 at 2015/07/09 03:39:49 channel ORA_DISK_1: finished piece 1 at 2015/07/09 03:41:45 piece handle=/u01/app/oracle/fast_recovery_area/DEVDB/backupset/2015_07_09/o1_mf_nnndf_TAG20150709T033949_bstz45xk_.bkp tag=TAG20150709T033949 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:01:56 channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set including current control file in backup set including current SPFILE in backup set channel ORA_DISK_1: starting piece 1 at 2015/07/09 03:41:46 channel ORA_DISK_1: finished piece 1 at 2015/07/09 03:41:47 piece handle=/u01/app/oracle/fast_recovery_area/DEVDB/backupset/2015_07_09/o1_mf_ncsnf_TAG20150709T033949_bstz7toh_.bkp tag=TAG20150709T033949 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01 Finished backup at 2015/07/09 03:41:47
FILEPERSET 限制備份集最多包含文件個數。
RMAN> BACKUP DATABASE filesperset 2; Starting backup at 2015/07/09 03:45:11 using channel ORA_DISK_1 channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set input datafile file number=00001 name=/u01/app/oracle/oradata/devdb/system01.dbf input datafile file number=00006 name=/u01/app/oracle/oradata/devdb/idx01.dbf channel ORA_DISK_1: starting piece 1 at 2015/07/09 03:45:11 channel ORA_DISK_1: finished piece 1 at 2015/07/09 03:45:46 piece handle=/u01/app/oracle/fast_recovery_area/DEVDB/backupset/2015_07_09/o1_mf_nnndf_TAG20150709T034511_bstzg7tn_.bkp tag=TAG20150709T034511 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:35 channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set input datafile file number=00002 name=/u01/app/oracle/oradata/devdb/sysaux01.dbf input datafile file number=00004 name=/u01/app/oracle/oradata/devdb/users01.dbf channel ORA_DISK_1: starting piece 1 at 2015/07/09 03:45:46 channel ORA_DISK_1: finished piece 1 at 2015/07/09 03:46:11 piece handle=/u01/app/oracle/fast_recovery_area/DEVDB/backupset/2015_07_09/o1_mf_nnndf_TAG20150709T034511_bstzhc17_.bkp tag=TAG20150709T034511 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:26 channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set input datafile file number=00005 name=/u01/app/oracle/oradata/devdb/example01.dbf input datafile file number=00003 name=/u01/app/oracle/oradata/devdb/undotbs01.dbf channel ORA_DISK_1: starting piece 1 at 2015/07/09 03:46:12 channel ORA_DISK_1: finished piece 1 at 2015/07/09 03:46:27 piece handle=/u01/app/oracle/fast_recovery_area/DEVDB/backupset/2015_07_09/o1_mf_nnndf_TAG20150709T034511_bstzj460_.bkp tag=TAG20150709T034511 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:15 channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set including current control file in backup set including current SPFILE in backup set channel ORA_DISK_1: starting piece 1 at 2015/07/09 03:46:28 channel ORA_DISK_1: finished piece 1 at 2015/07/09 03:46:29 piece handle=/u01/app/oracle/fast_recovery_area/DEVDB/backupset/2015_07_09/o1_mf_ncsnf_TAG20150709T034511_bstzjnbx_.bkp tag=TAG20150709T034511 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01 Finished backup at 2015/07/09 03:46:29
maxsetsize 設置備份集最大大
RMAN> backup database maxsetsize 200M; Starting backup at 2015/07/09 03:52:02 using channel ORA_DISK_1 RMAN-00571: =========================================================== RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: =========================================================== RMAN-03002: failure of backup command at 07/09/2015 03:52:02 RMAN-06183: datafile or datafile copy /u01/app/oracle/oradata/devdb/system01.dbf (file number 1) larger than MAXSETSIZE
備份集的最大大小不能小于任意一個數據文件的大小。
RMAN> backup database maxsetsize 1G; Starting backup at 2015/07/09 03:58:47 allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=1 device type=DISK channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set input datafile file number=00002 name=/u01/app/oracle/oradata/devdb/sysaux01.dbf input datafile file number=00005 name=/u01/app/oracle/oradata/devdb/example01.dbf channel ORA_DISK_1: starting piece 1 at 2015/07/09 03:58:48 channel ORA_DISK_1: finished piece 1 at 2015/07/09 03:59:23 piece handle=/u01/app/oracle/fast_recovery_area/DEVDB/backupset/2015_07_09/o1_mf_nnndf_TAG20150709T035847_bsv07r5l_.bkp tag=TAG20150709T035847 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:35 channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set input datafile file number=00001 name=/u01/app/oracle/oradata/devdb/system01.dbf input datafile file number=00003 name=/u01/app/oracle/oradata/devdb/undotbs01.dbf input datafile file number=00004 name=/u01/app/oracle/oradata/devdb/users01.dbf input datafile file number=00006 name=/u01/app/oracle/oradata/devdb/idx01.dbf channel ORA_DISK_1: starting piece 1 at 2015/07/09 03:59:23 channel ORA_DISK_1: finished piece 1 at 2015/07/09 03:59:58 piece handle=/u01/app/oracle/fast_recovery_area/DEVDB/backupset/2015_07_09/o1_mf_nnndf_TAG20150709T035847_bsv08vcs_.bkp tag=TAG20150709T035847 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:35 channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set including current control file in backup set including current SPFILE in backup set channel ORA_DISK_1: starting piece 1 at 2015/07/09 03:59:59 channel ORA_DISK_1: finished piece 1 at 2015/07/09 04:00:00 piece handle=/u01/app/oracle/fast_recovery_area/DEVDB/backupset/2015_07_09/o1_mf_ncsnf_TAG20150709T035847_bsv09zlm_.bkp tag=TAG20150709T035847 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01 Finished backup at 2015/07/09 04:00:00
SQL> select name,bytes/1024/1024||'MB' from v$datafile; NAME BYTES/1024/1024||'MB' -------------------------------------------------- -------------------------------------- /u01/app/oracle/oradata/devdb/system01.dbf 770MB /u01/app/oracle/oradata/devdb/sysaux01.dbf 580MB /u01/app/oracle/oradata/devdb/undotbs01.dbf 95MB /u01/app/oracle/oradata/devdb/users01.dbf 16.25MB /u01/app/oracle/oradata/devdb/example01.dbf 345.625MB /u01/app/oracle/oradata/devdb/idx01.dbf 10MB
COPIES
RMAN> backup copies 2 database format '/backup/full_%U'; Starting backup at 2015/07/09 04:06:29 using channel ORA_DISK_1 channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set input datafile file number=00001 name=/u01/app/oracle/oradata/devdb/system01.dbf input datafile file number=00002 name=/u01/app/oracle/oradata/devdb/sysaux01.dbf input datafile file number=00005 name=/u01/app/oracle/oradata/devdb/example01.dbf input datafile file number=00003 name=/u01/app/oracle/oradata/devdb/undotbs01.dbf input datafile file number=00004 name=/u01/app/oracle/oradata/devdb/users01.dbf input datafile file number=00006 name=/u01/app/oracle/oradata/devdb/idx01.dbf channel ORA_DISK_1: starting piece 1 at 2015/07/09 04:06:29 channel ORA_DISK_1: finished piece 1 at 2015/07/09 04:08:04 with 2 copies and tag TAG20150709T040629 piece handle=/backup/full_3bqbj5m5_1_1 comment=NONE piece handle=/backup/full_3bqbj5m5_1_2 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:01:35 channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set including current control file in backup set including current SPFILE in backup set channel ORA_DISK_1: starting piece 1 at 2015/07/09 04:08:05 channel ORA_DISK_1: finished piece 1 at 2015/07/09 04:08:06 with 2 copies and tag TAG20150709T040629 piece handle=/backup/full_3cqbj5p4_1_1 comment=NONE piece handle=/backup/full_3cqbj5p4_1_2 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01 Finished backup at 2015/07/09 04:08:06
如果備份集放到默認的fast recovery area中,是不允許使用copies參數的
RMAN> backup copies 2 database; Starting backup at 2015/07/09 04:11:37 using channel ORA_DISK_1 channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set input datafile file number=00001 name=/u01/app/oracle/oradata/devdb/system01.dbf input datafile file number=00002 name=/u01/app/oracle/oradata/devdb/sysaux01.dbf input datafile file number=00005 name=/u01/app/oracle/oradata/devdb/example01.dbf input datafile file number=00003 name=/u01/app/oracle/oradata/devdb/undotbs01.dbf input datafile file number=00004 name=/u01/app/oracle/oradata/devdb/users01.dbf input datafile file number=00006 name=/u01/app/oracle/oradata/devdb/idx01.dbf channel ORA_DISK_1: starting piece 1 at 2015/07/09 04:11:37 RMAN-03009: failure of backup command on ORA_DISK_1 channel at 07/09/2015 04:11:38 ORA-19806: cannot make duplex backups in recovery area continuing other job steps, job failed will not be re-run channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set including current control file in backup set including current SPFILE in backup set channel ORA_DISK_1: starting piece 1 at 2015/07/09 04:11:39 RMAN-00571: =========================================================== RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: =========================================================== RMAN-03009: failure of backup command on ORA_DISK_1 channel at 07/09/2015 04:11:40 ORA-19806: cannot make duplex backups in recovery area
感謝各位的閱讀!關于“Oracle中RMAN的BACKUP常用參數有哪些”這篇文章就分享到這里了,希望以上內容可以對大家有一定的幫助,讓大家可以學到更多知識,如果覺得文章不錯,可以把它分享出去讓更多的人看到吧!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。