In oracle 12.2 version, we can perform flashback at PDB level also.It has no dependency on container.
EXAMPLE:
Create a restore point at PDB level:
SQL> alter session set container=HEPDB1; SQL> create restore point CHECKPOINT_1 guarantee flashback database; SQL> select NAME,TIME,SCN,PDB_RESTORE_POINT,GUARANTEE_FLASHBACK_DATABASE from V$RESTORE_POINT; NAME TIME SCN PDB GUA -------------- --------------------------------------------------------------------------- ---------- --- --- CHECKPOINT_1 05-MAR-18 11.30.24.000000000 AM 1325714 YES YES --- Create a test table create table raj.TEST200 as select * from dba_objects; SQL> select table_name from dba_tables where owner='RAJ'; TABLE_NAME -------------------------------------------------------------------------------------------------------------------------------- TEST100 TEST200
Now before doing flashback, we have to check whether what is the undo type, whether local undo or shared undo.
SQL> select PROPERTY_VALUE from database_properties where property_name='LOCAL_UNDO_ENABLED'; PROPERTY_VALUE ----------------------- TRUE -- > Means local_undo is enabled.
SEE ALSO – Local undo and shared undo in oracle 12.2 Multitenant
FLASHBACK WHEN LOCAL_UNDO is enabled:
SQL> alter pluggable database HEPDB1 close; Pluggable database altered. SQL> flashback pluggable database HEPDB1 to restore point checkpoint_1; Flashback complete. SQL> SQL> alter pluggable database HEPDB1 open resetlogs; Pluggable database altered. SQL> show pdbs CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 5 HEPDB1 READ WRITE NO SQL> select table_name from dba_tables where owner='RAJ'; TABLE_NAME -------------------------------------------------------------------------------------------------------------------------------- TEST100
We have performed flashback successfully. But if we are using shared undo, then follow steps as below.
FLASHBACK WHEN LOCAL_UNDO is not enabled:
alter pluggable database HEPDB1 close; flashback pluggable database HEPDB1 to restore point CHECKPOINT_1 auxiliary destination '/u01/app/oracle/stage'; alter pluggable database HEPDB1 open resetlogs;
Here small correction for heading if shared undo is enabled.
Heading should be :-
FLASHBACK WHEN LOCAL_UNDO is not enabled:
Thanks you very much for creating this site as well.
Thank you. I have updated it.