Depois de um longo período sem escrever, eis me aqui novamente. Hoje, para compartilhar um caso do dia a dia.
Uma instância Oracle caía um pouco depois de sua inicialização, e podíamos ver a seguinte mensagem no Alert.log:
Thu Dec 29 17:17:16 2022
Dumping diagnostic data in directory=[cdmp_20221229171716], requested by (instance=1, osid=2479 (MMON)), summary=[incident=671562].
Block recovery from logseq 117292, block 72 to scn 231911436605
Recovery of Online Redo Log: Thread 1 Group 1 Seq 117292 Reading mem 0
Mem# 0: /*/*/onlinelog/redo01.log
Block recovery completed at rba 117292.74.16, scn 53.4278169919
Errors in file /u01/app/oracle/diag/rdbms/trace/a_pmon_2370.trc (incident=671451):
ORA-00600: c¦digo de erro interno, argumentos: [4194], [], [], [], [], [], [], [], [], [], [], []
Use ADRCI or Support Workbench to package the incident.
See Note 411.1 at My Oracle Support for error and packaging details.
Errors in file /u01/app/oracle/diag/rdbms/trace/a_pmon_2370.trc:
ORA-00600: c¦digo de erro interno, argumentos: [4194], [], [], [], [], [], [], [], [], [], [], []
PMON (ospid: 2370): terminating the instance due to error 472
System state dump requested by (instance=1, osid=2370 (PMON)), summary=[abnormal instance termination].
System State dumped to trace file /u01/app/oracle/diag/rdbms/trace/a_diag_2380.trc
Dumping diagnostic data in directory=[cdmp_20221229171719], requested by (instance=1, osid=2370 (PMON)), summary=[abnormal instance termination].
Instance terminated by PMON, pid = 2370
Após algum período investigando no MOS, decidimos nos orientar a partir da Nota “Step by step to resolve ORA-600 4194 4193 4197 on database crash (Doc ID 1428786.1)“. Nela, é reportado como causa um constrangimento entre os registros de Redo e Undo (que em alguns casos pode ser derivado de Bug ou de interrupção abrupta da instance).
Conforme procedimento da nota, montamos o banco de dados, criamos um arquivo PFILE e baixamos a instance:
[oracle@host ] $ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Fri Dec 30 10:05:55 2022
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 1068937216 bytes
Fixed Size 2235208 bytes
Variable Size 671089848 bytes
Database Buffers 390070272 bytes
Redo Buffers 5541888 bytes
Database mounted.
SQL> create pfile='/tmp/bss.ora' from spfile;
File created.
SQL> shu immediate;
ORA-01109: base de dados n?o aberta
Database dismounted.
ORACLE instance shut down.
SQL> exit
Neste arquivo PFILE, adicionamos 2 parâmetros conforme abaixo:
*.undo_management='manual'
*.event='10513 trace name context forever, level 2'
Inicializamos a instância em modo restrito usando o PFILE editado:
[oracle@host ] $ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Fri Dec 30 10:23:04 2022
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup restrict pfile='/tmp/bss.ora';
ORACLE instance started.
Total System Global Area 1068937216 bytes
Fixed Size 2235208 bytes
Variable Size 671089848 bytes
Database Buffers 390070272 bytes
Redo Buffers 5541888 bytes
Database mounted.
Database opened.
O resultado da consulta abaixo vai determinar os próximos passos. Haverá sempre um registro vinculado com a tablespace SYSTEM com status ONLINE. Se houver outros segmentos com status “PARTLY AVAILABLE” ou “NEEDS RECOVERY”, é necessário a abertura de um chamado na Oracle. Se estiverem OFFLINE, ou não for reportado mais segmentos (que foi o nosso caso), pode-se seguir:
SQL> select tablespace_name, status, segment_name from dba_rollback_segs where status != 'OFFLINE';
TABLESPACE_NAME STATUS SEGMENT_NAME
------------------------------ ---------------- ------------------------------
SYSTEM ONLINE SYSTEM
O próximo passo é criar uma nova tablespace de UNDO. Antes de sua criação, obtemos as informações mínimas da tablespace atual:
SELECT a.tablespace_name, SIZEMB, USAGEMB, (SIZEMB - USAGEMB) FREEMB
FROM ( SELECT SUM (bytes) / 1024 / 1024 SIZEMB, b.tablespace_name
FROM dba_data_files a, dba_tablespaces b
WHERE a.tablespace_name = b.tablespace_name AND b.contents like 'UNDO'
GROUP BY b.tablespace_name) a,
( SELECT c.tablespace_name, SUM (bytes) / 1024 / 1024 USAGEMB
FROM DBA_UNDO_EXTENTS c
WHERE status <> 'EXPIRED'
GROUP BY c.tablespace_name) b
WHERE a.tablespace_name = b.tablespace_name;
SQL> SELECT a.tablespace_name,
SIZEMB,
USAGEMB,
(SIZEMB - USAGEMB) FREEMB
FROM ( SELECT SUM (bytes) / 1024 / 1024 SIZEMB, b.tablespace_name
FROM dba_data_files a, dba_tablespaces b
2 3 4 5 6 7 WHERE a.tablespace_name = b.tablespace_name AND b.contents like 'UNDO'
GROUP BY b.tablespace_name) a,
( SELECT c.tablespace_name, SUM (bytes) / 1024 / 1024 USAGEMB
FROM DBA_UNDO_EXTENTS c
WHERE status <> 'EXPIRED'
GROUP BY c.tablespace_name) b
WHERE a.tablespace_name = b.tablespace_name; 8 9 10 11 12 13
TABLESPACE_NAME SIZEMB USAGEMB FREEMB
------------------------------ ---------- ---------- ----------
UNDOTBS1 28564 37,125 28526,875
Criando nova tablespace (em nosso caso com o mesmo tamanho da atual, por termos espaço suficiente):
SQL> CREATE UNDO TABLESPACE UNDOTBS DATAFILE '****/datafile/undotbs.dbf' SIZE 28564M;
Tablespace created.
Deletando a tablespace atual:
SQL> drop tablespace UNDOTBS1 including contents and datafiles;
Tablespace dropped.
Baixando a instância, e montando o banco de dados com o SPFILE original. Após isso, alterando o seu parâmetro com a nova tablespace de UNDO. Ao realizar o restart da instância, pudemos ver que não tivemos mais os erros reportados no Alert.log, além da nossa instância não ser abortada automaticamente como antes:
SQL> SHU IMMEDIATE;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> STARTUP NOMOUNT;
ORACLE instance started.
Total System Global Area 1068937216 bytes
Fixed Size 2235208 bytes
Variable Size 671089848 bytes
Database Buffers 390070272 bytes
Redo Buffers 5541888 bytes
SQL> Alter system set undo_tablespace = 'UNDOTBS' scope=spfile;
System altered.
SQL> SHU IMMEDIATE;
ORA-01507: base de dados n?o montada
ORACLE instance shut down.
SQL> STARTUP;
ORACLE instance started.
Total System Global Area 1068937216 bytes
Fixed Size 2235208 bytes
Variable Size 671089848 bytes
Database Buffers 390070272 bytes
Redo Buffers 5541888 bytes
Database mounted.
Database opened.
SQL> ALTER SYSTEM CHECKPOINT;
System altered.
SQL>