Wednesday, April 29, 2009

Flashback old primary database after dataguard failover.

# On new primary (old standby)
select to_char(standby_became_primary_scn) from v$database;

TO_CHAR(STANDBY_BECAME_PRIMARY_SCN)
----------------------------------------
32940869569

select scn_to_timestamp(32940869569) from dual;

SCN_TO_TIMESTAMP(32940869569)
----------------------------------------
28-APR-09 23.50.25.000000000

# On the old primary, flashback and start managed recovery:

select * from v$flashback_database_log;

OLDEST_FLASHBACK_SCN OLDEST_FLASHBACK_TIM RETENTION_TARGET FLASHBACK_SIZE ESTIMATED_FLASHBACK_SIZE
-------------------- -------------------- ---------------- -------------- ------------------------
32934668982 28-apr-2009 17:39:08 1440 8305770496 19973136384

shutdown immediate;
startup mount;
flashback database to scn 32940869569;
alter database convert to physical standby;
shutdown immediate;
startup mount;
alter database recover managed standby database using current logfile disconnect;