DEV Community

Vahid Yousefzadeh
Vahid Yousefzadeh

Posted on

FAR SYNC Data Guard

One of the new features introduced in Oracle 12c is FAR SYNC Data Guard, which has some similarities to a cascaded standby configuration.

With this feature, you can use a third machine (or server) that acts as an intermediary between the primary and the standby database. Redo data is sent from the primary database to this intermediate server, and from there it is forwarded to the actual standby database.

Using this capability reduces the workload on the primary database when multiple standby databases exist. Additionally, if there are network issues between the primary and the standby database, this feature can be highly beneficial.

The FAR SYNC instance contains a control file, pfile, password file, and standby redo log files. It does not include data files. Archive logs are also created on this server, and the instance always remains in MOUNT mode.

Become a member
Below are the implementation steps for configuring FAR SYNC.

Step 1: Configure Parameters on All Three Databases

Primary Database Parameters

*.db_unique_name=test

*.log_archive_config=’DG_CONFIG=(test,usef_stb,far)’;

*.log_archive_dest_2=’service=far SYNC AFFIRM alternate=log_archive_dest_3 db_unique_name=far’

*.log_archive_dest_3=’service=usef_stb ASYNC max_failure=1 alternate=log_archive_dest_2 db_unique_name=usef_stb’

*.log_archive_dest_state_3=alternate
Enter fullscreen mode Exit fullscreen mode

FAR SYNC Instance Parameters

*.db_unique_name=far

*.log_archive_config=’DG_CONFIG=(test,usef_stb,far)’;

*.log_archive_dest_2=’service=usef_stb ASYNC db_unique_name=usef_stb’;

*.fal_server=test;

*. control_files=’/u01/far.ctl’
Enter fullscreen mode Exit fullscreen mode

Standby Database Parameters

*.db_unique_name=usef_stb
*.log_archive_config='DG_CONFIG=(test,usef_stb,far)'
*.fal_server=far,test
Enter fullscreen mode Exit fullscreen mode

Step 2: Configure tnsnames.ora

far =

  (DESCRIPTION =

    (ADDRESS = (PROTOCOL = TCP)(HOST = 10.22.136.4)(PORT = 1521))

    (CONNECT_DATA =

      (SERVER = DEDICATED)

      (sid = far)))

USEF_STB =

  (DESCRIPTION =

    (ADDRESS = (PROTOCOL = TCP)(HOST = 10.22.136.6)(PORT = 1521))

    (CONNECT_DATA =

      (SERVER = DEDICATED)

      (sid= usef_stb)))

TEST =

  (DESCRIPTION =

    (ADDRESS = (PROTOCOL = TCP)(HOST = 10.22.137.82)(PORT = 1521))

    (CONNECT_DATA =

      (SERVER = DEDICATED)

      (sid = test)))
Enter fullscreen mode Exit fullscreen mode

Step 3: Create the FAR SYNC Control File on the Primary and Transfer It

Execute on the primary:

alter database create far sync instance controlfile as ‘/u01/far.ctl’;
Enter fullscreen mode Exit fullscreen mode

After transferring the control file to the FAR SYNC server, mount the instance:

SQL> startup mount force;

Total System Global Area 1.2684E+10 bytes

Fixed Size                  3724928 bytes

Variable Size            2013268352 bytes

Database Buffers         1.0637E+10 bytes

Redo Buffers               29827072 bytes

Database mounted.
Enter fullscreen mode Exit fullscreen mode

Note:
If you attempt to open the database, you will receive the following error:

ORA-16476: far sync instance does not allow Open operation
Enter fullscreen mode Exit fullscreen mode

Step 4: Add Standby Redo Log Groups to the FAR SYNC Instance

alter database add standby logfile group 20 size 100m;

alter database add standby logfile group 21 size 100m;
Enter fullscreen mode Exit fullscreen mode

Check the database role:

SQL> select database_role from v$database;

DATABASE_ROLE
-------------
FAR SYNC
Enter fullscreen mode Exit fullscreen mode

Important:
The password file from the primary must be copied to the standby and the FAR SYNC server — or recreated with the same credentials.

Step 5: Create the Standby Database

Use RMAN to create the standby from the primary:

rman target sys/sys@test  auxiliary sys/sys@usef_stb

duplicate target database for standby from active database nofilenamecheck;
Enter fullscreen mode Exit fullscreen mode

Add standby redo logs on the standby:

alter database add standby logfile group 25 size 100m;

alter database add standby logfile group 26 size 100m;
Enter fullscreen mode Exit fullscreen mode

Start apply:

ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE;

Enter fullscreen mode Exit fullscreen mode

Check the role:

SQL> select database_role  from v$database;

DATABASE_ROLE

—————-

PHYSICAL STANDBY
Enter fullscreen mode Exit fullscreen mode

Step 6: Configure Data Guard Broker

Enable broker on all three databases:

alter system set dg_broker_start=true;
Enter fullscreen mode Exit fullscreen mode

Then configure in DGMGRL:

dgmgrl /

DGMGRL>  CREATE CONFIGURATION hamsandb AS  PRIMARY DATABASE IS test  CONNECT IDENTIFIER IS test;

Configuration “hamsandb” created with primary database “test”

DGMGRL> ADD DATABASE usef_stb AS CONNECT IDENTIFIER IS usef_stb;

Database “usef_stb” added

DGMGRL>  ADD FAR_SYNC far AS CONNECT IDENTIFIER IS far;

far sync instance “far” added

DGMGRL> enable configuration;

DGMGRL> edit database test set property redoroutes='(local:far sync)’;

Property “redoroutes” updated

DGMGRL> edit far_sync far set property redoroutes='(test:usef_stb)’;

Property “redoroutes” updated

DGMGRL> enable far_sync far;

Enabled.

DGMGRL>  show configuration;

Configuration – hamsandb

  Protection Mode: MaxPerformance

  Members:

  test    – Primary database

    far     – Far sync instance

      usef_stb – Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:

SUCCESS   (status updated 54 seconds ago)
Enter fullscreen mode Exit fullscreen mode

Top comments (0)