Reporting datafiles that are affected by unrecoverable operations

Alguns comandos emitidos no banco de dados podem, de forma premeditada, não gerar os vetores de mudanças nos redo logs (talvez por buscarem mais “performance” na operação), e desse modo, não permitem a recuperação de um datafile (ou mais) em caso de desastre. Para precaver os administradores do banco de dados, o comando REPORT possui uma método de consulta para nos reportar os datafiles que se encontram nessa situação. Geralmente, após isso é necessário realizar um backup do mesmo para garantirmos a proteção total dos dados. Neste artigo vamos mostrar um exemplo simples desse mecanismo.

Criando uma tabela com a opção NOLOGGING:

[oracle@oel8 ~]$ sqlplus / as sysdba
 
SQL*Plus: Release 18.0.0.0.0 - Production on Fri Apr 9 21:00:39 2021
Version 18.13.0.0.0
 
Copyright (c) 1982, 2018, Oracle.  All rights reserved.
 
 
Connected to:
Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production
Version 18.13.0.0.0
 
SQL> CREATE TABLE TESTE.BSS NOLOGGING TABLESPACE USERS AS SELECT * FROM DBA_OBJECTS;
 
Table created.

Emitindo o comando abaixo no RMAN para vermos o datafile reportado:

[oracle@oel8 ~]$ rman target /
 
Recovery Manager: Release 18.0.0.0.0 - Production on Fri Apr 9 21:01:34 2021
Version 18.13.0.0.0
 
Copyright (c) 1982, 2018, Oracle and/or its affiliates.  All rights reserved.
 
connected to target database: RMANDB (DBID=3825250984)
 
RMAN> REPORT UNRECOVERABLE;
 
using target database control file instead of recovery catalog
Report of files that need backup due to unrecoverable operations
File Type of Backup Required Name
---- ----------------------- -----------------------------------
7    full or incremental     /oracle/dados/RMANDB/datafile/o1_mf_users_h8nyrkn7_.dbf

Realizando backup da tablespace USERS:

RMAN> BACKUP TABLESPACE USERS;
 
Starting backup at 2021-04-09:21:02:17
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=81 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00007 name=/oracle/dados/RMANDB/datafile/o1_mf_users_h8nyrkn7_.dbf
channel ORA_DISK_1: starting piece 1 at 2021-04-09:21:02:17
channel ORA_DISK_1: finished piece 1 at 2021-04-09:21:02:18
piece handle=/oracle/fra/RMANDB/backupset/2021_04_09/o1_mf_nnndf_TAG20210409T210217_j71trb3c_.bkp tag=TAG20210409T210217 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 2021-04-09:21:02:18
 
Starting Control File and SPFILE Autobackup at 2021-04-09:21:02:19
piece handle=/oracle/fra/RMANDB/autobackup/2021_04_09/o1_mf_s_1069448539_j71trcgz_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 2021-04-09:21:02:22

Agora o datafile tem garantias de recuperabilidade:

RMAN> REPORT UNRECOVERABLE;
 
Report of files that need backup due to unrecoverable operations
File Type of Backup Required Name
---- ----------------------- -----------------------------------
 
RMAN>

Obs: Este procedimento foi criado pelo senhor Ahmed Baraka (www.ahmedbaraka.com) e foi apenas reproduzido por mim em um laboratório pessoal para fins de aprendizado.

Leave a Comment

Your email address will not be published.