How is the space pressure managed in the Flash Recovery Area

advertisement
How is the space pressure managed in the Flash Recovery Area - An Example.
In this Document
Purpose
Scope and Application
How is the space pressure managed in the Flash Recovery Area - An Example.
How is the space pressure managed in the Flash Recovery Area - Example.
References
Applies to:
Oracle Server - Enterprise Edition - Version:
Information in this document applies to any platform.
Purpose
This article explains the handling of space pressure in Flash Recovery Area
by way of an example.
Scope and Application
Oracle DBA's
How is the space pressure managed in the Flash Recovery Area - An Example.
How is the space pressure managed in the Flash Recovery Area - Example.
This testcase has been done with the following configuration:
RMAN> show all;
using target database controlfile instead of recovery catalog
RMAN configuration parameters
are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 3;
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE
TYPE TO DISK;
CONFIGURE CONTROLFILE AUTOBACKUP OFF;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F';
# default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE SBT_TAPE TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM
1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DEVICE TYPE SBT_TAPE PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE
DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE SBT_TAPE TO 1; #
default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE
TYPE SBT_TAPE TO 1; # default
CONFIGURE CHANNEL DEVICE TYPE 'SBT_TAPE' PARMS
'SBT_LIBRARY=oracle.disksbt,ENV=(BACKUP_DIR=/tmp/)';
CONFIGURE
MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE
NAME TO '/opt/oracle/product/1010/dbs/snapcf_db10g.f'; # default
When the space used in the Flash Recovery Area goes above 85% the we will get
the following warning in the alert log:
Wed Jun 15 21:51:19 2005
Errors in file /opt/oracle/product/1010/admin/db10g/udump/db10g_ora_13900.trc:
ORA-19815: WARNING: db_recovery_file_dest_size of 1073741824 bytes is 86.07% used,
and has 149591552 remaining bytes available.
************************************************************************
You have following choices to free up space from
flash recovery area:
1. Consider changing RMAN RETENTION POLICY. If you are using Data Guard,
then consider changing
RMAN ARCHIVELOG DELETION POLICY.
2. Back up files to tertiary device such as tape using RMAN
BACKUP RECOVERY AREA command.
3. Add disk space and increase db_recovery_file_dest_size parameter to
reflect the new space.
4. Delete unnecessary
files using RMAN DELETE command. If an operating
system command was used to delete files, then use RMAN CROSSCHECK and
DELETE EXPIRED commands.
************************************************************************
When the Flash Recovery Area is completely full then we get a error message as follow:
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE
STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure
of backup command on ORA_DISK_1 channel at 06/15/2005 22:39:22
ORA-19809: limit exceeded for recovery files
ORA-19804: cannot
reclaim 52428800 bytes disk space from 1073741824 limit
To make space reclaimable we have the following options:
1) The space occupied by archivelogs created in the Flash Recovery Area
would become reclaimable in 2 circumstances:
A) If the free space becomes less then 15% in the Flash Recovery Area then all
the archivelogs in the Flash Recovery Area which are not needed for recovery
by the current backups in the FRA will become obsolete and the space occupied
will be shown in the SPACE RECLAIMABLE column of V$RECOVERY_FILE_DEST.
Output BEFORE free space less than 15%:
SQL> SELECT * FROM V$RECOVERY_FILE_DEST;
NAME
------------------------------------------------------------------------SPACE_LIMIT
SPACE_USED SPACE_RECLAIMABLE NUMBER_OF_FILES
----------- ---------- ----------------- --------------/opt/oracle/product/1010/dbs/ora_flash_area
1073741824
913181184
0
11
Output AFTER free space less then 15%:(SPACE_RECLAIMABLE column it is now not zero)
SQL> SELECT * FROM V$RECOVERY_FILE_DEST;
NAME
-------------------------------------------------------------------------------SPACE_LIMIT
SPACE_USED SPACE_RECLAIMABLE NUMBER_OF_FILES
----------- ---------- ----------------- --------------/opt/oracle/product/1010/dbs/ora_flash_area
1073741824
913181184
2124288
11
RMAN> report obsolete;
RMAN retention policy will be
applied to the command
RMAN retention policy is set to redundancy 3
Report of obsolete backups and copies
Type
Key
Completion Time
Filename/Handle
-------------------- ------ ------------------ -------------------Archive
Log
51
15-JUN-05
/opt/oracle/product/1010/dbs/ora_
flash_area/DB10G/archivelog/2005_06_15/o1_mf_1_110_1c0mj1b2_.arc
Archive
Log
52
15-JUN-05
/opt/oracle/product/1010/dbs/ora_
flash_area/DB10G/archivelog/2005_06_15/o1_mf_1_111_1c0mj8co_.arc
Archive
Log
53
15-JUN-05
/opt/oracle/product/1010/dbs/ora_
flash_area/DB10G/archivelog/2005_06_15/o1_mf_1_112_1c0mj9tp_.arc
Archive
Log
54
15-JUN-05
/opt/oracle/product/1010/dbs/ora_
flash_area/DB10G/archivelog/2005_06_15/o1_mf_1_113_1c0mjh6j_.arc
Archive
Log
55
15-JUN-05
/opt/oracle/product/1010/dbs/ora_
flash_area/DB10G/archivelog/2005_06_15/o1_mf_1_114_1c0mjn90_.arc
B) If the archivelogs have been backed up (either to the Flash Recovery Area itself
or to another destination) and the archivelog not deleted. Then the space occupied
by that archivelog will be marked as reclaimable.
RMAN> backup archivelog all;
Starting backup at 15-JUN-05
current log archived
using channel ORA_DISK_1
channel
ORA_DISK_1: starting archive log backupset
channel ORA_DISK_1: specifying archive log(s) in backup set
input archive log thread=1
sequence=110 recid=51 stamp=561071961
input archive log thread=1 sequence=111 recid=52 stamp=561071968
input archive log thread=1
sequence=112 recid=53 stamp=561071969
input archive log thread=1 sequence=113 recid=54 stamp=561071975
input archive log thread=1
sequence=114 recid=55 stamp=561071980
input archive log thread=1 sequence=115 recid=56 stamp=561074872
channel ORA_DISK_1:
starting piece 1 at 15-JUN-05
channel ORA_DISK_1: finished piece 1 at 15-JUN-05
piece handle=/opt/oracle/product/1010/dbs/ora_flash_area/DB10G/backupset/2005_06
_15/o1_mf_annnn_TAG20050615T220755_1c0pc73n_.bkp
comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:09
Finished backup at 15-JUN-05
RMAN>
report obsolete;
RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 3
Report
of obsolete backups and copies
Type
Key
Completion Time
Filename/Handle
-------------------- ----------------------- -------------------Archive Log
51
15-JUN-05
/opt/oracle/product/1010/dbs/ora_
flash_area/DB10G/archivelog/2005_06_15/o1_mf_1_110_1c0mj1b2_.arc
Archive
Log
52
15-JUN-05
/opt/oracle/product/1010/dbs/ora_
flash_area/DB10G/archivelog/2005_06_15/o1_mf_1_111_1c0mj8co_.arc
Archive
Log
53
15-JUN-05
/opt/oracle/product/1010/dbs/ora_
flash_area/DB10G/archivelog/2005_06_15/o1_mf_1_112_1c0mj9tp_.arc
Archive
Log
54
15-JUN-05
/opt/oracle/product/1010/dbs/ora_
flash_area/DB10G/archivelog/2005_06_15/o1_mf_1_113_1c0mjh6j_.arc
Archive
Log
55
15-JUN-05
/opt/oracle/product/1010/dbs/ora_
flash_area/DB10G/archivelog/2005_06_15/o1_mf_1_114_1c0mjn90_.arc
SQL>
SELECT * FROM V$RECOVERY_FILE_DEST;
NAME
--------------------------------------------------------------------SPACE_LIMIT
SPACE_USED SPACE_RECLAIMABLE NUMBER_OF_FILES
----------- ---------- ----------------- --------------/opt/oracle/product/1010/dbs/ora_flash_area
1073741824
934593024
11767296
13
Here we see that 6 archivelogs have been backed up. Out of the 6 archivelogs
5 are not needed for recovery and are hence obsolete. But 1 of the archivelogs
is needed for recovery and hence is not shown in the report obsolete. But still
the space occupied by that archivelog will be added to the reclaimable space.
2) When the Flash Recovery Area is full and there is no space available to
create archivelogs in the Flash Recovery Area. We will get the following error
in the alert log:
Wed Jun 15 23:01:09 2005
Errors in file /opt/oracle/product/1010/admin/db10g/udump/db10g_ora_13754.trc:
ORA-19809:
limit exceeded for recovery files
ORA-19804: cannot reclaim 1032704 bytes disk space from 1073741824 limit
ARCH: Error 19809
Creating archive log file to
'/opt/oracle/product/1010/dbs/ora_flash_area/DB10G/archivelog/2005_06_15/o1_mf_1_116_0_.arc'
ARCH:
All standby destinations failed; successful archival assumed
ARCH: Failed to archive thread 1 sequence 116 (19809)
Wed Jun
15 23:01:27 2005
ARC1: Evaluating archive thread 1 sequence 116
ARC1: Archiving not possible: No primary destinations
ARC1:
Failed to archive thread 1 sequence 116 (4)
ARCH: Archival stopped, error occurred. Will continue retrying
Wed Jun 15 23:01:27
2005
ORACLE Instance db10g - Archival Error
ARCH: Connecting to console port...
Wed Jun 15 23:01:27 2005
ORA-16014:
log 2 sequence# 116 not archived, no available destinations
ORA-00312: online log 2 thread 1: '/opt/oracle/product/1010/oradata/db10g/redo02.log'
ARCH:
Connecting to console port...
ARCH:
Wed Jun 15 23:01:27 2005
ORA-16014: log 2 sequence# 116 not archived, no available
destinations
ORA-00312: online log 2 thread 1: '/opt/oracle/product/1010/oradata/db10g/redo02.log'
3) To free space in the FRA we could do take a backup of the Flash Recovery Area
using the command BACKUP RECOVERY AREA.
This command will take the backup of al the files in the FRA to tape only.
After this the space occupied by the files in the FRA will be marked as reclaimable.
Make sure that you have configured channels for backups to tape for this command to succeed.
RMAN> backup recovery area;
Starting backup at 15-JUN-05
released channel: ORA_DISK_1
using channel
ORA_SBT_TAPE_1
specification does not match any datafilecopy in the repository
channel ORA_SBT_TAPE_1: starting archive log
backupset
channel ORA_SBT_TAPE_1: specifying archive log(s) in backup set
input archive log thread=1 sequence=116 recid=57
stamp=561079349
channel ORA_SBT_TAPE_1: starting piece 1 at 15-JUN-05
channel ORA_SBT_TAPE_1: finished piece 1 at 15-JUN-05
piece
handle=28gn2p4a_1_1 comment=API Version 2.0,MMS Version 8.1.3.0
channel ORA_SBT_TAPE_1: backup set complete, elapsed time: 00:00:02
input
backupset count=58 stamp=561073729 creation_time=15-JUN-05
channel ORA_SBT_TAPE_1: starting piece 1 at 15-JUN-05
piece handle=1qgn2ji1_1_2
comment=API Version 2.0,MMS Version 8.1.3.0
channel ORA_SBT_TAPE_1: finished piece 1 at 15-JUN-05
channel ORA_SBT_TAPE_1:
backup set complete, elapsed time: 00:00:25
input backupset count=60 stamp=561073791 creation_time=15-JUN-05
channel ORA_SBT_TAPE_1:
starting piece 1 at 15-JUN-05
piece handle=1sgn2jjv_1_2 comment=API Version 2.0,MMS Version 8.1.3.0
....
input backupset
count=66 stamp=561076762 creation_time=15-JUN-05
channel ORA_SBT_TAPE_1: starting piece 1 at 15-JUN-05
piece handle=22gn2mgq_1_2
comment=API Version 2.0,MMS Version 8.1.3.0
channel ORA_SBT_TAPE_1: finished piece 1 at 15-JUN-05
channel ORA_SBT_TAPE_1:
backup set complete, elapsed time: 00:00:01
Finished backup at 15-JUN-05
Now the output of the query would look like this:
SQL> SELECT * FROM V$RECOVERY_FILE_DEST;
NAME
-------------------------------------------------------------------------------SPACE_LIMIT
SPACE_USED SPACE_RECLAIMABLE NUMBER_OF_FILES
----------- ---------- ----------------- --------------/opt/oracle/product/1010/dbs/ora_flash_area
1073741824
623138304
623138304
7
Note that this command will not delete the files from the FRA. The files would be
deleted whenever any space is required for any new operation.
4) If suppose the FRA is full and the reclaimable space is 0 or insufficient
and we cannot backup the Flash Recovery Area to tape. Then to free
space we may delete unwanted files which are not yet obsolete by the following method:
A) Use the RMAN DELETE command to delete some files from the FRA:
SQL> SELECT * FROM V$RECOVERY_FILE_DEST;
NAME
-----------------------------------------------------------------SPACE_LIMIT
SPACE_USED SPACE_RECLAIMABLE NUMBER_OF_FILES
----------- ---------- ----------------- --------------/opt/oracle/product/1010/dbs/ora_flash_area
1073741824
633155072
0
8
RMAN> delete backupset 45;
using channel ORA_DISK_1
using
channel ORA_SBT_TAPE_1
List of Backup Pieces
BP Key
BS Key
Pc# Cp# Status
Device Type Piece Name
------- --------- --- ----------- ----------- ---------52
45
1
1
AVAILABLE
DISK
opt/oracle/product/1010/dbs/ora
_flash_area/DB10G/backupset/2005_06_15/o1_mf_ncsnf_TAG20050615T215053_1c0odcbg_.bkp
Do
you really want to delete the above objects (enter YES or NO)? yes
deleted backup piece
backup piece handle=/opt/oracle/product/1010/dbs/ora_flash_area/DB10G/backupset/
2005_06_15/o1_mf_ncsnf_TAG20050615T215053_1c0odcbg_.bkp
recid=52 stamp=561073891
Deleted 1 objects
SQL> SELECT * FROM V$RECOVERY_FILE_DEST;
NAME
------------------------------------------------------------SPACE_LIMIT
SPACE_USED SPACE_RECLAIMABLE NUMBER_OF_FILES
----------- ---------- ----------------- --------------/opt/oracle/product/1010/dbs/ora_flash_area
1073741824
630189568
0
7
B) You can delete the files from the OS using the OS command and then run
the RMAN CROSSCHECK command and DELETE EXPIRED command to free the space.
SQL> SELECT * FROM V$RECOVERY_FILE_DEST;
NAME
------------------------------------------------------------SPACE_LIMIT
SPACE_USED SPACE_RECLAIMABLE NUMBER_OF_FILES
----------- ---------- ----------------- --------------/opt/oracle/product/1010/dbs/ora_flash_area
1073741824
630189568
0
7
[oracle@incq073ac 2005_06_15]$ ls -l
total 1016
-rw-r-----
1 oracle
dba 1033216 Jun 15 23:22 o1_mf_1_116_1c0tpxb6_.arc
[oracle@incq073ac 2005_06_15]$ rm *
[oracle@incq073ac 2005_06_15]$
RMAN>
crosscheck archivelog all;
released channel: ORA_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=142 devtype=DISK
validation
failed for archived log
archive log filename=/opt/oracle/product/1010/dbs/ora_flash_area/DB10G/archivelo
g/2005_06_15/o1_mf_1_116_1c0tpxb6_.arc
recid=57 stamp=561079349
validation succeeded for archived log
archive log filename=/opt/oracle/product/1010/dbs/ora_flash_area/DB10G/archivelo
g/2005_06_16/o1_mf_1_117_1c1ds0cf_.arc
recid=58 stamp=561097849
Crosschecked 2 objects
RMAN> delete expired archivelog all;
released channel: ORA_DISK_1
allocated
channel: ORA_DISK_1
channel ORA_DISK_1: sid=142 devtype=DISK
List of Archived Log Copies
Key
Time
Thrd Seq
S Low
Name
------- ---- ------- - --------- ---57
1
116
X 15-JUN-05 /opt/oracle/product/1010/dbs/ora_flash_area/DB1
0G/archivelog/2005_06_15/o1_mf_1_116_1c0tpxb6_.arc
Do
you really want to delete the above objects (enter YES or NO)? yes
deleted archive log
archive log filename=/opt/oracle/product/1010/dbs/ora_flash_area/DB10G/archivelo
g/2005_06_15/o1_mf_1_116_1c0tpxb6_.arc
recid=57 stamp=561079349
Deleted 1 EXPIRED objects
SQL> SELECT * FROM V$RECOVERY_FILE_DEST;
NAME
---------------------------------------------------------SPACE_LIMIT
SPACE_USED SPACE_RECLAIMABLE NUMBER_OF_FILES
----------- ---------- ----------------- --------------/opt/oracle/product/1010/dbs/ora_flash_area
1073741824
629156864
0
6
References
Note 305817.1 - FAQ - Flash Recovery Area feature of 10G
Keywords
FRA; V$RECOVERY_FILE_DEST;
Download