Thursday, 3 November 2022

How to create restore points for PDB and perform flashback at PDB level and when flashback is off

select * from database_properties where property_name='LOCAL_UNDO_ENABLED';

PROPERTY_NAME PROPERTY_VALUE

-------------------- ---------------

LOCAL_UNDO_ENABLED TRUE 



SQL> alter session set container=CDB$ROOT;

SQL> create restore point test2 for pluggable database hdprd;

SQL> create restore point test3 for pluggable database hdprd guarantee flashback database;


SQL> select NAME,TIME,SCN,PDB_RESTORE_POINT,GUARANTEE_FLASHBACK_DATABASE from V$RESTORE_POINT;

NAME                                     TIME                                            SCN PDB GUA

---------------------------------------- ---------------------------------------- ---------- --- ---

TEST3                                    03-NOV-22 02.10.11.000000000 PM             4706851 YES YES

TEST2                                    03-NOV-22 01.42.15.000000000 PM             4699251 YES NO


RMAN> list restore point all;


using target database control file instead of recovery catalog

SCN              RSP Time  Type       Time      Name

---------------- --------- ---------- --------- ----

4699251                               03-NOV-22 TEST2

4706851                    GUARANTEED 03-NOV-22 TEST3

if it using local undo

SQL> alter pluggable database hdprd close;

SQL> flashback pluggable database hdprd to restore point TEST2;

SQL> alter pluggable database test2 open resetlogs;


if it shared undo and restore point created when pdb was open;

RMAN> alter pluggable database hdprd close;

RMAN> flashback pluggable database hdprd to restore point TEST2 auxiliary destination '/U01/app/oracle/';

RMAN> alter pluggable database HDPRD open resetlogs;


SQL> alter pluggable database hdprd close;

SQL> flashback pluggable database hdprd to clean restore point TEST1;

SQL> alter pluggable database hdprd open resetlogs;


if flashback is off then we can restore only with guarantee flashback:

SQL> alter pluggable database hdprd close immediate instances=all;

RMAN> flashback pluggable database hdprd to restore point TEST3 auxiliary destination '+RECO_01';

RMAN> alter pluggable database hdprd open resetlogs;

once it is up ,drop the old restore point and create a new restore point then start the services




 







No comments:

Post a Comment

Featured post

duplicate db from standy to other server

 Duplicate Testuat   $ export ORACLE_SID=Testuat3 $ sqlplus '/as sysdba' Testuat3 SQL> alter system set cluster_database=FALSE sc...