Configuring Data Guard in Heterogeneous Environment
With the release of Oracle database 11g, the primary and standby database in Data Guard
configuration can be created in cross-platform environment. They can have different operating
systems, os binaries (32/64 bit), oracle binaries (32/64 bit) and different CPU architecture.
Following is the step-by-step approach to create cross-plateform (AIX-Linux) DG configuration.
Environment:
The following table is the summary of Hardware, OS and Database configuration used:
Operaing System
Database
Hostname
Oracle SID
DB Unique Name
Service Name
ORACLE BASE
ORACLE HOME
Data Files
Primary
6 AIX-Based Systems (64-bit)
Oracle Database 11g
Enterprise Edition Release
[Link].0 - 64bit Production
Standby
Oracle Linux x86_64 5.5
Oracle Database 11g
Enterprise Edition Release
[Link].0 - 64bit Production
Orcl
Orcl
Orcl
orclstb
orclstb
orcl
Preparing the Primary Database
select name from v$database;
orcl
SQL> SELECT * FROM v$version;
BANNER
------------------------------------------------------------------------------Oracle Database 11g Enterprise Edition Release [Link].0 64bit Production
PL/SQL Release [Link].0 - Production
CORE
[Link].0
Production
TNS for IBM/AIX RISC System/6000: Version [Link].0 Production
NLSRTL Version [Link].0 - Production
STEP 1. Check if database is in ARCHIVELOG mode.
Since data guard is dependent on redo data to maintain standby database, the first step to make sure is
you are running database in Archive Log mode
If database is in NOARCHIVELOG mode, use the following step to bring it in ARCHIVELOG mode.
SQL> archive log list
Database log mode
Archive Mode
Automatic archival
Enabled
Archive destination
/u02/orcl/archive/
Oldest online log sequence
Next log sequence to archive 5
Current log sequence
STEP 2. Enable FORCE LOGGING
SQL> SELECT force_logging FROM v$database;
FOR
--NO
SQL> alter database force logging;
Database altered.
SQL> SELECT force_logging FROM v$database;
FOR
--YES
STEP 4. Add Standby Redo Log
Create standby log files on primary database. Standby Redo logs are used to store redo information
received from another database (in this case primary). SRL needs to be of the same size as online redo
logs (ORL). It is recommened to have one more SRL group than the online redo log.
select * from v$logfile;
+DATA/orcl/onlinelog/group_3.367.863944527
+DATA/orcl/onlinelog/group_2.366.863944527
+DATA/orcl/onlinelog/group_1.370.863944527
ALTER
ALTER
ALTER
ALTER
DATABASE
DATABASE
DATABASE
DATABASE
ADD
ADD
ADD
ADD
STANDBY
STANDBY
STANDBY
STANDBY
LOGFILE
LOGFILE
LOGFILE
LOGFILE
GROUP
GROUP
GROUP
GROUP
4
5
6
7
'+DATA'
'+DATA'
'+DATA'
'+DATA'
SIZE
SIZE
SIZE
SIZE
50M;
50M;
50M;
50M;
select * from v$logfile;
ONLINE
+DATA/orcl/onlinelog/group_3.367.863944527 NO
ONLINE
+DATA/orcl/onlinelog/group_2.366.863944527 NO
ONLINE
+DATA/orcl/onlinelog/group_1.370.863944527 NO
STANDBY
+DATA/orcl/onlinelog/group_4.318.863945307 NO
STANDBY
+DATA/orcl/onlinelog/group_5.319.863945307 NO
STANDBY
+DATA/orcl/onlinelog/group_6.271.863945307 NO
STANDBY
+DATA/orcl/onlinelog/group_7.323.863945307 NO
STEP 5. Add entries in the parameter file
SQL> create pfile from spfile;
File created.
Existing parameter:
orcl.__db_cache_size=905969664
orcl.__java_pool_size=16777216
orcl.__large_pool_size=33554432
orcl.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
orcl.__pga_aggregate_target=838860800
orcl.__sga_target=1258291200
orcl.__shared_io_pool_size=0
orcl.__shared_pool_size=285212672
orcl.__streams_pool_size=0
*.audit_file_dest='/u01/app/oracle/admin/orcl/adump'
*.audit_trail='db'
*.compatible='[Link].0'
*.control_files='+DATA/orcl/controlfile/current.371.863944525'
*.db_block_size=8192
*.db_create_file_dest='+DATA'
*.db_domain=''
*.db_name='orcl'
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=orclXDB)'
*.log_archive_dest_1='location=/u02/orcl/archive/'
*.memory_target=2097152000
*.open_cursors=300
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.undo_tablespace='UNDOTBS1'
Primary role/LOG parameter:
#Added Parameter
#Primary role related parameter incl. LOG_ARCHIVE parameter.
DB_UNIQUE_NAME=orcl
LOG_ARCHIVE_CONFIG='DG_CONFIG=(orcl,orclstb)'
LOG_ARCHIVE_DEST_2='SERVICE=orclstb LGWR ASYNC
VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=orclstb'
LOG_ARCHIVE_DEST_STATE_2=ENABLE
REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE
LOG_ARCHIVE_MAX_PROCESSES=5
Standby role parameter:
#Standby role related parameter
FAL_SERVER=orcl
FAL_CLIENT=orclstb
DB_FILE_NAME_CONVERT='+DATA/orcl/','+DATA/orclstb/'
LOG_FILE_NAME_CONVERT='+DATA/orcl/','+DATA/orclstb/'
STANDBY_FILE_MANAGEMENT=AUTO
Now create server parameter file from pfile and startup database using spfile.
SQL> create pfile from spfile;
File created.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> create spfile from pfile;
File created.
SQL> startup
ORACLE instance started.
Total System Global Area 2087780352 bytes
Fixed Size
2247952 bytes
Variable Size
1241514736 bytes
Database Buffers
Redo Buffers
838860800 bytes
5156864 bytes
Database mounted.
Database opened.
Prepare Standby Database
STEP 6. Prepare Standby
In order to connect to the standby database create a password file on the physical standby database
(using ORAPWD) with the same password used by primary SYS account.
[oracle@klbstbkt2 dbs]$ cd $ORACLE_HOME/dbs
[oracle@klbstbkt2 dbs]$
[oracle@klbstbkt2 dbs]$ orapwd file=orapworcl password=oracle_4U
Create an [Link] file for standby (support) database with a single parameter DB_NAME.
db_name=orcl
Set the OARCLE_SID variable and start the physical standby in NOMOUNT mode using parameter file.
[oracle@klbstbkt2 dbs]$ export ORACLE_SID=orcl
[oracle@klbstbkt2 dbs]$ sqlplus /nolog
SQL*Plus: Release [Link].0 Production on Tue Nov 18 [Link] 2014
Copyright (c) 1982, 2013, Oracle. All rights reserved.
SQL> conn /as sysdba
Connected to an idle instance.
SQL> startup nomount
ORACLE instance started.
Total System Global Area 342425600 bytes
Fixed Size
2253024 bytes
Variable Size
268439328 bytes
Database Buffers
Redo Buffers
67108864 bytes
4624384 bytes
Create the necessory directory for data file, Fast Recoovery area etc.
*.audit_file_dest='/u01/app/oracle/admin/orcl/adump'
[oracle@klbstbkt2 dbs]$ mkdir -p /u01/app/oracle/admin/orcl/adump
Oracle NET Configuration
STEP 7. Configure Oracle Net
Configure lisneters and service names on both the primary and standby so that they can communicate
with each other.
The following [Link] file on Primary Databse.
ADR_BASE_LISTENER_ORCL = /u01/app/oracle
LISTENER_ORCL =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = [Link])(PORT = 1521))
)
)
SID_LIST_LISTENER_ORCL =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = orcl)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1)
(SID_NAME = orcl)
)
)
The following [Link] file on Standby Databse.
ADR_BASE_LISTENER_ORCL = /u01/app/oracle
LISTENER_ORCL =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = [Link])(PORT = 1521))
)
)
SID_LIST_LISTENER_ORCL =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = orcl)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1)
(SID_NAME = orcl)
)
)
Add or update the following entry to the [Link] file on both machine.
orclstb =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = [Link])(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl)
)
)
orcl =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = [Link])(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl)
)
)
RMAN
STEP 8. Use RMAN to create standby database
run {
allocate channel prmy1 type disk format '/u03/backup/rman/%U';
allocate channel prmy2 type disk format '/u03/backup/rman/%U';
allocate channel prmy3 type disk format '/u03/backup/rman/%U';
allocate channel prmy4 type disk format '/u03/backup/rman/%U';
allocate auxiliary channel stby type disk format '/u03/backup/rman/%U';
duplicate target database for standby
from active database
spfile
set db_unique_name='orclstb'
set service_names=orcl
set control_files='+DATA'
set fal_client='orclstb'
set fal_server='orcl'
set log_archive_dest_2='service=orcl async
valid_for=(online_logfile,primary_role) db_unique_name=orcl'
dorecover
nofilenamecheck;
}