Estava simulando o recurso de Flashback Database em um Oracle 18C Multitenant, e no momento de voltar o banco para um SCN específico, o erro abaixo era reportado:
SQL> SHU IMMEDIATE;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> STARTUP MOUNT;
ORACLE instance started.
Total System Global Area 2466249080 bytes
Fixed Size 8898936 bytes
Variable Size 671088640 bytes
Database Buffers 1778384896 bytes
Redo Buffers 7876608 bytes
Database mounted.
SQL> FLASHBACK DATABASE TO SCN 1810936;
FLASHBACK DATABASE TO SCN 1810936
*
ERROR at line 1:
ORA-38729: Not enough flashback database log data to do FLASHBACK.
Após algumas análises, percebi que o incarnation do meu banco não estava correto, pois eu havia o alterado por conta de outros testes:
[oracle@quiasma dbs]$ rman target /
Recovery Manager: Release 18.0.0.0.0 - Production on Sat May 29 05:02:26 2021
Version 18.13.0.0.0
Copyright (c) 1982, 2018, Oracle and/or its affiliates. All rights reserved.
connected to target database: ASWAN (DBID=1341162082, not open)
RMAN> LIST INCARNATION;
using target database control file instead of recovery catalog
List of Database Incarnations
DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1 1 ASWAN 1341162082 CURRENT 1 07-FEB-18
2 2 ASWAN 1341162082 ORPHAN 1477662 22-MAY-21
Neste caso, precisei apenas realizar o reset do database para o incarnation correto ao meu contexto:
RMAN> RESET DATABASE TO INCARNATION 2;
database reset to incarnation 2
Após essa intervenção, o comando de Flashback funcionou corretamente:
[oracle@quiasma dbs]$ sqlplus / as sysdba
SQL*Plus: Release 18.0.0.0.0 - Production on Sat May 29 05:02:54 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> FLASHBACK DATABASE TO SCN 1810936;
Flashback complete.