oracle 控制檔案及引數檔案何時自動備份
結論:
-
當 CONFIGURE CONTROLFILE AUTOBACKUP OFF;時,僅備份1號資料檔案(system)和全備資料庫時,會自動備份控制檔案和引數檔案。 而當控制檔案自動備份關閉時,備份指令碼包含備份控制檔案及歸檔,資料庫備份順序是備份資料庫->自動備份控制檔案和引數檔案->備份控制檔案(備份指令碼指定的)->備份歸檔。 而當控制檔案自動備份關閉時,備份指令碼僅包含備份全庫及備份歸檔(不包含備份控制檔案時),資料庫備份順序是備份資料庫->自動備份控制檔案和引數檔案->備份歸檔。
-
當 CONFIGURE CONTROLFILE AUTOBACKUP ON;時,備份任意檔案(資料檔案、歸檔檔案)及全備,都會自動備份控制檔案和引數檔案。
注意:前提:資料庫使用的是spfile,而不是pfile。
實驗如下:
一、控制檔案自動備份關閉
[oracle@sz-cenaccte-18 backup]$ rman target /
Recovery Manager: Release 11.2.0.3.0 - Production on Thu Aug 4 16:18:15 2022
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: TEST (DBID=2409816349)
RMAN> show all;
using target database control file instead of recovery catalog
RMAN configuration parameters for database with db_unique_name TEST are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/opt/oracle/oracle/product/11.2.0/db_1/dbs/snapcf_test.f'; # default
RMAN>
RMAN> BACKUP as compressed backupset full format '/oradata/backup/test_full_%d_%T_%s.bak' database;
Starting backup at 2022-08-04 16:23:54
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=399 device type=DISK
channel ORA_DISK_1: starting compressed full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/opt/oracle/oracle/oradata/test/system01.dbf
input datafile file number=00002 name=/opt/oracle/oracle/oradata/test/sysaux01.dbf
input datafile file number=00003 name=/opt/oracle/oracle/oradata/test/undotbs01.dbf
input datafile file number=00004 name=/opt/oracle/oracle/oradata/test/users01.dbf
channel ORA_DISK_1: starting piece 1 at 2022-08-04 16:23:55
channel ORA_DISK_1: finished piece 1 at 2022-08-04 16:25:00
piece handle=/oradata/backup/test_full_TEST_20220804_20.bak tag=TAG20220804T162355 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:05
channel ORA_DISK_1: starting compressed 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 2022-08-04 16:25:01
channel ORA_DISK_1: finished piece 1 at 2022-08-04 16:25:02
piece handle=/oradata/backup/test_full_TEST_20220804_21.bak tag=TAG20220804T162355 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 2022-08-04 16:25:02
RMAN>
RMAN> backup datafile 1;
Starting backup at 2022-08-04 16:26:04
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=/opt/oracle/oracle/oradata/test/system01.dbf
channel ORA_DISK_1: starting piece 1 at 2022-08-04 16:26:05
channel ORA_DISK_1: finished piece 1 at 2022-08-04 16:26:20
piece handle=/opt/oracle/oracle/product/11.2.0/db_1/dbs/0m14b38t_1_1 tag=TAG20220804T162604 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 2022-08-04 16:26:21
channel ORA_DISK_1: finished piece 1 at 2022-08-04 16:26:22
piece handle=/opt/oracle/oracle/product/11.2.0/db_1/dbs/0n14b39c_1_1 tag=TAG20220804T162604 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 2022-08-04 16:26:22
RMAN>
RMAN> backup datafile 2;
Starting backup at 2022-08-04 16:26:36
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=00002 name=/opt/oracle/oracle/oradata/test/sysaux01.dbf
channel ORA_DISK_1: starting piece 1 at 2022-08-04 16:26:36
channel ORA_DISK_1: finished piece 1 at 2022-08-04 16:26:43
piece handle=/opt/oracle/oracle/product/11.2.0/db_1/dbs/0o14b39s_1_1 tag=TAG20220804T162636 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:07
Finished backup at 2022-08-04 16:26:43
RMAN>
RMAN> backup datafile 3;
Starting backup at 2022-08-04 16:27:05
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=00003 name=/opt/oracle/oracle/oradata/test/undotbs01.dbf
channel ORA_DISK_1: starting piece 1 at 2022-08-04 16:27:05
channel ORA_DISK_1: finished piece 1 at 2022-08-04 16:27:08
piece handle=/opt/oracle/oracle/product/11.2.0/db_1/dbs/0p14b3ap_1_1 tag=TAG20220804T162705 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
Finished backup at 2022-08-04 16:27:08
RMAN> backup datafile 4;
Starting backup at 2022-08-04 16:27:16
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=00004 name=/opt/oracle/oracle/oradata/test/users01.dbf
channel ORA_DISK_1: starting piece 1 at 2022-08-04 16:27:16
channel ORA_DISK_1: finished piece 1 at 2022-08-04 16:27:17
piece handle=/opt/oracle/oracle/product/11.2.0/db_1/dbs/0q14b3b4_1_1 tag=TAG20220804T162716 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 2022-08-04 16:27:17
RMAN>
RMAN> backup archivelog all;
Starting backup at 2022-08-04 16:35:49
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=8 RECID=1 STAMP=1111845769
input archived log thread=1 sequence=9 RECID=2 STAMP=1111845769
input archived log thread=1 sequence=10 RECID=3 STAMP=1111852683
input archived log thread=1 sequence=11 RECID=4 STAMP=1111852684
input archived log thread=1 sequence=12 RECID=5 STAMP=1111852685
input archived log thread=1 sequence=13 RECID=6 STAMP=1111852685
channel ORA_DISK_1: starting piece 1 at 2022-08-04 16:35:50
channel ORA_DISK_1: finished piece 1 at 2022-08-04 16:35:51
piece handle=/opt/oracle/oracle/product/11.2.0/db_1/dbs/1814b3r6_1_1 tag=TAG20220804T163550 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=1 RECID=7 STAMP=1111854905
input archived log thread=1 sequence=2 RECID=8 STAMP=1111854950
channel ORA_DISK_1: starting piece 1 at 2022-08-04 16:35:51
channel ORA_DISK_1: finished piece 1 at 2022-08-04 16:35:52
piece handle=/opt/oracle/oracle/product/11.2.0/db_1/dbs/1914b3r7_1_1 tag=TAG20220804T163550 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 2022-08-04 16:35:52
RMAN>
.
二、控制檔案自動備份開啟
RMAN> show all;
RMAN configuration parameters for database with db_unique_name TEST are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/opt/oracle/oracle/product/11.2.0/db_1/dbs/snapcf_test.f'; # default
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP on;
new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP ON;
new RMAN configuration parameters are successfully stored
RMAN> show all;
RMAN configuration parameters for database with db_unique_name TEST are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/opt/oracle/oracle/product/11.2.0/db_1/dbs/snapcf_test.f'; # default
RMAN>
RMAN> BACKUP as compressed backupset full format '/oradata/backup/test_full_%d_%T_%s.bak' database;
Starting backup at 2022-08-04 16:28:01
using channel ORA_DISK_1
channel ORA_DISK_1: starting compressed full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/opt/oracle/oracle/oradata/test/system01.dbf
input datafile file number=00002 name=/opt/oracle/oracle/oradata/test/sysaux01.dbf
input datafile file number=00003 name=/opt/oracle/oracle/oradata/test/undotbs01.dbf
input datafile file number=00004 name=/opt/oracle/oracle/oradata/test/users01.dbf
channel ORA_DISK_1: starting piece 1 at 2022-08-04 16:28:01
channel ORA_DISK_1: finished piece 1 at 2022-08-04 16:29:06
piece handle=/oradata/backup/test_full_TEST_20220804_27.bak tag=TAG20220804T162801 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:05
Finished backup at 2022-08-04 16:29:06
Starting Control File and SPFILE Autobackup at 2022-08-04 16:29:06
piece handle=/opt/oracle/oracle/product/11.2.0/db_1/dbs/c-2409816349-20220804-01 comment=NONE
Finished Control File and SPFILE Autobackup at 2022-08-04 16:29:07
RMAN>
RMAN> backup datafile 1;
Starting backup at 2022-08-04 16:29:33
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=/opt/oracle/oracle/oradata/test/system01.dbf
channel ORA_DISK_1: starting piece 1 at 2022-08-04 16:29:33
channel ORA_DISK_1: finished piece 1 at 2022-08-04 16:29:48
piece handle=/opt/oracle/oracle/product/11.2.0/db_1/dbs/0t14b3fd_1_1 tag=TAG20220804T162933 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:15
Finished backup at 2022-08-04 16:29:48
Starting Control File and SPFILE Autobackup at 2022-08-04 16:29:48
piece handle=/opt/oracle/oracle/product/11.2.0/db_1/dbs/c-2409816349-20220804-02 comment=NONE
Finished Control File and SPFILE Autobackup at 2022-08-04 16:29:49
RMAN> backup datafile 2;
Starting backup at 2022-08-04 16:29:58
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=00002 name=/opt/oracle/oracle/oradata/test/sysaux01.dbf
channel ORA_DISK_1: starting piece 1 at 2022-08-04 16:29:58
channel ORA_DISK_1: finished piece 1 at 2022-08-04 16:30:05
piece handle=/opt/oracle/oracle/product/11.2.0/db_1/dbs/0v14b3g6_1_1 tag=TAG20220804T162958 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:07
Finished backup at 2022-08-04 16:30:05
Starting Control File and SPFILE Autobackup at 2022-08-04 16:30:05
piece handle=/opt/oracle/oracle/product/11.2.0/db_1/dbs/c-2409816349-20220804-03 comment=NONE
Finished Control File and SPFILE Autobackup at 2022-08-04 16:30:06
RMAN> backup datafile 3;
Starting backup at 2022-08-04 16:30: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=00003 name=/opt/oracle/oracle/oradata/test/undotbs01.dbf
channel ORA_DISK_1: starting piece 1 at 2022-08-04 16:30:11
channel ORA_DISK_1: finished piece 1 at 2022-08-04 16:30:14
piece handle=/opt/oracle/oracle/product/11.2.0/db_1/dbs/1114b3gj_1_1 tag=TAG20220804T163011 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
Finished backup at 2022-08-04 16:30:14
Starting Control File and SPFILE Autobackup at 2022-08-04 16:30:14
piece handle=/opt/oracle/oracle/product/11.2.0/db_1/dbs/c-2409816349-20220804-04 comment=NONE
Finished Control File and SPFILE Autobackup at 2022-08-04 16:30:15
RMAN> backup datafile 4;
Starting backup at 2022-08-04 16:30:21
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=00004 name=/opt/oracle/oracle/oradata/test/users01.dbf
channel ORA_DISK_1: starting piece 1 at 2022-08-04 16:30:21
channel ORA_DISK_1: finished piece 1 at 2022-08-04 16:30:22
piece handle=/opt/oracle/oracle/product/11.2.0/db_1/dbs/1314b3gt_1_1 tag=TAG20220804T163021 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 2022-08-04 16:30:22
Starting Control File and SPFILE Autobackup at 2022-08-04 16:30:22
piece handle=/opt/oracle/oracle/product/11.2.0/db_1/dbs/c-2409816349-20220804-05 comment=NONE
Finished Control File and SPFILE Autobackup at 2022-08-04 16:30:23
RMAN>
RMAN> backup archivelog all;
Starting backup at 2022-08-04 16:35:05
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=8 RECID=1 STAMP=1111845769
input archived log thread=1 sequence=9 RECID=2 STAMP=1111845769
input archived log thread=1 sequence=10 RECID=3 STAMP=1111852683
input archived log thread=1 sequence=11 RECID=4 STAMP=1111852684
input archived log thread=1 sequence=12 RECID=5 STAMP=1111852685
input archived log thread=1 sequence=13 RECID=6 STAMP=1111852685
channel ORA_DISK_1: starting piece 1 at 2022-08-04 16:35:05
channel ORA_DISK_1: finished piece 1 at 2022-08-04 16:35:08
piece handle=/opt/oracle/oracle/product/11.2.0/db_1/dbs/1514b3pp_1_1 tag=TAG20220804T163505 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=1 RECID=7 STAMP=1111854905
channel ORA_DISK_1: starting piece 1 at 2022-08-04 16:35:08
channel ORA_DISK_1: finished piece 1 at 2022-08-04 16:35:09
piece handle=/opt/oracle/oracle/product/11.2.0/db_1/dbs/1614b3ps_1_1 tag=TAG20220804T163505 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 2022-08-04 16:35:09
Starting Control File and SPFILE Autobackup at 2022-08-04 16:35:09
piece handle=/opt/oracle/oracle/product/11.2.0/db_1/dbs/c-2409816349-20220804-06 comment=NONE
Finished Control File and SPFILE Autobackup at 2022-08-04 16:35:10
RMAN>
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/31397003/viewspace-2909040/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 【RMAN】Oracle中如何備份控制檔案?備份控制檔案的方式有哪幾種?Oracle
- 2.7.9 備份伺服器引數檔案(SPFILE)伺服器
- gitlab自動定時備份檔案,備份失敗傳送郵件Gitlab
- shell 備份檔案指令碼+自動清理指令碼
- [重慶思莊每日技術分享]-控制檔案自動備份
- Oracle RAC引數檔案管理Oracle
- Oracle-無備份情況下,如何手動恢復控制檔案Oracle
- Oracle 控制檔案Oracle
- oracle 還原 .dmp 格式備份檔案Oracle
- oracle uncatalog資料庫備份檔案Oracle資料庫
- Laravel 資料庫及專案檔案自動備份指北 (spatie/Laravel-backup)Laravel資料庫
- Oracle RAC修改引數檔案位置Oracle
- sql檔案備份SQL
- Oracle使用備份檔案集恢復歸檔日誌Oracle
- 【備份】RMAN中對控制檔案的幾種備份方法
- Networker備份windows檔案Windows
- Oracle RAC 環境 引數檔案的啟動順序Oracle
- Java實現定時備份檔案教程Java
- Linux基楚操作指引【檔案改名、檔案備份、檔案刪除】Linux
- Mysql匯出檔案及備份操作筆記MySql筆記
- ORACLE 控制檔案(Control Files)概述Oracle
- Oracle為什麼使用備份的控制檔案恢復後一定要resetlogsOracle
- 使用CukeTest建立指令碼自動化備份檔案到網盤指令碼
- win10如何備份桌面檔案 win10怎樣備份桌面檔案Win10
- ManagerDB 備份檔案管理與異地備份
- 如何備份及恢復Linux檔案許可權Linux
- Oracle資料檔案和臨時檔案的管理Oracle
- Dedecms備份的資料檔案位置及備份資料庫的方法資料庫
- 容災備份 | 看我使用Powershell操作FTP進行資料檔案自動上傳備份FTP
- Linux作業系統定時備份檔案方法Linux作業系統
- win10系統如何設定自動備份資料檔案Win10
- python保留7天備份檔案Python
- MongoDB啟動檔案配置引數詳解MongoDB
- win10系統如何備份檔案 win10系統備份檔案在哪裡Win10
- Oracle 無備份情況下undo檔案損壞處理Oracle
- 檔案的基本管理和XFS檔案系統備份恢復
- input檔案選擇框檔案過濾引數accept
- 多檔案自動收集,1秒收集1000份!