Far Sync (Oracle 12c New Feature)

Cyrille Modiano

OCP Oracle DBA in Montreal at DBSoft

Latest posts by Cyrille Modiano (see all)


Oracle Far Sync is an Oracle 12c new feature for Oracle Data Guard. This feature is meant to resolve the performance problems induced by network latency when you maintain a standby database geographically distant of the primary database. In this type of situation you sometimes have to make a compromise between performance and data loss. The Far Sync feature offer you both.

How does Far Sync works ?

The principe is fairly simple, the Far Sync instance receive data synchronously from the primary database and then forward it asynchronously to up de 29 remote destinations.

Data Guard Far Sync

The far sync database is not a standard database, it only contains a specific controlfile, a spfile and standby redologs. This database must be placed near the primary database to guarantee an optimal network latency during synchronous replication. But be careful, don’t place this database on the same geographical place than the primary, because if your primary database experiences a geographical disaster, your Far Sync will be impacted too, and some data could be lost.

In case of an outage on the primary database, the standard failover procedure applies and the far sync instance guarantee that no data is lost during the failover.

Configuration for the test

HOSTS : 3 Virtual Machines with 2 GB of Memory
OS : Oracle Linux 6.4
ORACLE VERSION : Oracle 12.1.0.1 Enterprise Edition

SERVER NAME ROLE
SVR-ORA-03 PRIMARY SERVER
SVR-ORA-04 FAR SYNC SERVER
SVR-ORA-05 STANDBY SERVER

Standby database creation

I created a standby database using following script on host SVR-ORA-05

and added the standby redologs as follow

My standby is ready, Next we will create the Far Sync Instance.

Far Sync instance creation

We need to create a specific controlfile and a pfile from our primary database.

First, create the controlfile for the Far Sync instance using the following command

then create a pfile from the primary spfile that we will use for the Far Sync instance.

After that, we need to copy those files to the Far Sync server.

I edit the parameter file on the Far Sync server to change the control_files parameter

Then I create the needed directories, copy the controlfile to the right place and the parameter file to the oracle home:

Now, I need to create a spfile from my pfile, mount the database and create my standby redologs :

Our Far Sync instance is now ready for the configuration through Data Guard Broker.

Data Guard configuration

First be sure every database is configured with a listener and tnsnames on each server and has a reference for each other databases, here is my tnsnames.ora for all three servers:

I changed the db_unique_name of all my three databases.

PRIMARY:

FARSYNC:

STANDBY:

and restarted the databases.

I have to enable the dg_broker on all databases using the following command:

Once done I connect to dgmgrl on the primary server and create the configuration

Now we will enable the configuration

The configuration is enabled but far sync is not active, we need to configure redo and activate Far Sync

Now far sync is enabled, we changed the redo configuration to indicate to the primary database that redo should be forwarded to the Far Sync instance using synch mode.
We edited the Far Sync configuration to indicate that redo will be received from the primary database and then forwarded to the standby database.

Now we can change the protection mode from MaxPerformance to MaxAvailability to benefit from our Far Sync instance

That’s it, configuration is done.

Here are the LOG_ARCHIVE_DEST_n parameters from each database.

DATABASE LOG_ARCHIVE_DEST_1 LOG_ARCHIVE_DEST_2
PRIMARY location=USE_DB_RECOVERY_FILE_DEST, valid_for=(ALL_LOGFILES,ALL_ROLES) service=”db12ce_fs”, SYNC AFFIRM delay=0 optional compression=disable max_failure=0 max_connections=1 reopen=300 db_unique_name=”db12c_fs” net_timeout=30, valid_for=(online_logfile,all_roles)
FAR SYNC location=USE_DB_RECOVERY_FILE_DEST, valid_for=(ALL_LOGFILES,ALL_ROLES) service=”db12ce_standby”, ASYNC NOAFFIRM delay=0 optional compression=disable max_failure=0 max_connections=1 reopen=300 db_unique_name=”db12c_stby” net_timeout=30, valid_for=(standby_logfile,all_roles)
STANDBY location=USE_DB_RECOVERY_FILE_DEST, valid_for=(ALL_LOGFILES,ALL_ROLES)

Conclusion

Far Sync is a very good solution when your standby geographically distant from your primary and you can’t choose the MaxAvailaibility protection mode for performance reasons.
It is also possible with this solution to choose an alternate archive destination for primary database in the event of a failure on Far Sync instance, in this case the primary database will send the data directly to the standby database asynchronously.

email

Leave a Reply