As a DBA, many time We need to make some tests on our databases(such as performance, load test etc… ) Many times its very hard to create same setup to get correct result for our tests.

For this purpose Oracle database can support Guaranteed Restore points feature . And now If you have dataguard system than you can use also snapshot standby database feature for your test purposes.

We can convert existing physical standby database to snapshot standby database which is as close as to the production database.  Snapshot standby database can  be open in write/open mode.

After related tests have been done,We can  convert snapshot standby database to physical standby database easily in minutes.

What Is a Snapshot Standby Database?
A snapshot standby database is a fully updateable standby database created by converting a physical standby database into a snapshot standby database.

A snapshot standby database receives and archives, but does not apply, redo data from a primary database. The redo data received from the primary database is applied once a snapshot standby database is converted back into a physical standby database, after discarding all local updates to the snapshot standby database.
A snapshot standby can be created from Enterprise Manager, the Data Guard Broker command-line interface (DGMGRL) or from SQL*Plus.

In this case I will use SQL*Plus

Step A:.
On Primary db stop log apply:

primarydb> ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_2=DEFER SID='*' scope=spfile;
System altered.

On Standby db :

standby> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
Database altered.

Step B:
Follow below steps on standby db:

standby> SHUTDOWN IMMEDIATE;
standby> STARTUP MOUNT;
standby> ALTER DATABASE FLASHBACK ON; 
standby> ALTER DATABASE CONVERT TO SNAPSHOT STANDBY;

PS: You can also create restore point in this steps..Its optional

standby> CREATE RESTORE POINT GUARANTEE_POINT GUARANTEE FLASHBACK DATABASE;
SQL> select open_mode from v$database;
OPEN_MODE
--------------------
MOUNTED

SQL> alter database open;
Database altered.

SQL> select open_mode from v$database;
OPEN_MODE
--------------------
READ WRITE

Step C:
Do your test on Snapshot standby database

Step D:
Convert snapshot standby database to physical standby database.

standby> ALTER DATABASE CONVERT TO PHYSICAL STANDBY; 
ERROR at line 1:
ORA-01126: database must be mounted in this instance and not open in any instance
standby> SHUTDOWN IMMEDIATE;

standby> STARTUP MOUNT;
standby> ALTER DATABASE CONVERT TO PHYSICAL STANDBY; 
standby> ALTER DATABASE FLASHBACK OFF;

SQL> ALTER DATABASE FLASHBACK OFF;
ALTER DATABASE FLASHBACK OFF
*
ERROR at line 1:
ORA-01507: database not mounted


SQL> select open_mode from v$database;
select open_mode from v$database
 *
ERROR at line 1:
ORA-01507: database not mounted

SQL> alter database mount;
alter database mount
*
ERROR at line 1:
ORA-00750: database has been previously mounted and dismounted

SQL> shutdown immediate;
ORA-01507: database not mounted


SQL> startup mount;
ORACLE instance started.

SQL> ALTER DATABASE FLASHBACK OFF; 
Database altered.

Step D:
Check parameters Kontroller yapılır

SQL> select database_role from v$database;

DATABASE_ROLE
----------------
PHYSICAL STANDBY
On Primary db:
primary> ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_2=ENABLE SID='*' scope=spfile;
System altered.
On Standby db
standby> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT;
Reklam