Professional Documents
Culture Documents
Step Toconfig Dataguard in 11.2.01
Step Toconfig Dataguard in 11.2.01
Skip to content
Home
About Us
Contact Us
Privacy Policy
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.
Primary server configuration
o CentOS 6.5
o Server name: pr
o IP: 192.168.17.131
o Oracle 11g software plus oracle instance.
o Oracle SID/Global_name: RTS
o Oracle db_unique_name: RTS
Secondary server configuration
o CentOS 6.5
o Server name: dr
o IP: 192.168.17.132
o Oracle 11g software only.
o Oracle SID/Global name: RTS
o 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.
<Step – 2 >
Enable force logging with the help of following SQL command:
<Step – 3 >
Verify initialization parameters db_name and db_unique_name on primary, In my case those are
set to: RTS
<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.
ALID_FOR=(ONLINE_LOGFILES,PRIM
ARY_ROLE) DB_UNIQUE_NAME=rtsdr
Enable LOG_ARCHIVE_DEST_2:
<Step – 6 >
Set log_archive_format parameter as below:
log_archive_max_processes integer 30
<Step – 7 >
Set fal_server and fal_client parameter for primary database:
SQL> alter system set fal_server=RTSDR;
<Step – 8 >
Configure listener file and copy it to DR @ location:
/u01/app/oracle/product/11.2.0/dbhome_1/network/admin
Listener file:
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = RTS)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
(SID_NAME = RTS)
))
LISTENER =
(DESCRIPTION =
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
Copyright (c) 1997, 2009, Oracle. All rights reserved.
/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/sqlnet.ora
OK (20 msec)
<Step – 10 >
Backup primary database via RMAN backup utility:
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
<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>
Copy parameter file to DR @ location: /u01/app/oracle/product/11.2.0/dbhome_1/dbs/
[oracle@pr bkup]$ scp initRTS.ora oracle@192.168.17.132:/u01/app/oracle/product/11.2.0/dbhome_1/dbs/
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>
Create spfile from pfile:
<Step – 17>
Start listener on standby:
<Step – 18>
Create follwoing directories on DR server, in case those are not available:
/u01/app/oracle/admin/RTS/adump
/u01/app/oracle/flash_recovery_area
<Step – 19>
Restore and recover database @ DR with RMAN backup utility.
RMAN> list backup of database summary;
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.
Note: Create one additional standby redolog file on both.
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE nodelay DISCONNECT FROM
SESSION;
<Step – 22>
After graceful completion of above apply process, verify archive logs on Primary as well as DR.
On Primary:
SQL> archive log list;
On Standby:
SQL> archive log list;
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:
SQL> archive log list;
OR
SQL> select max(sequence#) from v$archived_log;
MAX(SEQUENCE#)
--------------
20
On Standby:
SQL> archive log list;
OR
SQL> select max(sequence#) from v$archived_log;
MAX(SEQUENCE#)
--------------
20
On Primary:
SQL> select name,open_mode,database_role from v$database;
On DR:
SQL> select name,open_mode,database_role from v$database;
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#;
DEST_NAME
--------------------------------------------------------------------------------
STATUS ERROR
--------- -----------------------------------------------------------------
LOG_ARCHIVE_DEST_2
VALID
OR
SQL> select message from v$dataguard_status;
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.
Protection Mode:
Default protection mode of newly configured standby database would be maximum performance
mode.
There are 3 protection modes: Maximum Availability, Maximum Performance and
Maximum Protection. for more information, click me.
By above mentioned steps you can configure Data Guard in your environment, Stay tune with
my next article about Data Guard Switch Over and Switch Back steps.
Share this:
inShare
How to configure the archivelog deletion policy using RMAN.After configuring dataguard i’m facing
space issue for the archive location.
In Primary DB,
CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON ALL STANDBY;
Will this delete the log file right after it is applied in standby.Or will it wait for the space to fillup and once
FRA is full,then only it’ll free up the space?.How does this thing works.