CHANGES
1. Created Restore Point P1 and then created another Restore Point P2.
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB1 READ WRITE NO
SQL>
SQL> alter session set container=pdb1;
Session altered.
SQL> create restore point P1 guarantee flashback database;
Restore point created.
SQL>
SQL> create restore point p2 guarantee flashback database;
Restore point created.
SQL>?
2. Flashback PDB to P1 with Resetlogs.
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB1 MOUNTED
SQL> show con_name
CON_NAME
------------------------------
CDB$ROOT
SQL>
SQL> FLASHBACK PLUGGABLE DATABASE pdb1 TO RESTORE POINT P1;
Flashback complete.
SQL> alter pluggable database pdb1 open resetlogs;
Pluggable database altered.?
3. Flashback PDB to P2
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB1 MOUNTED
SQL>
SQL> FLASHBACK PLUGGABLE DATABASE pdb1 TO RESTORE POINT P2;
FLASHBACK PLUGGABLE DATABASE pdb1 TO RESTORE POINT P2
*
ERROR at line 1:
ORA-39867: Clean PDB restore point 'P2' is on an orphan incarnation of the?
pluggable database.
CAUSE
+ This is expected Behaviour.
+ Flashback of a PDB to direct ancestor incarnations is only allowed. Flashback PDB to a sibling incarnation will report error.
? ?
? ? ? ? ?Note :- For more details on incarnations - Refer https://docs.oracle.com/cd/B19306_01/backup.102/b14192/flashptr006.htm
SOLUTION
1. Restore and Recover the entire database to Point in Time (P2). You may also Restore and Recover database to another server and then migrate/Clone the PDB to existing database.?
2. Instead of open PDB in read/write (with resetlogs) open pdb in read only mode.
Note -
? ? ? ? ? Flashback PDB from P2 to P1 to P0 should work fine.
? ? ? ? ? Restore and Recovery of PDB1 to P2/SCN/Timestamp will also fail due to incarnation.
SQL>? alter? pluggable database pdb close;???
SQL> flashback pluggable database pdb to restore point PDB_012118;
SQL> alter? pluggable database open read only;
SQL>? alter? pluggable database pdb close;??
SQL>? flashback pluggable database pdb to restore point PDB_012123;
SQL>? alter? pluggable database open read only;
SQL> alter? pluggable database pdb close;?
SQL>? flashback pluggable database pdb to restore point PDB_012123;
SQL> flashback pluggable database pdb to restore point PDB_012118;
SQL> alter? pluggable database pdb open resetlogs;
SQL> alter? pluggable database pdb close;
SQL>? flashback pluggable database pdb to restore point PDB_012123;
flashback pluggable database pdb to restore point PDB_012123
*
ERROR at line 1:
ORA-39867: Clean PDB restore point 'PDB_012123' is on an orphan incarnation of
the pluggable database.