11g Oracle DR Test

5
1. 2.Contents Access Testing: Purpose & Scope................................3 Access testing: Procedure......................................3 DR test procedure Oracle 11g databases.........................................3 Intended audience:........................................................... 3 Conventions used:............................................................ 3 Concepts:.................................................................... 3 Stop log shipping between primary and standby:...............................3 Shut down Primary database and configure standby:............................4 Start DR Oracle Database as primary:......................................... 5 Shut down DR standby database:............................................... 5 Restart the PROD Oracle DB as primary :...................................... 5 Activate Dataquard between Primary and Standby:..............................6 References..................................................... 6 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 1 of 5

description

DR test for 11g databases

Transcript of 11g Oracle DR Test

ContentsAccess Testing: Purpose & Scope3Access testing: Procedure3DR test procedure Oracle 11g databases3Intended audience:3Conventions used:3Concepts:3Stop log shipping between primary and standby:3Shut down Primary database and configure standby:4Start DR Oracle Database as primary:5Shut down DR standby database:5Restart the PROD Oracle DB as primary :5Activate Dataquard between Primary and Standby:6References6

Access Testing: Purpose & Scope

Steps to perform disaster recovery test for 11g databases, it makes use of snapshot standby feature of 11g, here we use activate snapshot standby database command which in turn will switch ON flashback where as in 10g we need to do it manually, DR test scenario is similar to previous versions, only change here is we are making using of new procedure to save standby rebuild time.

Oracle steps explained in detail below.

STOP PROD

Stop log shipping between primary and standby:

Login to PRIMARY:

a % cd ~/../../rc

a % ./${SERVICE}a d (ensure you dont have multiple databases running under same service)

a % sqlplus /as sysdba

SQL> alter system archive log current;

SQL> alter system switch logfile;

SQL> alter system switch logfile;

SQL> alter system set log_archive_dest_state_2=defer scope=both;

Shut down Primary database and configure standby:

PRIMARY:

a % ./${SERVICE}a stop (ensure you dont have multiple databases running under same service)

a % cd ~/../../etc

a % vi oratab lsnrtab

put N in the oratab and lsnrtab so nothing auto starts.

N.B. As the shutdown step reconfigure the standby to be a primary.

Otherwise if they are performing cluster reconfiguration (rather than just a dns rename) the services will automatically start.

STANDBY:

a % cd ~/../../rc

a % ./${SERVICE}a d (ensure you dont have multiple databases under same service)

Ensure all archives applied.

a % sqlplus /as sysdba

SQL > select thread# "APPL_THREAD#",sequence# "APPL_SEQUENCE#" from v$archived_log

where recid in (select max(recid) from v$archived_log

where applied='YES'

and resetlogs_id = (select resetlogs_id from v$database_incarnation where status='CURRENT')

group by thread#

)

order by thread#;

Pre requisite for snapshot standby setup is to have flash recovery area and its not mandatory to switch on flashback.

1) Configure flash recovery area as given below

a) Set the size for recovery area, as part of the DR test app teams will do basic testing so usage will be very very less, if available assign 10g otherwise 5g should also be OK.

SQL > Alter system set db_recovery_file_dest_size=10g scope=both;

b) Set Flash recovery area.

Ensure you have flash recovery area else create one using below.

mkdir $ORACLE_ADMIN/flash

Use this location to create flash recovery destination example one is below.

Note please modify directory structure below accordingly

SQL > alter system set db_recovery_file_dest='/app/gors004/01/admin/GORS004T/flash' scope=both;

2) Stop managed recovery if it is active.

SQL > Alter database recover managed standby database cancel;

3) Convert physical standby database to snapshot standby database.

SQL > ALTER DATABASE CONVERT TO SNAPSHOT STANDBY;

SQL > SELECT flashback_on FROM v$database;

FLASHBACK_ON

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

RESTORE POINT ONLY

An implicit guaranteed restore point is created when a physical standby database is converted into a snapshot standby database and this restore point is used to flashback a snapshot standby to its original state when it is converted back into a physical standby database.

Set job_queue_processes and aq_tm_processes to 0 as we need to ensure unwanted jobs and queues are not running. (Optional discuss with app team)

4) The database is dismounted during conversion and must be restarted.

SQL > Shut immediate;

SQL > Startup;

(Below is optional step discuss with app team)

Verify value of job_queue_processes and aq_tm_processes once again, these values can be reset once dblinks are recreated and correctly configured

5) Once the database is restarted any transaction can be executed.

SQL> select open_mode, database_role from v$database;

OPEN_MODE DATABASE_ROLE

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

READ WRITE SNAPSHOT STANDBY

6) On standby change host name in local_listener parameter

SQL> alter system set local_listener='(address=(protocol=tcp)(host=oorp038a.eu.unilever.com)(port=16572))' scope=both;

7) Finally stop standby services modify configuration files.

a % ./${SERVICE}a stop (ensure you dont have multiple databases under same service)

a % cd ~/../../etc

a % cp /app/${SERVICE}/01/etc/${SERVICE}a.definitions /app/${SERVICE}/01/etc/${SERVICE}a.definitions.orig

vi the ~/../../etc/${SERVICE}a.definitions file and remove the references to_stby

export GORS004A_START[1]=dbstart_stby -> change to export GORS004A_START[1]=dbstart

export GORS004A_STOP[0]=dbshut_stby -> change to export GORS004A_STOP[0]=dbshut

export SERVICE_NAME=gors804a -> change to export SERVICE_NAME=gors004a

a % cp /app/${SERVICE}/01/etc/listener.ora /app/${SERVICE}/01/etc/listener.ora.orig

a % vi /app/${SERVICE}/01/etc/listener.ora

Change host name for example change gors804.eu.unilever.com to gors004a.eu.unilever.com

before unix team task logout from all your opened sessions on primary and standby (least case Unix guy will kill your sessions)

Activate DR

Shutdown HACMP resources for prod AIX-cluster and reconfigure on DR AIX-Cluster UNIX task

Start DR Oracle Database as primary:

You just need to check it has come up and is available.

Business Process testing App team

Realign PROD services

Shut down DR standby database:

Standby: stop the services put N in the oratab and lsnrtab so nothing auto starts.

1) Shutdown the snapshot standby database.

SQL > Shut immediate

2) Bring the database to the mount stage.

SQL > startup mount

3) Issue the command

SQL > ALTER DATABASE CONVERT TO PHYSICAL STANDBY;

4) Shutdown the database and mount it.

SQL > shut immediate

SQL > startup nomount

SQL > alter database mount standby database;

SQL > select open_mode, database_role from v$database;

OPEN_MODE DATABASE_ROLE

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

MOUNTED PHYSICAL STANDBY

5) alter system set local_listener='(address=(protocol=tcp)(host=gors804a.eu.unilever.com)(port=16572))' scope=both;

6) shutdown the database & listener (ensure there are no multiple databases under same service)

7) restore old definitions file & revert changes from listener.ora (host name)

Restore HACMP resources for DR AIX cluster and reconfigure on PROD AIX cluster - UNIX task

Restart the PROD Oracle DB as primary :

Standby: put Y in the oratab and lsnrtab

1) start listener

a % $lsnrctl start (in case if you have stopped)

2) start database

SQL > startup nomount

SQL > alter database mount standby database;

PRIMARY: put Y in the oratab and lsnrtab

3) start listener

a % $lsnrctl start (in case if you have stopped)

4) start database

SQL>startup mount

SQL> alter system set log_archive_dest_state_2=enable scope=both; (database is in maximum availability mode hence this has to be enabled first)

SQL> alter database open;

Activate Dataquard between Primary and Standby:

Standby:

start recovery

SQL > alter database recover managed standby database disconnect;

References

4 of 4