Академический Документы
Профессиональный Документы
Культура Документы
Here in this article I am going to cover steps by step approach to configure Oracle 11g Data Guard Physical
Standby.
In my case, Ingredients to simulate Physical Standby data guard environment are as below:
• 2 VM’s, Primary and DR with enough CPU and RAM in order to run oracle database.
CentOS 6.5
Server name: pr
IP: 192.168.17.131
Oracle 11g software plus oracle instance.
Oracle SID/Global_name: RTS
Oracle db_unique_name: RTS
CentOS 6.5
Server name: dr
IP: 192.168.17.132
Oracle 11g software only.
Oracle SID/Global name: RTS
Oracle db_unique_name: RTSDR
Note:
• Oracle version on Primary and secondary should be identical. i.e. In my case it’s 11.2.0.1.0
• db_unique_name on standby and primary database should be different in order to used in DG_CONFIG
setting of the LOG_ARCHIVE_CONFIG parameter.
• Primary and DR server should ping each other by IP as well as its server name. In order to ping with its
server name, edit /etc/hosts file accordingly.
Primary Server Configurations:
<Step – 1 >
<Step – 2 >
<Step – 3 >
Verify initialization parameters db_name and db_unique_name on primary, In my case those are set to:
RTS
SQL> show parameter db_name
<Step – 4 >
Issue following command to set LOG_ARCHIVE_CONFIG parameter for data guard config.
<Step – 5 >
Issue following to set LOG_ARCHIVE_DEST_2, In my case i have used flash recovery area for
remote archive log destination.
<Step – 6 >
log_archive_max_processes integer 30
<Step – 8 >
Listener file:
ADR_BASE_LISTENER = /u01/app/oracle
<Step – 9 >
Entries for the primary and standby databases are needed in the
“$ORACLE_HOME/network/admin/tnsnames.ora” files on both the servers.
RTS =
(DESCRIPTION =
(ADDRESS_LIST =
(CONNECT_DATA =
(SERVICE_NAME = RTS)
(GLOBAL_NAME = RTS)
(UR=A)
))
RTSDR =
(DESCRIPTION =
(ADDRESS_LIST =
(CONNECT_DATA =
(SERVICE_NAME = RTS)
(GLOBAL_NAME = RTS)
(UR=A)
))
TNS Ping Utility for Linux: Version 11.2.0.1.0 - Production on 03-OCT-2014 06:04:09
/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/sqlnet.ora
OK (10 msec)
TNS Ping Utility for Linux: Version 11.2.0.1.0 - Production on 03-OCT-2014 06:04:15
/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/sqlnet.ora
OK (20 msec)
<Step – 10 >
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
<Step – 11>
<Step – 12>
Create pfile from spfile:
<Step – 13>
After creating parameter file as above, edit following changes in newly created pfile:
*.db_unique_name='RTSDR'
*.fal_server='RTS';
<Step – 14>
Edit DR database listener file with host name. ( i.e. (HOST = dr))
Set following environment variable as oracle user OR edit those in /home/oracle/.bash_profile in order to set it for
every time while oracle user logged in:
export ORACLE_SID=RTS
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
export PATH=$PATH:/u01/app/oracle/product/11.2.0/dbhome_1/bin
Database mounted.
<Step – 16>
<Step – 17>
<Step – 18>
/u01/app/oracle/admin/RTS/adump
/u01/app/oracle/flash_recovery_area
<Step – 19>
List of Backups
===============
Note: Recovery of database would be failed with RMAN-06054 error, We can ignore it because RMAN will ask for
unknown archive log ( i.e. next archive log sequence, i.e. 10 ) who is not also available on Primary database.
Error log: RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 10 and
starting SCN of 1009554
<Step – 20>
Create standby redolog file to Primary and DR for the user of switch over, It should be match the configuration of
the primary server.
<Step – 21>
<Step – 22>
After graceful completion of above apply process, verify archive logs on Primary as well as DR.
On Primary:
On Standby:
By above result, archive logs on both the databases are in sync now.
To test your data guard configuration, generate archive logs on primary site and verify it on DR site:
SQL> alter system switch logfile; //Give this command multiple times for testing.
On Primary:
OR
MAX(SEQUENCE#)
--------------
20
On Standby:
OR
MAX(SEQUENCE#)
--------------
20
On DR:
You can also verify total number of log sequence generated and applied on DR site, by below SQL query:
FROM v$archived_log
ORDER BY sequence#;
In case of you are facing any kind of error than following SQL query will help you to diagnose it.
DEST_NAME
--------------------------------------------------------------------------------
STATUS ERROR
--------- -----------------------------------------------------------------
LOG_ARCHIVE_DEST_2
VALID
OR
Note: This command will give you appropriate message about the dataguard current status.
By default, for a newly created standby database, the primary database is in maximum performance mode.
Oracle 11g Data Guard Switchover and Switchback – Active Data Guard Part-II
After configuring data guard, databases would be either primary and standby database role, and we can altered
these roles without loss of data or without resetting logs. called switchover and switch back.
Switchover:
Before performing switchover, kindly verify the state of data guard on both the instances by following SQL queries:
FROM v$archived_log
ORDER BY sequence#;
...
...
DEST_NAME
--------------------------------------------------------------------------------
STATUS ERROR
--------- -----------------------------------------------------------------
LOG_ARCHIVE_DEST_2
VALID
Note: This command will give you appropriate message about the data guard current status.
After getting confirmation on data guard smooth activity, we can instantiate switchover activity by issuing
following sort of commands:
On Primary database:
Step-1>>
Database altered.
Step-2>>
Step-3>>
Database altered.
SQL> alter database recover managed standby database disconnect from session;
Database altered.
On Standby database:
Step-4>>
Step-5>>
Database altered.
Database dismounted.
Step-6>>
Startup old standby database as primary database:
SQL> startup
Database mounted.
Database opened.
Switch over activity have completed successfully, our old primary database has become standby and old standby
database has become primary database.
Note
To test above switchover activity, generate multiple archive logs on primary database and verify those archive logs
being transferred on standby database.
Switchback: