HA niveau 2 - Oracle 11g Cross platform Active Standby - Windows Primary database and Linux Active Standby
This note describes the procedure of configuring a cross platform using the 11g RMAN Active Duplicate as well as an Active Standby Database setup over a Windows and Linux platform.
The Metalink note Data Guard Support for Heterogeneous Primary and Physical Standbys in Same Data Guard Configuration [ID 413484.1] describes the supported cross platform combinations between a primary and standby database.
The environment used is as follows:
Primary
Windows 7 64 bit
11g Release 2
DB_UNIQUE_NAME=orcl
Active Standby
Oracle Enterprise Linux 5.7 64 bit
11g Release 2
DB_UNIUE_NAME=orcl_dr
- Add static entry in listener.ora
(SID_DESC =
(GLOBAL_DBNAME =orcl_dr)
(ORACLE_HOME =/u02/app/oracle/product/11.2.0/dbhome_1 )
(SID_NAME =orcl_dr)
)
-
Reload listener or stop and start listener
-
Add entries in tnsnames.ora on both source and target
ORCL_DR=
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = linux01.gavinsoorma.com)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl_dr)
)
)
ORCL =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = gavin-pc)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl)
)
)
-
Create password file on target - ensure same password is used the primary database password file
-
Create directory for audit _file_dest
-
Create directory for database files
On the Windows server the datafile location is C:\ORADATA|ORCL. On the Linux machine the corresponding location is '/u01/oradata/orcl_dr'
-
Create directory for log_archive_dest_1 - '/u01/oradata/orcl_dr/arch/'
-
Create init.ora in $ORACLE_HOME /dbs location with one entry
*.DB_NAME=orcl_dr
-
STARTUP NOMOUNT the standby database
-
This is the RMAN command used to create a Duplicate from Active Database :
(Note the db_file_name_convert and log_file_name_convert parameters)
DUPLICATE TARGET DATABASE
FOR STANDBY
FROM ACTIVE DATABASE
NOFILENAMECHECK
DORECOVER
SPFILE
SET DB_UNIQUE_NAME="orcl_dr"
SET AUDIT_FILE_DEST="/u02/app/oracle/admin/orcl_dr/adump"
SET DIAGNOSTIC_DEST="/u02/app/oracle"
SET LOG_ARCHIVE_DEST_2="service=orcl_dr LGWR SYNC REGISTER VALID_FOR=(online_logfile,primary_role)"
SET FAL_SERVER="orcl_dr"
SET FAL_CLIENT="orcl"
SET CONTROL_FILES='/u01/oradata/orcl_dr/control01.ctl','/u01/oradata/orcl_dr/control02.ctl','/u01/oradata/orcl_dr/control03.ctl'
SET DB_FILE_NAME_CONVERT='C:\ORADATA\ORCL\','/u01/oradata/orcl_dr/'
SET LOG_FILE_NAME_CONVERT='C:\ORADATA\ORCL\','/u01/oradata/orcl_dr/';
Note - the mistake I made here was not setting the parameters LOG_ARCHIVE_DEST_1 and LOG_ARCHIVE_FORMAT in the above RMAN Duplicate script
That is why we will see archive log files being created on the target like :
/u02/app/oracle/product/11.2.0/dbhome_1/dbs/c:oradataorclarchARC0000000005_0765492451.0001
So, remember to add SET LOG_ARCHIVE_DEST_1 and SET LOG_ARCHIVE_FORMAT for correct paths and names.
-
From the Primary database run the following command :
c:\app\gavin\product\11.2.0\dbhome_2\BIN>rman target sys/oracle11g auxiliary sys/oracle11g@orcl_dr
- ON PRIMARY
SQL> alter system set standby_file_management=AUTO scope=both;
System altered.
SQL> alter system set fal_server=orcl scope=both;
System altered.
SQL> alter system set fal_client=orcl_dr scope=both;
System altered.
SQL> alter system set LOG_ARCHIVE_DEST_2='SERVICE=orcl_dr LGWR SYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) NET_TIMEOUT=60 DB_UNIQUE_NAME=orcl_dr' scope=both;
- ON STANDBY
SQL> alter system set LOG_ARCHIVE_DEST_1='LOCATION=/u01/oradata/orcl_dr/arch VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=orcl_dr';SQL>
System altered.
SQL> alter system set LOG_ARCHIVE_DEST_2='SERVICE=orcl LGWR SYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=orcl' scope=both;
System altered.
-
Shutdown and open the Standby database and configure the Real Time Apply (Active Data Guard)
SQL> shutdown immediate;
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
SQL> startup;
ORACLE instance started.
Total System Global Area 835104768 bytes
Fixed Size 2217952 bytes
Variable Size 230688800 bytes
Database Buffers 595591168 bytes
Redo Buffers 6606848 bytes
Database mounted.
Database opened.
SQL> recover managed standby database using current logfile disconnect;
Media recovery complete
SQL> select platform_name,open_mode from v$database;
PLATFORM_NAME OPEN_MODE
------------------------------------------------------------ --------------------
Linux x86 64-bit READ ONLY.