# 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.

<span style="font-family: Arial, sans-serif;"><span style="font-size: small;">The environment used is as follows:</span></span>

<span style="font-family: Arial, sans-serif;"><span style="font-size: small;">Primary   
</span></span><span style="font-family: Arial, sans-serif;"><span style="font-size: small;">Windows 7 64 bit  
</span></span><span style="font-size: small;">11g Release 2  
</span><span style="font-family: Arial, sans-serif;"><span style="font-size: small;">DB\_UNIQUE\_NAME=</span></span><span style="font-family: Arial, sans-serif;"><span style="font-size: small;">orcl</span></span>

<span style="font-family: Arial, sans-serif;"><span style="font-size: small;">Active Standby   
</span></span><span style="font-family: Arial, sans-serif;"><span style="font-size: small;">Oracle Enterprise Linux 5.7 64 bit  
</span></span><span style="font-family: Arial, sans-serif;"><span style="font-size: small;">11g Release 2  
</span></span><span style="font-family: Arial, sans-serif;"><span style="font-size: small;">DB\_UNIUE\_NAME=</span></span><span style="font-family: Arial, sans-serif;"><span style="font-size: small;">orcl\_dr</span></span>

- 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
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
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
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.
```