{"id":3204,"date":"2021-03-27T08:27:55","date_gmt":"2021-03-27T08:27:55","guid":{"rendered":"https:\/\/swiv.com.br\/configuring-archived-redo-log-deletion-policy\/"},"modified":"2026-05-27T20:02:49","modified_gmt":"2026-05-27T19:02:49","slug":"configuring-archived-redo-log-deletion-policy","status":"publish","type":"post","link":"https:\/\/swiv.com.br\/index.php\/2021\/03\/27\/configuring-archived-redo-log-deletion-policy\/","title":{"rendered":"Configuring Archived Redo Log Deletion Policy"},"content":{"rendered":"\n<p>O RMAN possui um par\u00e2metro persistente respons\u00e1vel pela regra de remo\u00e7\u00e3o dos archived redo logs, que por padr\u00e3o est\u00e1 definido como NONE (ou seja, voc\u00ea consegue deletar um archived redo log sem realizar um backup dele, o que n\u00e3o \u00e9 sugerido):<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \\&quot;wp-block-syntaxhighlighter-code\\&quot;\"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&#x5B;oracle@oel8 ~]$ rman target \/\n \nRecovery Manager: Release 18.0.0.0.0 - Production on Sat Mar 27 05:13:17 2021\nVersion 18.13.0.0.0\n \nCopyright (c) 1982, 2018, Oracle and\/or its affiliates.  All rights reserved.\n \nconnected to target database: RMANDB (DBID=3825250984)\n \nRMAN&gt; SHOW ARCHIVELOG DELETION POLICY;\n \nusing target database control file instead of recovery catalog\nRMAN configuration parameters for database with db_unique_name RMANDB are:\nCONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default\n<\/pre><\/div>\n\n\n<p>Deste modo, toda vez que realizar as opera\u00e7\u00f5es &#8220;BACKUP &#8230; DELETE INPUT&#8221;, &#8220;DELETE ARCHIVELOG&#8221; e &#8220;DELETE OBSOLETE&#8221;, os archives ser\u00e3o removidos sem ainda possu\u00edrem um backup realizado. Fazendo uma demonstra\u00e7\u00e3o desse comportamento:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \\&quot;wp-block-syntaxhighlighter-code\\&quot;\"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nRMAN&gt; LIST BACKUP OF ARCHIVELOG ALL;\n \nspecification does not match any backup in the repository\n \nRMAN&gt; LIST COPY OF ARCHIVELOG ALL;\n \nspecification does not match any archived log in the repository\n \nRMAN&gt; RMAN&gt; ALTER SYSTEM SWITCH LOGFILE;\n \nStatement processed\n \nRMAN&gt; DELETE ARCHIVELOG ALL;\n \nreleased channel: ORA_DISK_1\nallocated channel: ORA_DISK_1\nchannel ORA_DISK_1: SID=60 device type=DISK\nList of Archived Log Copies for database with db_unique_name RMANDB\n=====================================================================\n \nKey     Thrd Seq     S Low Time\n------- ---- ------- - -------------------\n71      1    64      A 2021-03-26:04:53:29\n        Name: \/oracle\/archives\/1_64_1036964654.dbf\n \n \nDo you really want to delete the above objects (enter YES or NO)? Y\ndeleted archived log\narchived log file name=\/oracle\/archives\/1_64_1036964654.dbf RECID=71 STAMP=1068268611\nDeleted 1 objects\n<\/pre><\/div>\n\n\n<p>Alterando o par\u00e2metro para que permita o delete caso o arquivo tenha sofrido backup ao menos uma vez:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \\&quot;wp-block-syntaxhighlighter-code\\&quot;\"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nRMAN&gt; CONFIGURE ARCHIVELOG DELETION POLICY TO BACKED UP 1 TIMES TO DISK;\n \nnew RMAN configuration parameters:\nCONFIGURE ARCHIVELOG DELETION POLICY TO BACKED UP 1 TIMES TO DISK;\nnew RMAN configuration parameters are successfully stored\n<\/pre><\/div>\n\n\n<p>O erro \\&#8221;RMAN-08138\\&#8221; \u00e9 reportado justamente pelo comportamento esperado:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \\&quot;wp-block-syntaxhighlighter-code\\&quot;\"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nRMAN&gt; ALTER SYSTEM SWITCH LOGFILE;\n \nStatement processed\n \nRMAN&gt; DELETE ARCHIVELOG ALL;\n \nreleased channel: ORA_DISK_1\nallocated channel: ORA_DISK_1\nchannel ORA_DISK_1: SID=60 device type=DISK\nRMAN-08138: warning: archived log not deleted - must create more backups\narchived log file name=\/oracle\/archives\/1_65_1036964654.dbf thread=1 sequence=65\n<\/pre><\/div>\n\n\n<p>S\u00f3 ap\u00f3s realizar o backup, que o RMAN consegue deletar os archivelogs:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \\&quot;wp-block-syntaxhighlighter-code\\&quot;\"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nRMAN&gt; BACKUP ARCHIVELOG ALL;\n \nStarting backup at 2021-03-27:05:26:16\ncurrent log archived\nusing channel ORA_DISK_1\nchannel ORA_DISK_1: starting archived log backup set\nchannel ORA_DISK_1: specifying archived log(s) in backup set\ninput archived log thread=1 sequence=65 RECID=72 STAMP=1068269072\ninput archived log thread=1 sequence=66 RECID=73 STAMP=1068269176\nchannel ORA_DISK_1: starting piece 1 at 2021-03-27:05:26:16\nchannel ORA_DISK_1: finished piece 1 at 2021-03-27:05:26:17\npiece handle=\/oracle\/fra\/RMANDB\/backupset\/2021_03_27\/o1_mf_annnn_TAG20210327T052616_j5xv190o_.bkp tag=TAG20210327T052616 comment=NONE\nchannel ORA_DISK_1: backup set complete, elapsed time: 00:00:01\nFinished backup at 2021-03-27:05:26:17\n \nStarting Control File and SPFILE Autobackup at 2021-03-27:05:26:18\npiece handle=\/oracle\/fra\/RMANDB\/autobackup\/2021_03_27\/o1_mf_s_1068269178_j5xv1bpv_.bkp comment=NONE\nFinished Control File and SPFILE Autobackup at 2021-03-27:05:26:21\n \nRMAN&gt; DELETE ARCHIVELOG ALL;\n \nreleased channel: ORA_DISK_1\nallocated channel: ORA_DISK_1\nchannel ORA_DISK_1: SID=60 device type=DISK\nList of Archived Log Copies for database with db_unique_name RMANDB\n=====================================================================\n \nKey     Thrd Seq     S Low Time\n------- ---- ------- - -------------------\n72      1    65      A 2021-03-27:05:16:50\n        Name: \/oracle\/archives\/1_65_1036964654.dbf\n \n73      1    66      A 2021-03-27:05:24:31\n        Name: \/oracle\/archives\/1_66_1036964654.dbf\n \n \nDo you really want to delete the above objects (enter YES or NO)? Y\ndeleted archived log\narchived log file name=\/oracle\/archives\/1_65_1036964654.dbf RECID=72 STAMP=1068269072\ndeleted archived log\narchived log file name=\/oracle\/archives\/1_66_1036964654.dbf RECID=73 STAMP=1068269176\nDeleted 2 objects\n<\/pre><\/div>\n\n\n<p>Obs: Este procedimento foi criado pelo senhor Ahmed Baraka (www.ahmedbaraka.com) e foi apenas reproduzido por mim em um laborat\u00f3rio pessoal para fins de aprendizado.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>O RMAN possui um par\u00e2metro persistente respons\u00e1vel pela regra de remo\u00e7\u00e3o dos archived redo logs, que por padr\u00e3o est\u00e1 definido como NONE (ou seja, voc\u00ea consegue deletar um archived redo log sem realizar um backup dele, o que n\u00e3o \u00e9 sugerido): Deste modo, toda vez que realizar as opera\u00e7\u00f5es &#8220;BACKUP &#8230; DELETE INPUT&#8221;, &#8220;DELETE ARCHIVELOG&#8221; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-3204","post","type-post","status-publish","format-standard","hentry","category-backup-recovery"],"_links":{"self":[{"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/posts\/3204","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/comments?post=3204"}],"version-history":[{"count":1,"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/posts\/3204\/revisions"}],"predecessor-version":[{"id":9200,"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/posts\/3204\/revisions\/9200"}],"wp:attachment":[{"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/media?parent=3204"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/categories?post=3204"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/tags?post=3204"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}