Dataguard – FAR SYNC

Here the article to how to create a dataguard with broker:
https://ezdba.wordpress.com/2017/05/15/dataguard-setup-with-broker/
FAR SYNC:
https://docs.oracle.com/database/121/SBYDB/create_fs.htm#SBYDB5441

Dataguard Far Sync.

Primary: Boston - hostname(vddl-ocme1-rac-01)
Standby: London - hostname(vddl-ocm-odg-01)

Far Sync:
bostonFS - hostname(vddl-ocm-odg-01)
londonFS - hostname(vddl-ocme1-rac-01)

tns entries on both sides for:

BOSTON 
LONDON 
LONDONFS 
BOSTONFS

1.)
create pfile='/tmp/initbostonFS.ora' from spfile;

2.)
alter database create far sync instance controlfile as '/tmp/bostonFS.ctl';

3.)
cp /opt/oracle/product/12.1.0.2/standalone/dbs/orapwboston /tmp

4.) 
[oracle@vddl-ocme1-rac-01 tmp]$ scp *boston* vddl-ocm-odg-01:/tmp
oracle@vddl-ocm-odg-01s password:
bostonFS.ctl 100% 17MB 17.4MB/s 00:00
initbostonFS.ora 100% 1983 1.9KB/s 00:00
orapwboston

5.) on Standby server:
mkdir -p /opt/oracle/oradata/bostonFS/
mkdir -p /opt/oracle/oradata/bostonFS/dev1/
mkdir -p /opt/oracle/fast_recovery_area/BOSTONFS
mkdir -p /opt/oracle/fast_recovery_area/bostonFS
mkdir -p /opt/oracle/admin/bostonFS/adump

6.) On Standby set the variables
. oraenv
bostonFS

7.) Edit

vi /tmp/initbostonFS.ora
:%s/boston/bostonFS/g

*.db_name='boston'
*.log_archive_config='dg_config=(boston,bostonFS,london,londonFS)'
*.log_archive_dest_2='SERVICE=london SYNC REOPEN=15 valid_for=(STANDBY_LOGFILES,STANDBY_ROLE) db_unique_name=london'
*.control_files='/opt/oracle/oradata/bostonFS/bostonFS01.ctl','/opt/oracle/fast_recovery_area/bostonFS/bostonFS02.ctl'
#*.local_listener='LISTENER_BOSTON'
*.db_unique_name=bostonFS
*.fal_server=boston
*.log_file_name_convert='boston','bostonFS'

8.) Copy controlfile

cp /tmp/bostonFS.ctl /opt/oracle/oradata/bostonFS/bostonFS01.ctl
cp /tmp/bostonFS.ctl /opt/oracle/fast_recovery_area/bostonFS/bostonFS02.ctl

9.) Copy Password FILE
cp /tmp/orapwboston $ORACLE_HOME/dbs/orapwbostonFS

10.) Check the environment variables to see if are pointed to bostonFS

set | grep ORA

11.) Create the spfile:

sqlplus / as sysdba
create spfile from pfile='/tmp/initbostonFS.ora';

12.) Mount the FAR Sync Instance:
startup mount;

13.) From Primary Server
sqlplus / as sysdba

--> Old Configurations
service="(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=vddl-ocm-odg-01.lux.eproseed.com)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=london.example.com)(SERVER=DEDICATED)))", ASYNC NOAFFIRM delay=0 optional compression=disable max_failure=0 max_connections=1 reopen=300 db_unique_name="london" net_timeout=30,valid_for=(online_logfile,all_roles)

--> New configuration
alter system set log_archive_config='dg_config=(boston,bostonFS,london,londonFS,london2)' scope=both; --> Must be also on London Standby
alter system set log_archive_dest_2='SERVICE=bostonFS SYNC REOPEN=15 valid_for=(ONLINE_LOGFILES,PRIMARY_ROLE) db_unique_name=bostonFS' scope=both;

14.) Check the sequences:

Primary:
SELECT MAX(SEQUENCE#), THREAD# FROM V$ARCHIVED_LOG GROUP BY THREAD#;

MAX(SEQUENCE#) THREAD#
-------------------- --------------------
 49 1

alter system switch logfile;

SELECT MAX(SEQUENCE#), THREAD# FROM V$ARCHIVED_LOG GROUP BY THREAD#;

MAX(SEQUENCE#) THREAD#
-------------------- --------------------
 50 1

StandBy: bostonFS,
At this time all of TNS must be working fine, check the logs (Broker) to see if there is no error inside.

SELECT MAX(SEQUENCE#), THREAD# FROM V$ARCHIVED_LOG GROUP BY THREAD#;

MAX(SEQUENCE#) THREAD#
-------------------- --------------------
 50 1

StandBy: london:

SELECT MAX(SEQUENCE#), THREAD# FROM V$ARCHIVED_LOG GROUP BY THREAD#;

MAX(SEQUENCE#) THREAD#
-------------------- --------------------
 50 1


15.) On standby server as bostonFS:
Check the Standby redolog files

1* select * from v$logfile
SQL> col member format a75
SQL> /

GROUP# STATUS TYPE MEMBER IS_ CON_ID
-------------------- ------- ------- --------------------------------------------------------------------------- --- --------------------
 3 ONLINE /opt/oracle/oradata/bostonFS/redo03.log NO 0
 2 ONLINE /opt/oracle/oradata/bostonFS/redo02.log NO 0
 1 ONLINE /opt/oracle/oradata/bostonFS/redo01.log NO 0
 4 STANDBY /opt/oracle/fast_recovery_area/BOSTONFS/onlinelog/o1_mf_4_dn7z8tbx_.log YES 0
 5 STANDBY /opt/oracle/fast_recovery_area/BOSTONFS/onlinelog/o1_mf_5_dn7z8wgm_.log YES 0
 6 STANDBY /opt/oracle/fast_recovery_area/BOSTONFS/onlinelog/o1_mf_6_dn7z8x7c_.log YES 0
 7 STANDBY /opt/oracle/fast_recovery_area/BOSTONFS/onlinelog/o1_mf_7_dn7z8tbm_.log YES 0

16.) Adding a second far sync, now for London standby. When London becomes primary the archived logs will sent to londonFS
instead of to send to boston.

. oraenv
boston

connect to vddl-ocme1-rac-01 - PRIMARY

[oracle@vddl-ocme1-rac-01 trace]$ cd /tmp
[oracle@vddl-ocme1-rac-01 tmp]$ ls -ltr
total 17988
drwx------. 2 root root 40 Jun 2 11:29 hsperfdata_root
-rw-r--r--. 1 oracle oinstall 135548 Jun 13 15:52 dwh_test.log
drwxr-xr-x. 2 oracle oinstall 60 Jun 14 22:19 hsperfdata_oracle
-rw-r--r--. 1 oracle oinstall 1983 Jun 16 16:01 initbostonFS.ora <-------
-rw-r-----. 1 oracle oinstall 18268160 Jun 16 16:01 bostonFS.ctl
-rw-r-----. 1 oracle oinstall 7680 Jun 16 16:02 orapwboston

mv /tmp/initbostonFS.ora /tmp/initlondonFS.ora

mkdir -p /opt/oracle/oradata/londonFS/
mkdir -p /opt/oracle/oradata/londonFS/dev1/
mkdir -p /opt/oracle/fast_recovery_area/LONDONFS
mkdir -p /opt/oracle/fast_recovery_area/londonFS
mkdir -p /opt/oracle/admin/londonFS/adump

17.) Fix the /tmp/initlondonFS.ora

:%s/boston/london/g

please fix:

*.db_name='boston'
*.control_files='/opt/oracle/oradata/londonFS/londonFS01.ctl','/opt/oracle/fast_recovery_area/londonFS/londonFS02.ctl'
*.log_archive_config='dg_config=(boston,bostonFS,london,londonFS,london2)'
*.log_file_name_convert='boston','londonFS'
*.log_archive_dest_2='SERVICE=boston ASYNC REOPEN=15 valid_for=(STANDBY_LOGFILES,STANDBY_ROLE) db_unique_name=boston'
*.db_unique_name=londonFS
*.fal_server=london

18.) Copy controlfiles

[oracle@vddl-ocme1-rac-01 tmp]$ ls -tlr /tmp/*.ctl
-rw-r-----. 1 oracle oinstall 18268160 Jun 16 16:01 /tmp/bostonFS.ctl

cp /tmp/bostonFS.ctl /opt/oracle/oradata/londonFS/londonFS01.ctl
cp /tmp/bostonFS.ctl /opt/oracle/fast_recovery_area/londonFS/londonFS02.ctl

19.) Copy Passwordfile

[oracle@vddl-ocme1-rac-01 tmp]$ ls -ltr /tmp/orapw*
-rw-r-----. 1 oracle oinstall 7680 Jun 16 16:02 /tmp/orapwboston

cp /tmp/orapwboston $ORACLE_HOME/dbs/orapwlondonFS

19.) env variables

please include londonFS in /etc/oratab

. oraenv
londonFS

20.) Create spfile for londonFS
sqlplus / as sysdba
create spfile from pfile='/tmp/initlondonFS.ora';
startup mount;

21.) On standby Server:

. oraenv
london

sqlplus / as sysdba

SQL> show parameter log_archive_dest_2

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_2 string

alter system set log_archive_dest_2='SERVICE=londonFS SYNC REOPEN=15 valid_for=(ONLINE_LOGFILES,PRIMARY_ROLE) db_unique_name=londonFS' scope=both;

Now the far sync for London database is done, this will be tested during the switchover tests.

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s