Friday, August 15, 2008

Read / Write test on Dataguard Standby using Flashback

# On the primary database defer log shipping
ALTER SYSTEM ARCHIVE LOG CURRENT;
ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_2=DEFER;
SELECT TO_CHAR(CURRENT_SCN) FROM V$DATABASE;

# on the standby enable flashback and disable recovery
ALTER SYSTEM SET DB_RECOVERY_FILE_DEST_SIZE=20G;
ALTER SYSTEM SET DB_RECOVERY_FILE_DEST='/oraarch1';
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
create restore point before_start guarantee flashback database;
ALTER DATABASE ACTIVATE STANDBY DATABASE;
ALTER DATABASE OPEN;

# Run read/write test on opened standby database.

# flashback and switch back to physical standby
STARTUP MOUNT FORCE;
flashback database to restore point before_start;
drop restore point before_start;
ALTER DATABASE CONVERT TO PHYSICAL STANDBY;
STARTUP MOUNT FORCE;
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT;

# on the primary database enable log shipping
ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_2=ENABLE;