ORA-19809 – ORA-19809: limit exceeded for recovery files

By haelsite

ORA-19809 – ORA-19809: limit exceeded
for recovery files

 

El otro día trasteando, Oracle dio el siguiente error al
entrar en la Base de Datos.

 

ORA-16038: log 1 sequence# 11 cannot be
archived

ORA-19809: limit exceeded for recovery
files

ORA-00312: online log 1 thread 1:
‘/AV_SERVER/orasw/oradata/av2/redo01.log’

 

Este error es porque se ha excedido el tamaño que tenemos
establecido en el parámetro:

 

db_recovery_file_dest_size

 

Para solucionarlo:

 

Vemos la estimación de espacio:

 

set lines 100

col name format a60

select name

, floor(space_limit / 1024 / 1024) “Size MB”

, ceil(space_used / 1024 / 1024) “Used MB”

from v$recovery_file_dest

order by name

/

 

NAME Size MB Used MB

———————————————————— ———-
———-

/AV_SERVER/orasw/flash_recovery_area
2048 1953

 

Vemos que tiene un tamaño de 2G y que está ocupado a 1,9G.

 

La solución es:

 

Aumentar el parámetro o borrar los archivelog (pero esto no
se debe hacer si la BD es crítica).

 

Caso1: Aumento del tamaño del parámetro.

 

alter system set db_recovery_file_dest_size
= 4G scope=both;

 

select name

, floor(space_limit / 1024 / 1024) “Size MB”

, ceil(space_used / 1024 / 1024) “Used MB”

from v$recovery_file_dest

order by name

/

 

NAME Size MB Used MB

———————————————————— ———-
———-

/AV_SERVER/orasw/flash_recovery_area
4096 1953

 

Caso2: Borrado de los ficheros.

 

Borramos los ficheros a pelo, por lo que habrá una
incoherencia en los que tiene la BD como archivado y lo que realmente habrá en
el HDD.

 

0.- Error inicial

ORA-16038: log 1 sequence# 11 cannot be
archived

ORA-19809: limit
exceeded for recovery files

ORA-00312: online log 1 thread 1:
‘/AV_SERVER/orasw/oradata/av2/redo01.log’

 

1.- Borrado de fichero físicos.

 

Nos vamos a la ruta que indica donde están los redolog y los
borramos. (Pero ojo los redolog NO los onlinelog).

 

SQL> show parameter recovery;

 

NAME
TYPE VALUE

————————————
———– ——————————

db_recovery_file_dest
string /AV_SERVER/orasw/flash_recover


y_area

db_recovery_file_dest_size
big integer 4G

recovery_parallelism
integer 0

 

 

2.- Arrancar la BD

 

SQL> startup;

ORACLE instance started.

 

Total System Global Area 608174080
bytes

Fixed Size 1263200
bytes

Variable Size 390072736
bytes

Database Buffers 209715200
bytes

Redo Buffers 7122944
bytes

Database mounted.

ORA-16038: log 1 sequence# 11 cannot be
archived

ORA-19809: limit
exceeded for recovery files

ORA-00312: online log 1 thread 1:
‘/AV_SERVER/orasw/oradata/av2/redo01.log’

 

Vemos que a pesar de que se han borrado el no nos permite
arrancar. La Base de Datos se ha quedado en estado montada. Podemos obtener
alguna información de ella.

 

SQL> select status from v$instance;

 

STATUS

————

MOUNTED

 

3.- Comprobamos el tamaño ocupado en archive log (según
la BD).

 

SQL> set lines 100

SQL> col name format a60

select name

, floor(space_limit / 1024 / 1024)
"Size MB"

, ceil(space_used / 1024 / 1024)
"Used MB"

from v$recovery_file_dest

order by name

/

 

NAME
Size MB Used MB

————————————————————
———- ———-

/AV_SERVER/orasw/flash_recovery_area
2048 1953

 

SQL> show parameter
db_recovery_file_dest_size

 

NAME
TYPE VALUE

————————————
———– ——————————

db_recovery_file_dest_size
big integer 2G

 

 

4.- Para salir del paso y que nos deje entrar ponemos la BD
en noarchivelog.

 

SQL> alter database noarchivelog;

 

Database altered.

 

5.- Arrancamos

 

SQL> startup;

ORACLE instance started.

 

Total System Global Area
608174080 bytes

Fixed
Size 1263200 bytes

Variable Size
427821472 bytes

Database Buffers
171966464 bytes

Redo
Buffers 7122944 bytes

Database mounted.

Database opened.

 

Ya tenemos la BD abierta.

 

6.- Ponemos modod archivelog.

 

SQL> alter database archivelog;

 

Database altered.

 

7.- Paramos y arrancamos.

 

SQL> shutdown immediate

Database dismounted.

ORACLE instance shut down.

SQL> startup nomount

ORACLE instance started.

 

Total System Global Area 608174080 bytes

Fixed Size 1263200 bytes

Variable Size 436210080 bytes

Database Buffers 163577856 bytes

Redo Buffers 7122944 bytes

 

 

SQL> alter database mount;

 

Database altered.

 

SQL> alter database open;

 

Database altered.

 

SQL> alter system switch logfile;

 

System altered.

 

SQL> r

1* alter system switch logfile

 

System altered.

 

SQL> r

1* alter system switch logfile

 

System altered.

 

SQL> 1* alter system switch logfile

 

System altered.

 

SQL> 1* alter system switch logfile

 

Ya hemos creado unos cuantos redologs.

 

8.- Vemos que a pesar de haber borrado no se actualiza en
BD.

 

select * from v$recovery_file_dest;

 

 

NAME SPACE_LIMIT
SPACE_USED SPACE_RECLAIMABLE NUMBER_OF_FILES

/…/flash_recovery_area 2147483648
2051294720 0 24

 

Vemos que existen 24 ficheros
de redolog. ¿pero donde están?, esta información la guarda la BD pero no es
real, con lo que debemos modificarla y actualizarla.

 

 

SQL> select * from
V$FLASH_RECOVERY_AREA_USAGE;

 

FILE_TYPE PERCENT_SPACE_USED
PERCENT_SPACE_RECLAIMABLE NUMBER_OF_FILES

———— ——————
————————- —————

CONTROLFILE 0 0
0

ONLINELOG
0 0 0

ARCHIVELOG
95.52 0 24

BACKUPPIECE
0 0 0

IMAGECOPY
0 0 0

FLASHBACKLOG 0
0 0

 

6 rows selected.

 

Si ampliamos el tamaño del parámetro:

 

SQL> alter system set
db_recovery_file_dest_size = 4G scope=BOTH;

 

SQL> select * from
V$FLASH_RECOVERY_AREA_USAGE;

 

FILE_TYPE PERCENT_SPACE_USED
PERCENT_SPACE_RECLAIMABLE NUMBER_OF_FILES

———— ——————
————————- —————

CONTROLFILE
0 0 0

ONLINELOG
0 0 0

ARCHIVELOG
47.76 0 24

BACKUPPIECE
0 0 0

IMAGECOPY
0 0 0

FLASHBACKLOG
0 0 0

 

6 rows selected.

 

Vemos que ha bajado el porcentaje de ocupación pero no el
número de ficheros.

 

SQL> set lines 100

col name format a60

select name

, floor(space_limit / 1024 / 1024)
"Size MB"

, ceil(space_used / 1024 / 1024)
"Used MB"

from v$recovery_file_dest

order by name

/

 

 

NAME
Size MB Used MB

————————————————————
———- ———-

/AV_SERVER/orasw/flash_recovery_area
4096 1957

 

SQL> archive log list;

Database log
mode Archive Mode

Automatic archival
Enabled

Archive
destination USE_DB_RECOVERY_FILE_DEST

Oldest online log
sequence 26

Next log sequence to
archive 28

Current log sequence 28

 

 

Para solucionar esto debemos acceder a RMAN:

 

RMAN> rman / nocatalog;

 

Como se que la secuencia actual es la 28 debo borrar
hasta la 25 por lo menos.

 

RMAN> DELETE NOPROMPT ARCHIVELOG
UNTIL SEQUENCE 25;

 

 

allocated channel: ORA_DISK_1

channel ORA_DISK_1: sid=178 devtype=DISK

 

List of Archived Log Copies

Key Thrd Seq S Low Time Name

——- —- ——- – ——— —-

 

********** DESPUES DE BORRAR LOS QUE HA PODIDO DA EL
SIGUIENTE ERROR ****

 

RMAN-06207: WARNING: 10
objects could not be deleted for DISK channel(s) due

RMAN-06208: to
mismatched status. Use CROSSCHECK command to fix status

RMAN-06210: List of
Mismatched objects

RMAN-06211: ==========================

RMAN-06212: Object Type Filename/Handle

RMAN-06213: —————
—————————————————

RMAN-06214: Archivelog
archivelog/2009_03_12/o1_mf_1_1_4vm1kzx2_.arc

RMAN-06214: Archivelog
archivelog/2009_03_14/o1_mf_1_2_4vpoj9q0_.arc

RMAN-06214: Archivelog
archivelog/2009_03_16/o1_mf_1_3_4vv72ybr_.arc

RMAN-06214: Archivelog
archivelog/2009_03_16/o1_mf_1_4_4vxm5s63_.arc

RMAN-06214: Archivelog
archivelog/2009_03_17/o1_mf_1_5_4vyync39_.arc

RMAN-06214: Archivelog
archivelog/2009_03_17/o1_mf_1_6_4vzsk3rw_.arc

RMAN-06214: Archivelog
archivelog/2009_03_18/o1_mf_1_7_4w0ofsx9_.arc

RMAN-06214: Archivelog
archivelog/2009_03_18/o1_mf_1_8_4w2c7td3_.arc

RMAN-06214: Archivelog
archivelog/2009_03_19/o1_mf_1_9_4w3fvt5r_.arc

RMAN-06214: Archivelog
archivelog/2009_03_19/o1_mf_1_10_4w4vkzg3_.arc

 

 

 

Que son los ficheros que no encuentra y que hemos borrado a
mano.

 

SQL> select * from
V$FLASH_RECOVERY_AREA_USAGE;

 

FILE_TYPE PERCENT_SPACE_USED
PERCENT_SPACE_RECLAIMABLE NUMBER_OF_FILES

———— ——————
————————- —————

CONTROLFILE 0 0
0

ONLINELOG
0 0 0

ARCHIVELOG
47.66 0 12

BACKUPPIECE
0 0 0

IMAGECOPY
0 0 0

FLASHBACKLOG 0
0 0

 

6 rows selected.

 

Ahora ya quedan menos pero hay 12 que son lo que hemos
borrado a mano y no los encuentra.

 

RMAN> list copy;

 

 

List of Archived Log Copies

Key Thrd Seq S Low Time Name

——- —- ——- – ——— —-

1 1 1 A 12-MAR-09
archivelog/2009_03_12/o1_mf_1_1_4vm1kzx2_.arc

2 1 2 A 12-MAR-09
archivelog/2009_03_14/o1_mf_1_2_4vpoj9q0_.arc

3 1 3 A 14-MAR-09
archivelog/2009_03_16/o1_mf_1_3_4vv72ybr_.arc

4 1 4 A 16-MAR-09
archivelog/2009_03_16/o1_mf_1_4_4vxm5s63_.arc

5 1 5 A 16-MAR-09
archivelog/2009_03_17/o1_mf_1_5_4vyync39_.arc

6 1 6 A 17-MAR-09
archivelog/2009_03_17/o1_mf_1_6_4vzsk3rw_.arc

7 1 7 A 17-MAR-09
archivelog/2009_03_18/o1_mf_1_7_4w0ofsx9_.arc

8 1 8 A 18-MAR-09
archivelog/2009_03_18/o1_mf_1_8_4w2c7td3_.arc

9 1 9 A 18-MAR-09
archivelog/2009_03_19/o1_mf_1_9_4w3fvt5r_.arc

10 1 10 A 19-MAR-09
archivelog/2009_03_19/o1_mf_1_10_4w4vkzg3_.arc

23 1 26 A 23-MAR-09
archivelog/2009_03_23/o1_mf_1_26_4wgsnbn4_.arc

24 1 27 A 23-MAR-09
archivelog/2009_03_23/o1_mf_1_27_4wgsnbpv_.arc

 

Estos son los 12 que hemos borrado a pelo.

 

Comprobamos la consistencia de los backups:

 

RMAN> CHANGE ARCHIVELOG ALL
CROSSCHECK;

 

released channel: ORA_DISK_1

allocated channel: ORA_DISK_1

channel ORA_DISK_1: sid=177 devtype=DISK

validation failed for archived log

archive log
filename=2009_03_12/o1_mf_1_1_4vm1kzx2_.arc recid=1 stamp=681346958

validation failed for archived log

archive log
filename=2009_03_14/o1_mf_1_2_4vpoj9q0_.arc recid=2 stamp=681465662

validation failed for archived log

archive log
filename=2009_03_16/o1_mf_1_3_4vv72ybr_.arc recid=3 stamp=681614749

validation failed for archived log

archive log
filename=2009_03_16/o1_mf_1_4_4vxm5s63_.arc recid=4 stamp=681692673

validation failed for archived log

archive log
filename=2009_03_17/o1_mf_1_5_4vyync39_.arc recid=5 stamp=681737161

validation failed for archived log

archive log
filename=2009_03_17/o1_mf_1_6_4vzsk3rw_.arc recid=6 stamp=681764695

validation failed for archived log

archive log
filename=2009_03_18/o1_mf_1_7_4w0ofsx9_.arc recid=7 stamp=681793330

validation failed for archived log

archive log
filename=2009_03_18/o1_mf_1_8_4w2c7td3_.arc recid=8 stamp=681848367

validation failed for archived log

archive log filename=2009_03_19/o1_mf_1_9_4w3fvt5r_.arc
recid=9 stamp=681883848

validation failed for archived log

archive log
filename=2009_03_19/o1_mf_1_10_4w4vkzg3_.arc recid=10 stamp=681930653

Crosschecked 10 objects

 

Ya podemos hacer un DELETE.

 

RMAN> DELETE NOPROMPT ARCHIVELOG
UNTIL SEQUENCE 133;

 

released channel: ORA_DISK_1

allocated channel: ORA_DISK_1

channel ORA_DISK_1: sid=177 devtype=DISK

 

List of Archived Log
Copies

Key Thrd Seq S
Low Time Name

——- —- ——- – ———
—-

1 1 1 X 12-MAR-09 2009_03_12/o1_mf_1_1_4vm1kzx2_.arc

2 1 2 X 12-MAR-09
2009_03_14/o1_mf_1_2_4vpoj9q0_.arc

3 1 3 X 14-MAR-09
2009_03_16/o1_mf_1_3_4vv72ybr_.arc

4 1 4 X 16-MAR-09
2009_03_16/o1_mf_1_4_4vxm5s63_.arc

5 1 5 X 16-MAR-09
2009_03_17/o1_mf_1_5_4vyync39_.arc

6 1 6 X 17-MAR-09
2009_03_17/o1_mf_1_6_4vzsk3rw_.arc

7 1 7 X 17-MAR-09
2009_03_18/o1_mf_1_7_4w0ofsx9_.arc

8 1 8 X 18-MAR-09
2009_03_18/o1_mf_1_8_4w2c7td3_.arc

9 1 9 X 18-MAR-09
2009_03_19/o1_mf_1_9_4w3fvt5r_.arc

10 1 10 X 19-MAR-09
2009_03_19/o1_mf_1_10_4w4vkzg3_.arc

deleted archive log

archive log
filename=2009_03_12/o1_mf_1_1_4vm1kzx2_.arc recid=1 stamp=681346958

deleted archive log

archive log
filename=2009_03_14/o1_mf_1_2_4vpoj9q0_.arc recid=2 stamp=681465662

deleted archive log

archive log
filename=2009_03_16/o1_mf_1_3_4vv72ybr_.arc recid=3 stamp=681614749

deleted archive log

archive log
filename=2009_03_16/o1_mf_1_4_4vxm5s63_.arc recid=4 stamp=681692673

deleted archive log

archive log
filename=2009_03_17/o1_mf_1_5_4vyync39_.arc recid=5 stamp=681737161

deleted archive log

archive log
filename=2009_03_17/o1_mf_1_6_4vzsk3rw_.arc recid=6 stamp=681764695

deleted archive log

archive log filename=2009_03_18/o1_mf_1_7_4w0ofsx9_.arc
recid=7 stamp=681793330

deleted archive log

archive log
filename=2009_03_18/o1_mf_1_8_4w2c7td3_.arc recid=8 stamp=681848367

deleted archive log

archive log
filename=2009_03_19/o1_mf_1_9_4w3fvt5r_.arc recid=9 stamp=681883848

deleted archive log

archive log
filename=2009_03_19/o1_mf_1_10_4w4vkzg3_.arc recid=10 stamp=681930653

Deleted 10 objects

 

Ahora se han borrado todos correctamente.

 

 

SQL> select * from
V$FLASH_RECOVERY_AREA_USAGE;

 

FILE_TYPE PERCENT_SPACE_USED PERCENT_SPACE_RECLAIMABLE
NUMBER_OF_FILES

———— ——————
————————- —————

CONTROLFILE
0 0 0

ONLINELOG
0 0 0

ARCHIVELOG
9.53 0 2

BACKUPPIECE
0 0 0

IMAGECOPY
0 0 0

FLASHBACKLOG 0
0 0

 

6 rows selected.

 

Los archivelogs ya están actualizados.

Escribe un comentario