oracle 控制檔案及引數檔案何時自動備份

不一樣的天空w發表於2022-08-04

結論:

  1. 當 CONFIGURE CONTROLFILE AUTOBACKUP OFF;時,僅備份1號資料檔案(system)和全備資料庫時,會自動備份控制檔案和引數檔案。 而當控制檔案自動備份關閉時,備份指令碼包含備份控制檔案及歸檔,資料庫備份順序是備份資料庫->自動備份控制檔案和引數檔案->備份控制檔案(備份指令碼指定的)->備份歸檔 而當控制檔案自動備份關閉時,備份指令碼僅包含備份全庫及備份歸檔(不包含備份控制檔案時),資料庫備份順序是備份資料庫->自動備份控制檔案和引數檔案->備份歸檔。

  2. 當 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/,如需轉載,請註明出處,否則將追究法律責任。

相關文章