what to do if your FRA get full in oracle

Deleting Archive Log files in a Data Guard environment

Published on: Category: Oracle

We recently configured an Oracle 12.2 database environment with a primary database, and a concrete standby database managed past Oracle Data Guard.

The fill-in on the main database removed all archive log files later on a successful backup. For a normal standalone database this is a common configuration, only in a Information Guard environment this is not sufficient.

What volition happen if your standby database is unavailable? Before you delete any files on the master database, you should be sure y'all no longer need them for the recovery of the standby database.

Initial configuration

When you utilize the Data Guard Broker for the configuration of your standby database, it will create a remote archive destination on the main, connecting to a service on the standby database:

            
  1. SQL> Prove parameter log_archive_dest_2

  2. Proper name TYPE VALUE

  3. ------------------------------------ ----------- ------------------------------

  4. log_archive_dest_2 string service= "motdc1" , ASYNC NOAFFI

  5. RM delay= 0 optional compressio

  6. northward=disable max_failure= 0 max_co

  7. nnections= 1 reopen= 300 db_uniq

  8. ue_name= "motdc1" net_timeout= iii

  9. 0 , valid_for= (online_logfile,a

  10. ll_roles)

We scheduled backups on both the primary and the standby database. Part of the RMAN backup script was the cleanup of all archive log files subsequently a twenty-four hour period, if there was a successful fill-in:

            
  1. backup as compressed backupset archivelog all not backed up;

  2. delete noprompt archivelog until time 'sysdate - ane' backed up 1 times to device blazon deejay;

When to remove archive log files?

Our backup script was not really bulletproof. Although we kept our archive log files for at least a 24-hour interval, this is non really what nosotros wanted. The files should merely exist removed later on we are sure all transaction had been successfully applied to the standby database.

When querying the five$archived_log view for log_archive_dest_2 we can check what files are applied on the standby:

            
  1. select dest_id , sequence# , practical

  2. from v$archived_log

  3. where dest_id = 2

  4. and sequence# > ( select max(sequence#) - ten from v$archived_log )

  5. order by sequence#

  6. /

  7. DEST_ID SEQUENCE# APPLIED

  8. ---------- ---------- ---------

  9. 2 1912 Aye

  10. 2 1913 Yeah

  11. 2 1914 YES

  12. 2 1915 Yep

  13. 2 1916 Aye

  14. 2 1917 YES

  15. two 1918 Aye

  16. two 1919 YES

  17. 2 1920 Yes

  18. 2 1921 NO

  19. 10 rows selected.

Why not let Oracle handle information technology?

Rather than irresolute the backup script it might be easier to allow the database handle it. All files in the FRA could be managed by the database.

The documentation describes how we can configure automatic cleanup policy of the archive log files afterwards they are applied on the standby database. We changed this setting in the RMAN backup configuration, and also removed the delete argument from the fill-in script.

Testing

After changing the RMAN configuration...

            
  1. RMAN> CONFIGURE ARCHIVELOG DELETION POLICY TO Applied ON ALL STANDBY ;

  2. old RMAN configuration parameters:

  3. CONFIGURE ARCHIVELOG DELETION POLICY TO NONE;

  4. new RMAN configuration parameters:

  5. CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON ALL STANDBY;

  6. new RMAN configuration parameters are successfully stored

  7. starting full resync of recovery itemize

  8. full resync complete

  9. RMAN>

...and doing some log switches...

            
  1. SQL> Modify system switch logfile ;

  2. System altered.

  3. SQL> ALTER system switch logfile ;

  4. System altered.

  5. SQL> Alter organisation switch logfile ;

  6. System altered.

...we made another annal backup:

            
  1. RMAN> fill-in as compressed backupset archivelog all not backed upward;

I starting time expected that the annal log files would have been removed at the moment of the backup, only this was not the example. The files were still in the FRA.

Maybe the files were non applied to the standby database? I checked the v$archived_log view once again, merely all the files - except the electric current - had been practical to the standby.

            
  1. SQL> SELECT dest_id , SEQUENCE# , applied

  2. FROM v$archived_log

  3. WHERE dest_id = two

  4. AND SEQUENCE# > ( SELECT MAX ( SEQUENCE#) - 10 FROM v$archived_log )

  5. Lodge BY SEQUENCE#

  6. /

  7. 2 3 iv 5 6

  8. DEST_ID SEQUENCE# Applied

  9. ---------- ---------- ---------

  10. two 1930 YES

  11. two 1931 YES

  12. ii 1932 Yeah

  13. two 1933 YES

  14. 2 1934 YES

  15. 2 1935 YES

  16. ii 1936 YES

  17. 2 1937 Yep

  18. 2 1938 Aye

  19. 2 1939 NO

  20. 10 ROWS selected.

This was not really doing what I expected, and so dorsum to the documentation: "For main databases, the archived redo log files are eligible for deletion later on they are applied on the standby."  So, the files are non deleted immediately, but they are eligible for deletion.

You can check this in the Five$RECOVERY_AREA_USAGE view. We can see that some infinite for "Archived Log" is reclaimable, so eligible for deletion:

            
  1. SQL> SELECT FILE_TYPE , PERCENT_SPACE_USED , PERCENT_SPACE_RECLAIMABLE , NUMBER_OF_FILES

  2. 2 FROM Five$RECOVERY_AREA_USAGE

  3. iii /

  4. FILE_TYPE PERCENT_SPACE_USED PERCENT_SPACE_RECLAIMABLE NUMBER_OF_FILES

  5. ----------------------- ------------------ ------------------------- ---------------

  6. Command FILE 0 0 0

  7. REDO LOG 0 0 0

  8. ARCHIVED LOG .43 .43 13

  9. BACKUP Piece 0 0 0

  10. IMAGE Re-create 0 0 0

  11. FLASHBACK LOG 65.63 0 6

  12. FOREIGN ARCHIVED LOG 0 0 0

  13. AUXILIARY DATAFILE COPY 0 0 0

  14. 8 ROWS selected.

Subsequently more load on the database the FRA fills upwards to 85%, and this triggers a warning in the alert log:

            
  1. 2017 - xi -06T17: 36 : 12.303898 +01:00

  2. Errors in file /oraclebase/db/diag/rdbms/motdc2/motdc2/trace/motdc2_m000_24332. trc :

  3. ORA- 19815 : Alarm: db_recovery_file_dest_size of 17179869184 bytes is 87.50 % used, and has 2147470336 remaining bytes bachelor.

  4. 2017 - 11 -06T17: 36 : 12.308765 +01:00

  5. ************************************************************************

  6. You lot accept following choices to complimentary upwards space from recovery area:

  7. 1 . Consider irresolute RMAN Retentivity POLICY. If you are using Data Baby-sit,

  8. then consider changing RMAN ARCHIVELOG DELETION POLICY.

  9. two . Dorsum up files to third device such as record using RMAN

  10. BACKUP RECOVERY Surface area control.

  11. 3 . Add disk infinite and increase db_recovery_file_dest_size parameter to

  12. reflect the new space.

  13. 4 . Delete unnecessary files using RMAN DELETE command. If an operating

  14. system control was used to delete files, then utilize RMAN CROSSCHECK and

  15. DELETE EXPIRED commands.

  16. ************************************************************************

This warning gives some suggestions on how to fix this effect. The first one is a bit strange. If we use Data Guard, we should consider changing the RMAN ARCHIVELOG DELETION POLICY. I think this is what we merely did...

A footling after the backup triggers another log switch, and we meet more than messages in the warning log. The database removes the oldest annal log files:

            
  1. Deleted Oracle managed file /orafra/db/MOTDC2/archivelog/ 2017_11_06/o1_mf_1_1927_f00bl4x2_. arc

  2. Deleted Oracle managed file /orafra/db/MOTDC2/archivelog/ 2017_11_06/o1_mf_1_1928_f00cynk7_. arc

  3. Deleted Oracle managed file /orafra/db/MOTDC2/archivelog/ 2017_11_06/o1_mf_1_1929_f00hh2z4_. arc

  4. Deleted Oracle managed file /orafra/db/MOTDC2/archivelog/ 2017_11_06/o1_mf_1_1930_f00lzlvm_. arc

  5. Deleted Oracle managed file /orafra/db/MOTDC2/archivelog/ 2017_11_06/o1_mf_1_1931_f00pj2n2_. arc

  6. Deleted Oracle managed file /orafra/db/MOTDC2/archivelog/ 2017_11_06/o1_mf_1_1932_f00t0ltc_. arc

  7. Deleted Oracle managed file /orafra/db/MOTDC2/archivelog/ 2017_11_06/o1_mf_1_1933_f00xk2p8_. arc

  8. Deleted Oracle managed file /orafra/db/MOTDC2/archivelog/ 2017_11_06/o1_mf_1_1934_f0111ltx_. arc

So, the automatic cleanup works, merely simply after infinite pressure in the FRA removes the files marked as eligible for deletion, every bit explained in the documentation. And the definition of space pressure seems to be an 85% usage of the FRA, which might trigger an ORA-19815 alarm.

Back to transmission cleanup?

Although the solution in a higher place does what it should do, I'm not really happy with this. The files are not actually removed after being applied on the standby as the configuration suggests, and more serious; the ORA-19815 warning could trigger a daily monitoring alarm on a perfectly working database.

A good solution seems to be the configuration of the delete policy in RMAN, in combination with a daily "delete noprompt archivelog all" in the backup script.

For testing nosotros starting time configure the policy:

            
  1. CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON ALL STANDBY;

Then, in the data guard manager, we stop the utilise on the standby database:

            
  1. DGMGRL> edit database motdc1 set state= 'employ-off' ;

  2. Succeeded.

After that, we make some log switches:

            
  1. SQL> Alter organization switch logfile ;

  2. System altered.

  3. SQL> Change organization switch logfile ;

  4. Organization altered.

  5. SQL> ALTER system switch logfile ;

  6. System altered.

We can bank check that the new archives are not applied on the standby database:

            
  1. SQL> SELECT dest_id , SEQUENCE# , applied

  2. FROM 5$archived_log

  3. WHERE dest_id = 2

  4. AND SEQUENCE# > ( SELECT MAX ( SEQUENCE#) - 10 FROM v$archived_log )

  5. Order By SEQUENCE#

  6. /

  7. DEST_ID SEQUENCE# APPLIED

  8. ---------- ---------- ---------

  9. 2 1940 YES

  10. 2 1941 YES

  11. ii 1942 Yeah

  12. ii 1943 Aye

  13. 2 1944 Yeah

  14. ii 1945 Yeah

  15. two 1946 YES

  16. two 1947 NO

  17. 2 1948 NO

  18. two 1949 NO

  19. 10 ROWS selected.

Adjacent, we make a fill-in in RMAN:

            
  1. RMAN> fill-in every bit compressed backupset archivelog all not backed up;

  2. Starting backup at 06-November- 17

  3. current log archived

  4. using channel ORA_DISK_1

  5. using channel ORA_DISK_2

  6. using aqueduct ORA_DISK_3

  7. using channel ORA_DISK_4

  8. skipping archived logs of thread i from sequence 1945 to 1946 ; already backed upward

  9. aqueduct ORA_DISK_1: starting compressed archived log backup prepare

  10. aqueduct ORA_DISK_1: specifying archived log(s) in backup set

  11. input archived log thread= 1 sequence= 1947 RECID= 4426 Postage stamp= 959363627

  12. channel ORA_DISK_1: starting piece 1 at 06-NOV- 17

  13. aqueduct ORA_DISK_2: starting compressed archived log backup prepare

  14. channel ORA_DISK_2: specifying archived log(s) in backup set

  15. input archived log thread= 1 sequence= 1950 RECID= 4432 Postage= 959363700

  16. channel ORA_DISK_2: starting piece 1 at 06-NOV- 17

  17. aqueduct ORA_DISK_3: starting compressed archived log backup ready

  18. channel ORA_DISK_3: specifying archived log(s) in backup prepare

  19. input archived log thread= 1 sequence= 1948 RECID= 4428 STAMP= 959363642

  20. channel ORA_DISK_3: starting piece 1 at 06-NOV- 17

  21. channel ORA_DISK_4: starting compressed archived log backup set

  22. channel ORA_DISK_4: specifying archived log(s) in backup set up

  23. input archived log thread= 1 sequence= 1949 RECID= 4430 STAMP= 959363644

  24. channel ORA_DISK_4: starting piece 1 at 06-NOV- 17

  25. channel ORA_DISK_2: finished piece 1 at 06-NOV- 17

  26. piece handle=/orarman/db/MOTDC2/gnsitejl_1_1. bck tag=TAG20171106T175500 comment=NONE

  27. channel ORA_DISK_2: backup gear up complete, elapsed fourth dimension: 00:00:00

  28. aqueduct ORA_DISK_1: finished piece 1 at 06-November- 17

  29. piece handle=/orarman/db/MOTDC2/gmsitejl_1_1. bck tag=TAG20171106T175500 comment=NONE

  30. channel ORA_DISK_1: fill-in set consummate, elapsed time: 00:00:00

  31. channel ORA_DISK_3: finished slice 1 at 06-NOV- 17

  32. piece handle=/orarman/db/MOTDC2/gositejl_1_1. bck tag=TAG20171106T175500 annotate=NONE

  33. channel ORA_DISK_3: backup gear up complete, elapsed time: 00:00:00

  34. channel ORA_DISK_4: finished piece 1 at 06-November- 17

  35. slice handle=/orarman/db/MOTDC2/gpsitejl_1_1. bck tag=TAG20171106T175500 comment=NONE

  36. channel ORA_DISK_4: fill-in ready complete, elapsed time: 00:00:00

  37. Finished fill-in at 06-Nov- 17

  38. Starting Control File and SPFILE Autobackup at 06-November- 17

  39. slice handle=/orarman/db/MOTDC2/c- 390140924 - 20171106 - 10 annotate=NONE

  40. Finished Control File and SPFILE Autobackup at 06-NOV- 17

  41. RMAN>

And, as role of the backup procedure, nosotros try to delete the archivelog files:

            
  1. RMAN> delete noprompt archivelog all backed up ane times to device type disk;

  2. released channel: ORA_DISK_1

  3. released aqueduct: ORA_DISK_2

  4. released channel: ORA_DISK_3

  5. released channel: ORA_DISK_4

  6. allocated channel: ORA_DISK_1

  7. channel ORA_DISK_1: SID= 2822 device type=DISK

  8. allocated channel: ORA_DISK_2

  9. channel ORA_DISK_2: SID= 4234 device type=Disk

  10. allocated aqueduct: ORA_DISK_3

  11. channel ORA_DISK_3: SID= 4467 device type=Deejay

  12. allocated channel: ORA_DISK_4

  13. channel ORA_DISK_4: SID= 4705 device type=DISK

  14. RMAN-08120: warning: archived log not deleted, non yet practical past standby

  15. archived log file name=/orafra/db/MOTDC2/archivelog/ 2017_11_06/o1_mf_1_1946_f014trpk_. arc thread= i sequence= 1946

  16. RMAN-08120: warning: archived log not deleted, not still applied past standby

  17. archived log file name=/orafra/db/MOTDC2/archivelog/ 2017_11_06/o1_mf_1_1947_f014wv4x_. arc thread= 1 sequence= 1947

  18. RMAN-08120: alert: archived log not deleted, not yet applied by standby

  19. archived log file name=/orafra/db/MOTDC2/archivelog/ 2017_11_06/o1_mf_1_1948_f014xblo_. arc thread= 1 sequence= 1948

  20. RMAN-08120: alarm: archived log not deleted, not nonetheless applied past standby

  21. archived log file name=/orafra/db/MOTDC2/archivelog/ 2017_11_06/o1_mf_1_1949_f014xdo5_. arc thread= ane sequence= 1949

  22. RMAN-08120: warning: archived log not deleted, non yet applied by standby

  23. archived log file name=/orafra/db/MOTDC2/archivelog/ 2017_11_06/o1_mf_1_1950_f014z3z6_. arc thread= ane sequence= 1950

  24. List of Archived Log Copies for database with db_unique_name MOTDC2

  25. =====================================================================

  26. Key Thrd Seq S Low Time

  27. ------- ---- ------- - ---------

  28. 1300755 one 1945 A 06-Nov- 17

  29. Proper noun: /orafra/db/MOTDC2/archivelog/ 2017_11_06/o1_mf_1_1945_f014l36l_. arc

  30. deleted archived log

  31. archived log file proper name=/orafra/db/MOTDC2/archivelog/ 2017_11_06/o1_mf_1_1945_f014l36l_. arc RECID= 4422 STAMP= 959363283

  32. Deleted ane objects

The files are still protected against a delete. As we can see the statement triggers a RMAN-08120 warning, because the transactions are not yet applied on the standby.

When restoring the redo apply on the standby, the delete from RMAN is besides working again.

Other Setups

In this example we used a Maximum Performance protection manner in Data Guard. Our goal was to apply all transactions on the standby equally soon as possible, simply with a minimal affect on the principal database.

Data Baby-sit tin also be used in various other configurations. You tin configure an "apply filibuster", which tin protect y'all for user errors on the standby database. Another configuration is the Snapshot Standby database, where you temporarily end the redo apply on the standby, and open the database for testing purposes.

In both these cases your policy could bank check if the transactions are shipped to, but not applied on the standby database:

            
  1. RMAN> CONFIGURE ARCHIVELOG DELETION POLICY TO SHIPPED TO ALL STANDBY ;

Conclusion

The "CONFIGURE ARCHIVELOG DELETION POLICY TO Practical ON ALL STANDBY;" setting in RMAN is a good protection for the archive log files in a Data Guard environment where the standby is used for disaster recovery. It protects the files from being deleted before all the transactions are applied on the standby.

This setting too configures an automatic cleanup of the archive log files from the FRA. Simply files might only be removed later on a confusing ORA-19815 warning.

A better solution is non to wait for the automated cleanup, but to delete the files equally part of the backup procedure.

If, for some reason, the transactions are not applied on the standby, the delete command triggers a RMAN-08120 alarm, and the archived log files are non deleted. And if the FRA is filling upwardly with a ORA-19815 warning, the automated cleanup volition still remove all files that are eligible for deletion.

Documentation: https://docs.oracle.com/database/122/RCMRF/CONFIGURE.htm#GUID-B5094E73-C26C-4FED-AE39-8C2E9540050A__CHDIFEEE

Bastiaan Bak

DBA with over fifteen years of experience. Feel in various branches, with several modules. Including: Oracle database, Oracle RAC, Oracle EBS and PL/SQL.

More than posts by Bastiaan Bak

harrisdires2002.blogspot.com

Source: https://www.qualogy.com/techblog/oracle/deleting-archive-log-files-in-a-data-guard-environment

0 Response to "what to do if your FRA get full in oracle"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel