About the ARCHIVELOGDELETION parameter of RMAN

Source: Internet
Author: User
RMAN is an official backup restoration tool launched by Oracle. With the development of several major versions, RMAN has supported a variety of backup media and recovery strategies, and is also widely recognized by the industry.

RMAN is an official backup restoration tool launched by Oracle. With the development of several major versions, RMAN has supported a variety of backup media and recovery strategies, and is also widely recognized by the industry.

RMAN is an official backup restoration tool launched by Oracle. With the development of several major versions, RMAN has supported a variety of backup media and recovery strategies. It is also widely recognized as the official Oracle backup recovery policy.

Archivelog is an important component of the Oracle backup and restoration policy. Incomplete backup + continuous archiving logs allow us to restore the database to a fault point and achieve data restoration without loss. However, in real life, archive logs also bring many problems to inexperienced O & M personnel, such as the failure of Hang due to the full archiving space and the excessive generation of archived logs in an instant. Some predecessors are constantly stressing that the archive mode is not good ".

You can set a special Delete Policy (Deletion) for archive logs in RMAN parameters ). In practice, archived logs that have been backed up or secure transmission can be deleted, especially in the limited Fast Recovery Area management mode. For policies that automatically delete archive logs, it is common to use applied to standby and shipped to standby, that is, Data Guard.

This article introduces the use of the simple backed up parameter, and studies the operational behavior characteristics of Oracle and RMAN affected by this parameter through a series of experiments.

1. Basic parameters and experiment environment

I used Oracle 11gR2 for testing. The specific version number is 11.2.0.4.

SQL> select * from v $ version;

BANNER

--------------------------------------------------------------------------------

Oracle Database 11g Enterprise Edition Release 11.2.0.3.0-64bit Production

PL/SQL Release 11.2.0.3.0-Production

CORE 11.2.0.3.0 Production

TNS for Linux: Version 11.2.0.3.0-Production

NLSRTL Version 11.2.0.3.0-Production

By default, the archivelog deletion policy parameter is NONE.

RMAN> show all;

RMAN configuration parameters for database with db_unique_name XXXXDB are:

Configure retention policy to redundancy 1; # default

(Space reasons, omitted ......)

Configure archivelog deletion policy to none; # default

Common Values of this parameter are as follows:

Configure archivelog deletion policy to backed up 2 times to sbt;

Configure archivelog deletion policy to backed up 1 times to device type disk;

Configure archivelog deletion policy to applied on standby; -- dedicated for DG

Configure archivelog deletion policy to shipped on standby; -- dedicated for DG

Configure archivelog deletion policy clear;

The best tool view for studying archivelog behavior is v $ archived_log. Many DBAs prefer to delete archive logs from the operating system level, but this method is not directly recognized by the Oracle control file. Therefore, we recommend using RMAN or an official tool.

-- Archived undeleted logs

SQL> select count (*) from v $ archived_log where archived = 'yes' and deleted = 'no ';

COUNT (*)

----------

13

2. First backup test experiment

First, modify the archivelog deletion policy parameter to "delete after two backups ".

RMAN> configure archivelog deletion policy to backed up 2 times to device type disk;

New RMAN configuration parameters:

Configure archivelog deletion policy to backed up 2 times to disk;

New RMAN configuration parameters are successfully stored

Manually back up databases and archive logs without deleting them.

RMAN> backup database plus archivelog;

Starting backup at 21-SEP-15

Current log archived

Allocated channel: ORA_DISK_1

Channel ORA_DISK_1: SID = 16 device type = DISK

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 = 100 RECID = 12 STAMP = 890690423

Input archived log thread = 1 sequence = 101 RECID = 13 STAMP = 890712061

Input archived log thread = 1 sequence = 102 RECID = 14 STAMP = 890727732

Input archived log thread = 1 sequence = 103 RECID = 15 STAMP = 890776815

Input archived log thread = 1 sequence = 104 RECID = 16 STAMP = 890776833

Input archived log thread = 1 sequence = 105 RECID = 17 STAMP = 890805616

Input archived log thread = 1 sequence = 106 RECID = 18 STAMP = 890814181

Input archived log thread = 1 sequence = 107 RECID = 19 STAMP = 890820201

Input archived log thread = 1 sequence = 108 RECID = 20 STAMP = 890859629

Input archived log thread = 1 sequence = 109 RECID = 21 STAMP = 890892046

Input archived log thread = 1 sequence = 110 RECID = 22 STAMP = 890900632

Input archived log thread = 1 sequence = 111 RECID = 23 STAMP = 890906655

Input archived log thread = 1 sequence = 112 RECID = 24 STAMP = 890942416

Input archived log thread = 1 sequence = 113 RECID = 25 STAMP = 890990204

Channel ORA_DISK_1: starting piece 1 at 21-SEP-15

Channel ORA_DISK_1: finished piece 1 at 21-SEP-15

Piece handle =/u01/app/oracle/fast_recovery_area/XXXXDB/backupset/2015_09_21/tags _. bkp tag = TAG20150921T091644

(Space reason, omitted part ......)

Finished Control File and SPFILE Autobackup at 21-SEP-15

Archive logs are backed up and not deleted.

-- Two of them are displayed because the switch log is automatically generated during Backup.

SQL> select count (*) from v $ archived_log where archived = 'yes' and deleted = 'no ';

COUNT (*)

----------

15

Next we will conduct the second experiment.

RMAN> backup database plus archivelog;

Starting backup at 21-SEP-15

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 = 100 RECID = 12 STAMP = 890690423

Input archived log thread = 1 sequence = 101 RECID = 13 STAMP = 890712061

Input archived log thread = 1 sequence = 102 RECID = 14 STAMP = 890727732

Input archived log thread = 1 sequence = 103 RECID = 15 STAMP = 890776815

Input archived log thread = 1 sequence = 104 RECID = 16 STAMP = 890776833

Input archived log thread = 1 sequence = 105 RECID = 17 STAMP = 890805616

Input archived log thread = 1 sequence = 106 RECID = 18 STAMP = 890814181

Input archived log thread = 1 sequence = 107 RECID = 19 STAMP = 890820201

Input archived log thread = 1 sequence = 108 RECID = 20 STAMP = 890859629

Input archived log thread = 1 sequence = 109 RECID = 21 STAMP = 890892046

Input archived log thread = 1 sequence = 110 RECID = 22 STAMP = 890900632

Input archived log thread = 1 sequence = 111 RECID = 23 STAMP = 890906655

Input archived log thread = 1 sequence = 112 RECID = 24 STAMP = 890942416

Input archived log thread = 1 sequence = 113 RECID = 25 STAMP = 890990204

Input archived log thread = 1 sequence = 114 RECID = 26 STAMP = 890990263

Input archived log thread = 1 sequence = 115 RECID = 27 STAMP = 890990391

Channel ORA_DISK_1: starting piece 1 at 21-SEP-15

Channel ORA_DISK_1: finished piece 1 at 21-SEP-15

Piece handle =/u01/app/oracle/fast_recovery_area/XXXXDB/backupset/2015_09_21/tags _. bkp tag = TAG20150921T091951

(Space reasons, omitted ......)

Finished Control File and SPFILE Autobackup at 21-SEP-15

For the second backup, the previously backed up logs are also displayed in the automatic backup list. However, during the second backup, logs that have already been backed up twice (deletion policy) are not automatically deleted.

SQL> select count (*) from v $ archived_log where archived = 'yes' and deleted = 'no ';

COUNT (*)

----------

17

Archiving logs are still in fast recovery area.

[Oracle @ Databaseintrawebpro fast_recovery_area] $ du-h

19 M./XXXXDB/autobackup/2015_09_21

9.4 M./XXXXDB/autobackup/2015_09_17

29 M./XXXXDB/autobackup

151 M./XXXXDB/onlinelog

6.0G./XXXXDB/backupset/2015_09_21

108 K./XXXXDB/backupset/2015_09_17

6.0G./XXXXDB/backupset

125 M./XXXXDB/archivelog/2015_09_19

27 M./XXXXDB/archivelog/2015_09_21

4.0 K./XXXXDB/archivelog/2015_09_15

127 M./XXXXDB/archivelog/2015_09_18

121 M./XXXXDB/archivelog/2015_09_20

4.0 K./XXXXDB/archivelog/2015_09_16

32 M./XXXXDB/archivelog/2015_09_17

431 M./XXXXDB/archivelog

9.4 M./XXXXDB/controlfile

6.6G./XXXXDB

6.6G.

In this case, you can easily find the archive log and backup count in v $ archived_log.

SQL> alter system switch logfile;

System altered

SQL> select count (*) from v $ archived_log where archived = 'yes' and deleted = 'no ';

COUNT (*)

----------

18

-- Note the recid numbers that have been backed up twice.

SQL> select recid, sequence #, archived, deleted, backup_count from v $ archived_log where backup_count> 1;

Recid sequence # archived deleted BACKUP_COUNT

-----------------------------------------------

12 100 yes no 2

13 101 yes no 2

14 102 yes no 2

15 103 yes no 2

16 104 yes no 2

17 105 yes no 2

18 106 yes no 2

19 107 yes no 2

20 108 yes no 2

21 109 yes no 2

22 110 yes no 2

23 111 yes no 2

24 112 yes no 2

25 113 yes no 2

26 114 yes no 2

15 rows selected

Perform the third backup.

RMAN> backup database plus archivelog;

Starting backup at 21-SEP-15

Current log archived

Allocated channel: ORA_DISK_1

Channel ORA_DISK_1: SID = 498 device type = DISK

Skipping archived logs of thread 1 from sequence 100 to 114; already backed up

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 = 115 RECID = 27 STAMP = 890990391

Input archived log thread = 1 sequence = 116 RECID = 28 STAMP = 890990481

Input archived log thread = 1 sequence = 117 RECID = 29 STAMP = 890990667

Input archived log thread = 1 sequence = 118 RECID = 30 STAMP = 890993128

Channel ORA_DISK_1: starting piece 1 at 21-SEP-15

Channel ORA_DISK_1: finished piece 1 at 21-SEP-15

Piece

(The reason for the length is omitted .......)

Finished Control File and SPFILE Autobackup at 21-SEP-15

Note: logs that have been backed up twice are not displayed in the list of automatic RMAN backups. Here we define a Delete Policy: When the deletion conditions are met, archiving logs will not enter the backup set list.

Archive log information:

SQL> select recid, sequence #, archived, deleted, backup_count from v $ archived_log where backup_count> 1;

Recid sequence # archived deleted BACKUP_COUNT

-----------------------------------------------

12 100 YES 2

13 101 YES 2

14 102 YES 2

15 103 YES 2

16 104 YES 2

17 105 YES 2

18 106 YES 2

19 107 YES 2

20 108 YES 2

21 109 YES 2

22 110 YES 2

23 111 YES 2

24 112 YES 2

25 113 YES 2

26 114 yes no 2

27 115 yes no 2

28 116 yes no 2

17 rows selected

Note: Some archived logs are deleted, but none of the logs backed up twice last time have been deleted, for example, logs with recid = 26. In this case, the space of the backup fast recovery area has changed.

[Oracle @ Databaseintrawebpro fast_recovery_area] $ du-h

29 M./XXXXDB/autobackup/2015_09_21

4.0 K./XXXXDB/autobackup/2015_09_17

29 M./XXXXDB/autobackup

151 M./XXXXDB/onlinelog

5.5G./XXXXDB/backupset/2015_09_21

4.0 K./XXXXDB/backupset/2015_09_17

5.5G./XXXXDB/backupset

4.0 K./XXXXDB/archivelog/2015_09_19

2.5 M./XXXXDB/archivelog/2015_09_21

4.0 K./XXXXDB/archivelog/2015_09_15

4.0 K./XXXXDB/archivelog/2015_09_18

4.0 K./XXXXDB/archivelog/2015_09_20

4.0 K./XXXXDB/archivelog/2015_09_16

4.0 K./XXXXDB/archivelog/2015_09_17

2.6 M./XXXXDB/archivelog

9.4 M./XXXXDB/controlfile

5.7G./XXXXDB

5.7G.

In the alert log, we can see the Oracle automatic deletion action.

Mon Sep 21 09:24:27 2015

Expanded controlfile section 11 from 28 to 56 records

Requested to grow by 28 records; added 1 blocks of records

Archived Log entry 29 added for thread 1 sequence 117 ID 0x774e158c dest 1:

Mon Sep 21 10:05:28 2015

ALTER SYSTEM ARCHIVE LOG

Mon Sep 21 10:05:28 2015

Thread 1 advanced to log sequence 119 (LGWR switch)

Current log #2 seq #119 mem #0:/u01/app/oracle/oradata/XXXXDB/onlinelog/o1_mf_2_bxzzjj5w _. log

Current log #2 seq #119 mem #1:/u01/app/oracle/fast_recovery_area/XXXXDB/onlinelog/o1_mf_2_bxzzjj80 _. log

Archived Log entry 30 added for thread 1 sequence 118 ID 0x774e158c dest 1:

Mon Sep 21 10:05:47 2015

Deleted Oracle managed file/u01/app/oracle/fast_recovery_area/XXXXDB/backupset/2015_09_17/o1_mf_annnn_TAG20150917T195557_bzoblfck _. bkp

Deleted Oracle managed file/u01/app/oracle/fast_recovery_area/XXXXDB/archivelog/2015_09_17/o1_mf_0000100_bzokvqj0 _. arc

Deleted Oracle managed file/u01/app/oracle/fast_recovery_area/XXXXDB/autobackup/2015_09_17/o1_mf_s_890682958_bzoblglw _. bkp

Deleted Oracle managed file/u01/app/oracle/fast_recovery_area/XXXXDB/archivelog/2015_09_18/o1_mf_1_101_bzp6zx31 _. arc

Deleted Oracle managed file/u01/app/oracle/fast_recovery_area/XXXXDB/archivelog/2015_09_18/o1_mf_2017102_bzpp9nln _. arc

Deleted Oracle managed file/u01/app/oracle/fast_recovery_area/XXXXDB/archivelog/2015_09_18/o1_mf_103103_bzr67h1h _. arc

Deleted Oracle managed file/u01/app/oracle/fast_recovery_area/XXXXDB/archivelog/2015_09_18/o1_mf_1_1__bzr6812s _. arc

Deleted Oracle managed file/u01/app/oracle/fast_recovery_area/XXXXDB/archivelog/2015_09_19/o1_mf_1_105_bzs2cj5y _. arc

Deleted Oracle managed file/u01/app/oracle/fast_recovery_area/XXXXDB/archivelog/2015_09_19/o1_mf_1_1__bzsbq54p _. arc

Deleted Oracle managed file/u01/app/oracle/fast_recovery_area/XXXXDB/archivelog/2015_09_19/o1_mf_1_1__bzsjm99v _. arc

Deleted Oracle managed file/u01/app/oracle/fast_recovery_area/XXXXDB/archivelog/2015_09_19/o1_mf_1_1__bztq3f2v _. arc

Deleted Oracle managed file/u01/app/oracle/fast_recovery_area/XXXXDB/archivelog/2015_09_20/o1_mf_1_1__bzvprgf1 _. arc

Deleted Oracle managed file/u01/app/oracle/fast_recovery_area/XXXXDB/archivelog/2015_09_20/o1_mf_2017110_bzvz41_7 _. arc

Deleted Oracle managed file/u01/app/oracle/fast_recovery_area/XXXXDB/archivelog/2015_09_20/o1_mf_1_111_bzw50zmb _. arc

Deleted Oracle managed file/u01/app/oracle/fast_recovery_area/XXXXDB/archivelog/2015_09_20/o1_mf_1_1__bzx7yj9g _. arc

Deleted Oracle managed file/u01/app/oracle/fast_recovery_area/XXXXDB/archivelog/2015_09_21/o1_mf_2017113_bzypmw8c _. arc

Deleted Oracle managed file/u01/app/oracle/fast_recovery_area/XXXXDB/backupset/2015_09_21/o1_mf_annnn_TAG20150921T091644_bzypmwty _. bkp

Mon Sep 21 10:05:58 2015

Deleted Oracle managed file/u01/app/oracle/fast_recovery_area/XXXXDB/backupset/2015_09_21/o1_mf_nnndf_TAG20150921T091647_bzypn055 _. bkp

Mon Sep 21 10:06:15 2015

ALTER SYSTEM ARCHIVE LOG

Mon Sep 21 10:06:15 2015

Thread 1 advanced to log sequence 120 (LGWR switch)

Current log #3 seq #120 mem #0:/u01/app/oracle/oradata/XXXXDB/onlinelog/o1_mf_3_bxzzjl0z _. log

Current log #3 seq #120 mem #1:/u01/app/oracle/fast_recovery_area/XXXXDB/onlinelog/o1_mf_3_bxzzjl35 _. log

Archived Log entry 31 added for thread 1 sequence 119 ID 0x774e158c dest 1:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.