Hey there, fellow database enthusiasts! Today, we’re diving into a super cool feature introduced in Oracle 12c: Far Sync and so fat this is well utilized in various scenarios. We’ll walk through setting up a Far Sync instance in your Data Guard environment and integrating it with the broker. But first, let’s break down what a Far Sync instance is and why it’s awesome.
What’s a Far Sync Instance?
In Oracle versions before 12c, syncing a primary database with a standby database over large geographical distances could really slow things down. The transaction wouldn’t be considered complete until the standby acknowledged the redo changes, causing commit latency issues. Wouldn’t it be great if the primary database could ship redo data to a nearby dummy instance in sync mode, ensuring low latency, and then have that dummy instance asynchronously send the redo data to the standby? Enter Oracle 12c’s Far Sync instance!A Far Sync instance is a lightweight, geographically close destination that quickly receives redo data from the primary database in sync mode. It then ships this data to other standby databases in async mode, ensuring the primary’s commit latency isn’t affected. This instance only has a control file and standby redo logs, so it’s not burdened with user datafiles, making it super efficient.
Let’s Get Practical: Setting Up Far Sync
Here’s how:
So, We’ll set up a Far Sync instance named PRODFS alongside - my Production database is in London, named as PRODLDN
& the standby database is in Singapore, name as DRDBSNG
Step 1: Create a Far Sync Control File from the Primary Database
SQL> ALTER DATABASE CREATE FAR SYNC INSTANCE CONTROLFILE AS '/u01/app/oracle/oradata/prodldn/controlf01.ctl';
Step 2: Update the Primary Database SPFILE
Add these configurations to PRODLDN :
LOG_ARCHIVE_CONFIG='DG_CONFIG=(prodldn,prodfs,drdbsng)' LOG_ARCHIVE_DEST_2='SERVICE=prodfs SYNC AFFIRM VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=prodfs'
Step 3: Configure the Far Sync Instance SPFILE
Set up the SPFILE for PRODFS:
DB_UNIQUE_NAME=prodfs CONTROL_FILES='/u01/app/oracle/oradata/prodfs/controlf01.ctl'
DB_FILE_NAME_CONVERT='/u01/app/oracle/oradata/prodldn','/u02/app/oracle/oradata/prodfs'
LOG_FILE_NAME_CONVERT='/u01/app/oracle/oradata/prodldn','/u02/app/oracle/oradata/prodfs'
FAL_SERVER=prodldn
LOG_ARCHIVE_CONFIG='DG_CONFIG=(prodldn,prodfs,drdbsng)'
LOG_ARCHIVE_DEST_1='LOCATION= USE_DB_RECOVERY_FILE_DEST VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=prodfs' LOG_ARCHIVE_DEST_2='SERVICE=drdbsng ASYNC VALID_FOR=(STANDBY_LOGFILES,STANDBY_ROLE) DB_UNIQUE_NAME=drdbsng'
Step 4: Update the Physical Standby SPFILE
Make these changes for DRDBSNG:
LOG_ARCHIVE_CONFIG='DG_CONFIG=(prodldn,prodfs,drdbsng)' LOG_ARCHIVE_DEST_2='SERVICE=prodldn SYNC AFFIRM VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=prodldn' FAL_SERVER = 'prodfs','prodldn'
Step 5: Start the Far Sync Instance
Log in to PRODFS and start it up:
[oracle@zurich001 ~]$ export ORACLE_SID=prodfs
[oracle@zurich001 ~]$ sqlplus / as sysdba
SQL> create spfile from pfile='/u01/app/oracle/product/db_1/dbs/initprodfs.ora';
File created.
SQL> startup mount;
..
..
Database mounted.
Step 6: Now, lets Integrate with Data Guard Broker
Set up the broker for PRODLDN:
[oracle@zurich001 ~]$ dgmgrl
DGMGRL> connect /
DGMGRL> create configuration dg_conf as primary database is 'prodldn' connect identifier is prodldn;
Configuration "dg_conf" created with primary database "prodldn"
DGMGRL> add database 'drdbsng' as connect identifier is drdbsng maintained as physical;
Database "drdbsng" added
DGMGRL> enable configuration;
Enabled.
DGMGRL> ADD FAR_SYNC 'prodfs' AS CONNECT IDENTIFIER IS prodfs;
Far Sync instance "prodfs" added
DGMGRL> ENABLE FAR_SYNC 'prodfs'; Enabled.
Lets make sure the configuration is correct, lets validate ..
DGMGRL> SHOW CONFIGURATION;
Configuration - dg_conf
Protection Mode: MaxPerformance
Databases:
prodldn - Primary database drdbsng - Physical standby database prodfs - Far Sync (inactive) Fast-Start Failover: DISABLED Configuration Status: SUCCESS
Now, Enable the Far Sync:
DGMGRL> EDIT DATABASE 'prodldn' SET PROPERTY RedoRoutes='(LOCAL : PRODFS SYNC)'; DGMGRL> EDIT FAR_SYNC 'prodfs' SET PROPERTY RedoRoutes='(PRODLDN : DRDBSNG)'; DGMGRL> SHOW CONFIGURATION;
Set the protection mode to MaxAvailability:
DGMGRL> EDIT CONFIGURATION SET PROTECTION MODE AS MaxAvailability;
DGMGRL> SHOW CONFIGURATION;
Final check :
DGMGRL> SHOW CONFIGURATION;
Configuration - dg_conf
Protection Mode: MaxPerformance
Databases:
prodldn - Primary database
prodfs - Far Sync
drdbsng - Physical standby database
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS
And that’s it! Your Far Sync instance should now be up and running, ensuring your primary database runs smoothly without commit latency issues. Enjoy your efficient and robust Data Guard setup!
Stay tuned for more adventures, and don’t forget to share your thoughts and questions in the comments below!
Until then, fair winds and following seas, adventurers! ⚓✨
Regards,
Nikhil
No comments:
Post a Comment