Pages

Use Standby for read/write and then revert back to standby again using flashback


Use Standby for read/write  and then revert back to standby again using flashback



Standby database : Note and create restore point
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
select flashback_on from v$database;
alter database recover managed standby database cancel;
create restore point before_switch_to_primary guarantee flashback database;
select scn,name,time from v$restore_point;
archive log list;


Primary database : Defer the logs to standby server.Ensure logs are not  deleted before standby database is restored again
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
select current_scn from v$database;
archive log list;
alter system archive log current;
alter system set log_archive_dest_state_2=defer;



Standby database : Activate and then use it for testing/reporting for days/weeks , independent of the primary database.  
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alter database activate standby database;
startup mount force;
ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PERFORMANCE;
alter database open;
archive log list;



Standby database : Make it standby again and sync with primary from previous restore point onwards
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
startup force mount
select name,scn,time from v$restore_point;
flashback database to restore point BEFORE_SWITCH_TO_PRIMARY;  -- from above query
alter database convert to physical standby ;
startup mount force;
alter database recover managed standby database disconnect;