Flash Recovery
Flash Recovery
Using ASM
Author: Andy Rivenes
Date: August 24, 2005
If there is no additional space to allocate to the flash recovery area then your only
other practical choice is probably to delete files from the flash recovery area. If
you've followed the RMAN 10g backup examples, then you probably have your
retention policy set to "REDUNDANCY 1". If this is your situation then you won't
have "obsolete" files because they're already being deleted by RMAN, and if
you're doing just disk based backups you won't be able to run a "BACKUP
RECOVERY AREA" command. In this case you must delete existing files. Note
that this may compromise your recovery abilities, but that can be addressed once
the database is back running.
The problem now is, how to delete flash recovery area files when the flash
recovery area is located on ASM storage. The following examples will step
through a process of identifying the files in the ASM flash recovery area, deleting
them, and then updating the RMAN controlfile/repository to reflect that they have
been deleted.
Freeing Space in the 10g Flash Recovery Area When Using ASM Page 1
Copyright © 2005, AppsDBA Consulting, All Rights Reserved.
The following command will list all ASM files. Since the path is included this
output can be compared to the "db_recovery_file_dest" parameter to help in
deterring which files make up the flash recovery area.
COLUMN name Heading "Name" FORMAT A30 WORD_WRAPPED;
COLUMN path Heading "Path" FORMAT A60 WORD_WRAPPED;
COLUMN typ Heading "File Type" FORMAT A20;
SELECT al.name,
NVL(fi.type,'Directory') typ,
SYS_CONNECT_BY_PATH(al.name,'/') path
FROM v$asm_alias al,
v$asm_file fi
WHERE al.file_number = fi.file_number(+)
START WITH alias_index = 0
CONNECT BY PRIOR al.reference_index = al.parent_index
ORDER BY path, typ
/
In order to delete RMAN backup files, which will have a type of "ARCHIVELOG"
and "BACKUPSET" the following two commands can be run and their output
spooled to separate files:
SELECT 'alter diskgroup '||dg.name||' drop file
''+'||dg.name||''||SYS_CONNECT_BY_PATH(al.name,'/')||''';'
FROM v$asm_alias al, v$asm_file fi, v$asm_diskgroup dg
WHERE al.file_number = fi.file_number(+)
AND al.group_number = dg.group_number
AND fi.type = 'ARCHIVELOG'
START WITH alias_index = 0
CONNECT BY PRIOR al.reference_index = al.parent_index
These files can then be edited and run, and the desired files will be deleted from
ASM. The following is a sample taken from this output to delete one file:
/oracle$ sqlplus / as sysdba
Connected to:
Oracle Database 10g Enterprise Edition Release 10.1.0.3.0 - Production
With the Partitioning and Data Mining options
Diskgroup altered.
SQL>
Freeing Space in the 10g Flash Recovery Area When Using ASM Page 2
Copyright © 2005, AppsDBA Consulting, All Rights Reserved.
Once this is accomplished a "crosscheck archivelog all;" RMAN command should
be run. RMAN will note the discrepancy between the missing file(s) on disk and
the RMAN controlfile/repository, and mark the files as expired:
RMAN> crosscheck archivelog all;1
Now the RMAN command "delete expired archivelog all;" can be run and these
file entries will be removed from the RMAN controlfile/repository.
RMAN> delete expired archivelog all;2
Do you really want to delete the above objects (enter YES or NO)? yes
deleted archive log
archive log filename=+ORADATA01/db10g//1_106_542025636.arc recid=95 stamp=548013618
deleted archive log
archive log filename=+ORADATA01/db10g//1_107_542025636.arc recid=96 stamp=548038551
deleted archive log
archive log filename=+ORADATA01/db10g//1_108_542025636.arc recid=97 stamp=548074255
deleted archive log
1
While accurate, this command and the resulting output was performed on a different system.
2
While accurate, this command and the resulting output was performed on a different system.
Freeing Space in the 10g Flash Recovery Area When Using ASM Page 3
Copyright © 2005, AppsDBA Consulting, All Rights Reserved.
archive log filename=+ORADATA01/db10g//1_109_542025636.arc recid=98 stamp=548095159
deleted archive log
archive log filename=+ORADATA01/db10g/archivelog/2005_01_21/thread_1_seq_111.296.3
recid=100 stamp=548200883
deleted archive log
archive log filename=+ORADATA01/db10g/archivelog/2005_01_22/thread_1_seq_112.312.5
recid=101 stamp=548229666
deleted archive log
archive log filename=+ORADATA01/db10g/archivelog/2005_01_22/thread_1_seq_113.295.3
recid=102 stamp=548262885
deleted archive log
The following query now shows that there is plenty of space available in the flash
recovery area.
SQL> select * from v$recovery_file_dest;
SQL> /
At this point it is important to take a valid backup to insure that the database can be
recovered.
References
Oracle Database Backup and Recovery Basics, 10g Release 1 (10.1), Part
Number B10735-01
Freeing Space in the 10g Flash Recovery Area When Using ASM Page 4
Copyright © 2005, AppsDBA Consulting, All Rights Reserved.