Skip to content
October 29, 2015 / Shivananda Rao P

Create physical standby database in 12c with Far Sync Instance in place

In 12c, a physical standby is a copy in the Primary Role, in other words, a standby is build for a complete CDB and not for an individual containers.
Having said that, when a standby is built for a CDB with PDBs plugged into it, they (PDBs) get mirrored on the standby site as well.

 

Oracle 12c has a new feature called “Far SYNC instance” which receives redo data from the primary and ships it to the dataguard configuration members. This far sync instance is a remote instance and is expected to be hosted on a different server other than primary and standby. It receives the redo data from the primary to it’s Standby Redo Logs (SRL) and archives it to it’s local archive destination. Let me say that a FAR SYNC instance is not a cascade standby, even though it receives the redo from the primary and ships to the standby. Also, implementing FAR SYNC needs additional licensing.

 

In a far sync instance, redo apply cannont be run and it can never operate either as a primary or a standby database. Also, as said earlier, a far sync instance is always in MOUNT state, there is no option to add datafiles to this instance.

 

The fact of introducing or having a far sync instance in a dataguard configuration helps out in performing the failover to the required destination with ZERO DATA LOSS and also reduces the load on the primary in terms of redo transport to the standby. Thus, it consumes very minimal resources.

 

When a synchronous redo transport is implemented, the primary database will have to wait for an ackwnoledgment from the standby database that the respective transactional redo has been applied to the standby and upon which the primary database will confirm that the transaction is committed. The time that the primary database will have to wait from the standby database can be offloaded by having a FAR SYNC instance in place and having it close to the primary site.

This reduces the load on the primary database than having to ship the redo data to the standby database directly which would be located in a far remote location.

 

The configuration looks very simple. SYNCHRONOUS mode of transport is cofigured on the primary to ship the redo data to the FAR SYNC instance.
This reduces the commit response time of the primary, also offloads it from shipping the redo to a far remote standby and makes sure that there is zero data loss.

 

Let’s begin with creating the physical standby with FAR SYNC instance in place.

 

Environment:


Primary CDB Name                         :   oraprim
PDB name plugged into the primary CDB    :   TESTPDB1
Primary Database Server Name             :   ora12c-1
FAR SYNC INSTANCE Name                   :   orafs
FAR SYNC INSTANCE Server Name            :   ora12c-2
Standby CDB Name                         :   orastb
Standby Database Server Name             :   ora12c-3

Configure the required initialization parameters (log archive destinations) on the primary.
Here is how my PFILE of the Primary database looks. You can see that the parameter “log_archive_dest_2” is configured to use the “SYNC” mode of redo transport to the Far Sync Instance “orafs”.

 

I have set “log_archive_dest_3” as an alternate option which will ship the redo data to the standby directly in case when the “Far Sync Instance” is unreachable. Remember to set “max_failure=1” on log_archive_dest_3, so that when far sync in unreachable, log_archive_dest_2 does not keep waiting, instead upon one failure, it needs to jump to use “log_archive_dest_3”.

 


*.log_archive_dest_2='service=orafs SYNC AFFIRM alternate=log_archive_dest_3 valid_for=(online_logfiles,primary_role) db_unique_name=orafs'
*.log_archive_dest_3='service=orastb SYNC max_failure=1 alternate=log_archive_dest_2 valid_for=(online_logfiles,primary_role) db_unique_name=orastb'
*.log_archive_dest_state_3=alternate

 

Also, set the “log_archive_config” parameter to the net service names of the primary database, far sync instance and the standby database as all these fall under the same dataguard configuration.

 

initoraprim.ora

 


[oracle@ora12c-1 ~]$ cat /u01/app/oracle/product/12.1.0.1/db_1/dbs/initoraprim.ora
oraprim.__data_transfer_cache_size=0
oraprim.__db_cache_size=637534208
oraprim.__java_pool_size=12582912
oraprim.__large_pool_size=8388608
oraprim.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
oraprim.__pga_aggregate_target=314572800
oraprim.__sga_target=943718400
oraprim.__shared_io_pool_size=46137344
oraprim.__shared_pool_size=226492416
oraprim.__streams_pool_size=0
*.audit_file_dest='/u01/app/oracle/admin/oraprim/adump'
*.audit_trail='db'
*.compatible='12.1.0.0.0'
*.control_files='/u01/app/oracle/oradata/oraprim/control01.ctl','/u01/app/oracle/fast_recovery_area/oraprim/control02.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_name='oraprim'
*.db_unique_name='oraprim'
*.db_recovery_file_dest='/u01/app/oracle/fast_recovery_area'
*.db_recovery_file_dest_size=4800m
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=oraprimXDB)'
*.enable_pluggable_database=true
*.log_archive_dest_1='location=use_db_recovery_file_dest valid_for=(all_logfiles,all_roles) db_unique_name=oraprim'
*.log_archive_dest_2='service=orafs SYNC AFFIRM alternate=log_archive_dest_3 valid_for=(online_logfiles,primary_role) db_unique_name=orafs'
*.log_archive_dest_3='service=orastb ASYNC max_failure=1 alternate=log_archive_dest_2 valid_for=(online_logfiles,primary_role) db_unique_name=orastb'
*.log_archive_dest_state_3=alternate
*.log_archive_config='DG_CONFIG=(oraprim,orafs,orastb)'
*.local_listener='LISTENER_ORAPRIM'
*.open_cursors=300
*.pga_aggregate_target=300m
*.processes=300
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=900m
*.undo_tablespace='UNDOTBS1'
*.fal_server='orastb'
*.db_file_name_convert='/u01/app/oracle/oradata/orastb/','/u01/app/oracle/oradata/oraprim/'
*.log_file_name_convert='/u01/app/oracle/oradata/orastb/','/u01/app/oracle/oradata/oraprim/'

 

Create a pfile for the FAR SYNC Instance with the basic required parameters. Remember to set one archive destination as it’s local archival destination and another to ship the redo data to the standby database. Here, log_archive_dest_1 and log_archive_dest_2 are set as local and remote archival destinations respectively.

 

As said previously, set the “log_archive_config” parameter on the far sync and set “fal_server” parameter to the NET Service Name of the primary database (because it is from the primary database that the far sync receives the redo).
Here is how my PFILE of the Far Sync Instance looks:

 

initorafs.ora

 


[oracle@ora12c-2 ~]$ cat /u01/app/oracle/product/12.1.0.1/db1/dbs/initorafs.ora
orafs.__data_transfer_cache_size=0
orafs.__db_cache_size=637534208
orafs.__java_pool_size=12582912
orafs.__large_pool_size=8388608
orafs.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
orafs.__pga_aggregate_target=314572800
orafs.__sga_target=943718400
orafs.__shared_io_pool_size=46137344
orafs.__shared_pool_size=226492416
orafs.__streams_pool_size=0
*.audit_file_dest='/u01/app/oracle/admin/orafs/adump'
*.audit_trail='db'
*.compatible='12.1.0.0.0'
*.control_files='/u01/app/oracle/oradata/orafs/control01.ctl','/u01/app/oracle/fast_recovery_area/orafs/control02.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_name='oraprim'
*.db_unique_name='orafs'
*.db_recovery_file_dest='/u01/app/oracle/fast_recovery_area'
*.db_recovery_file_dest_size=4800m
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=orafsXDB)'
*.log_archive_dest_1='location=use_db_recovery_file_dest valid_for=(all_logfiles,all_roles) db_unique_name=orafs'
*.log_archive_dest_2='service=orastb ASYNC valid_for=(standby_logfiles,standby_role) db_unique_name=orastb'
*.log_archive_config='DG_CONFIG=(oraprim,orafs,orastb)'
*.local_listener='LISTENER_ORAFS'
*.open_cursors=300
*.enable_pluggable_database=true
*.pga_aggregate_target=300m
*.processes=300
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=900m
*.undo_tablespace='UNDOTBS1'
*.fal_server='oraprim'
*.db_file_name_convert='/u01/app/oracle/oradata/oraprim/','/u01/app/oracle/oradata/orafs/'
*.log_file_name_convert='/u01/app/oracle/oradata/oraprim/','/u01/app/oracle/oradata/orafs/'

 

Similarly, create a PFILE for the standby database with all the required parameters.

 

Set “fal_server” parameter to the Net service name of the “Far sync instance” and also of the primary database. This is because, in case, if the Far sync instance is unavailable, the standby will fetch the redo directly from the primary.

 

*.fal_server=’orafs’,’oraprim’

 

initorastb.ora


[oracle@ora12c-3 ~]$ cat /u01/app/oracle/product/12.1.0.1/db_1/dbs/initorastb.ora
orastb.__data_transfer_cache_size=0
orastb.__db_cache_size=637534208
orastb.__java_pool_size=12582912
orastb.__large_pool_size=8388608
orastb.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
orastb.__pga_aggregate_target=314572800
orastb.__sga_target=943718400
orastb.__shared_io_pool_size=46137344
orastb.__shared_pool_size=226492416
orastb.__streams_pool_size=0
*.audit_file_dest='/u01/app/oracle/admin/orastb/adump'
*.audit_trail='db'
*.compatible='12.1.0.0.0'
*.control_files='/u01/app/oracle/oradata/orastb/control01.ctl','/u01/app/oracle/fast_recovery_area/orastb/control02.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_name='oraprim'
*.db_unique_name='orastb'
*.db_recovery_file_dest='/u01/app/oracle/fast_recovery_area'
*.db_recovery_file_dest_size=4800m
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=orastbXDB)'
*.enable_pluggable_database=true
*.log_archive_dest_1='location=use_db_recovery_file_dest valid_for=(all_logfiles,all_roles) db_unique_name=orastb'
*.log_archive_dest_2='service=oraprim ASYNC valid_for=(online_logfiles,primary_role) db_unique_name=oraprim'
*.log_archive_config='DG_CONFIG=(oraprim,orafs,orastb)'
*.local_listener='LISTENER_ORASTB'
*.open_cursors=300
*.pga_aggregate_target=300m
*.processes=300
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=900m
*.undo_tablespace='UNDOTBS1'
*.fal_server='orafs','oraprim'
*.db_file_name_convert='/u01/app/oracle/oradata/oraprim/','/u01/app/oracle/oradata/orastb/'
*.log_file_name_convert='/u01/app/oracle/oradata/oraprim/','/u01/app/oracle/oradata/orastb/'

 

Have the TNS configured for the primary, standby and the far sync instance on all the 3 servers so that they are reachable from each other.

 


ORAPRIM =
(DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = ora12c-1.mydomain)(PORT = 1521))
    (CONNECT_DATA =
       (SERVER = DEDICATED)
       (SERVICE_NAME = oraprim)
    )
)


ORAFS =
(DESCRIPTION =
    (ADDRESS_LIST =
       (ADDRESS = (PROTOCOL = TCP)(HOST = ora12c-2.mydomain)(PORT = 1521))
    )
    (CONNECT_DATA =
       (SERVICE_NAME = orafs)
    )
)



ORASTB =
(DESCRIPTION =
   (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = ora12c-3.mydomain)(PORT = 1521))
   )
   (CONNECT_DATA =
      (SERVICE_NAME = orastb)
   )
)

 

Have the listener started and the services of the respective instances listened by the respective listener on each of the servers.
To create a “far sync instance” controlfile, on the primary database, run the “create far sync instance controlfile” command. This would be used to mount the far sync instance.

 

On the primary:


[oracle@ora12c-1 dbs]$ sqlplus sys/oracle@oraprim as sysdba

SQL*Plus: Release 12.1.0.1.0 Production on Tue Sep 15 20:31:06 2015

Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL> archive log list
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     7
Next log sequence to archive   9
Current log sequence           9
SQL>
SQL>
SQL> select name,open_mode from v$pdbs;

NAME              OPEN_MODE
----------------- ----------------
PDB$SEED          READ ONLY
TESTPDB1          READ WRITE

 


SQL> alter database create far sync instance controlfile as '/u02/farsync.ctl';

Database altered.

 

Transfer the above created controlfile to the “far sync instance” server.

 

[oracle@ora12c-1 dbs]$ scp /u02/farsync.ctl oracle@ora12c-2:/u01/app/oracle/oradata/orafs/control01.ctl
oracle@ora12c-2's password:
farsync.ctl                                                          100% 17MB 17.1MB/s 00:01
[oracle@ora12c-1 ~]$ scp /u02/farsync.ctl oracle@ora12c-2:/u01/app/oracle/fast_recovery_area/orafs/control02.ctl
oracle@ora12c-2's password:
farsync.ctl                                                          100% 17MB 17.1MB/s 00:01

 

Copy the password file of the primary database to the “far sync” and standby server and rename them according to the names of “far sync” instance and “standby database”.

 


[oracle@ora12c-1 ~]$ scp /u01/app/oracle/product/12.1.0.1/db_1/dbs/orapworaprim oracle@ora12c-3:/u01/app/oracle/product/12.1.0.1/db_1/dbs/orapworastb
oracle@ora12c-3's password:
orapworaprim                                                          100% 7680 7.5KB/s 00:00
[oracle@ora12c-1 ~]$ scp /u01/app/oracle/product/12.1.0.1/db_1/dbs/orapworaprim oracle@ora12c-2:/u01/app/oracle/product/12.1.0.1/db1/dbs/orapworafs
oracle@ora12c-2's password:
orapworaprim                                                          100% 7680 7.5KB/s 00:00
[oracle@ora12c-1 ~]$

 

Mount the “far sync Instance” with the previously copied controlfile.

 


[oracle@ora12c-2 dbs]$ sqlplus sys/oracle@orafs as sysdba

SQL*Plus: Release 12.1.0.1.0 Production on Wed Sep 16 08:20:16 2015

Copyright (c) 1982, 2013, Oracle. All rights reserved.

Connected to an idle instance.

SQL> startup mount
ORACLE instance started.

Total System Global Area 939495424 bytes
Fixed Size 2295080 bytes
Variable Size 348130008 bytes
Database Buffers 583008256 bytes
Redo Buffers 6062080 bytes
Database mounted.

SQL> select status,instance_name,database_role from v$database,v$instance;

STATUS    INSTANCE_NAME    DATABASE_ROLE
--------- ---------------- ----------------
MOUNTED   orafs            FAR SYNC

 

Start the standby instance using the pfile created previously.

 


[oracle@ora12c-3 dbs]$ sqlplus sys/oracle@orastb as sysdba

SQL*Plus: Release 12.1.0.1.0 Production on Wed Sep 16 09:14:53 2015

Copyright (c) 1982, 2013, Oracle. All rights reserved.

Connected to an idle instance.

SQL> startup nomount
ORACLE instance started.

Total System Global Area 939495424 bytes
Fixed Size 2295080 bytes
Variable Size 348130008 bytes
Database Buffers 583008256 bytes
Redo Buffers 6062080 bytes

 

Initiate the duplication through RMAN by connecting to the primary database.

 


[oracle@ora12c-3 dbs]$ rman target sys/oracle@oraprim auxiliary sys/oracle@orastb

Recovery Manager: Release 12.1.0.1.0 - Production on Wed Sep 16 09:52:48 2015

Copyright (c) 1982, 2013, Oracle and/or its affiliates. All rights reserved.

connected to target database: ORAPRIM (DBID=4209209247)
connected to auxiliary database: ORAPRIM (not mounted)

RMAN> run
2> {
3> allocate channel ch1 device type disk;
4> allocate channel ch2 device type disk;
5> allocate auxiliary channel aux1 device type disk;
6> allocate auxiliary channel aux2 device type disk;
7> duplicate target database for standby from active database nofilenamecheck;
8> release channel ch1;
9> release channel ch2;
10> }

using target database control file instead of recovery catalog
allocated channel: ch1
channel ch1: SID=46 device type=DISK

allocated channel: ch2
channel ch2: SID=55 device type=DISK

allocated channel: aux1
channel aux1: SID=20 device type=DISK

allocated channel: aux2
channel aux2: SID=21 device type=DISK

Starting Duplicate Db at 16-SEP-15

contents of Memory Script:
{
backup as copy reuse
targetfile '/u01/app/oracle/product/12.1.0.1/db_1/dbs/orapworaprim' auxiliary format
'/u01/app/oracle/product/12.1.0.1/db_1/dbs/orapworastb' ;
}
executing Memory Script

Starting backup at 16-SEP-15
Finished backup at 16-SEP-15

contents of Memory Script:
{
restore clone from service 'oraprim' standby controlfile;
}
executing Memory Script

Starting restore at 16-SEP-15

channel aux1: starting datafile backup set restore
channel aux1: using network backup set from service oraprim
channel aux1: restoring control file
channel aux1: restore complete, elapsed time: 00:00:03
output file name=/u01/app/oracle/oradata/orastb/control01.ctl
output file name=/u01/app/oracle/fast_recovery_area/orastb/control02.ctl
Finished restore at 16-SEP-15

contents of Memory Script:
{
sql clone 'alter database mount standby database';
}
executing Memory Script

sql statement: alter database mount standby database

contents of Memory Script:
{
set newname for tempfile 1 to
"/u01/app/oracle/oradata/orastb/temp01.dbf";
set newname for tempfile 2 to
"/u01/app/oracle/oradata/orastb/pdbseed/pdbseed_temp01.dbf";
set newname for tempfile 3 to
"/u01/app/oracle/oradata/orastb/testpdb1/testpdb1_temp01.dbf";
switch clone tempfile all;
set newname for datafile 1 to
"/u01/app/oracle/oradata/orastb/system01.dbf";
set newname for datafile 3 to
"/u01/app/oracle/oradata/orastb/sysaux01.dbf";
set newname for datafile 4 to
"/u01/app/oracle/oradata/orastb/undotbs01.dbf";
set newname for datafile 5 to
"/u01/app/oracle/oradata/orastb/pdbseed/system01.dbf";
set newname for datafile 6 to
"/u01/app/oracle/oradata/orastb/users01.dbf";
set newname for datafile 7 to
"/u01/app/oracle/oradata/orastb/pdbseed/sysaux01.dbf";
set newname for datafile 8 to
"/u01/app/oracle/oradata/orastb/testpdb1/system01.dbf";
set newname for datafile 9 to
"/u01/app/oracle/oradata/orastb/testpdb1/sysaux01.dbf";
set newname for datafile 10 to
"/u01/app/oracle/oradata/orastb/testpdb1/SAMPLE_SCHEMA_users01.dbf";
set newname for datafile 11 to
"/u01/app/oracle/oradata/orastb/testpdb1/example01.dbf";
restore
from service 'oraprim' clone database
;
sql 'alter system archive log current';
}
executing Memory Script

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

renamed tempfile 1 to /u01/app/oracle/oradata/orastb/temp01.dbf in control file
renamed tempfile 2 to /u01/app/oracle/oradata/orastb/pdbseed/pdbseed_temp01.dbf in control file
renamed tempfile 3 to /u01/app/oracle/oradata/orastb/testpdb1/testpdb1_temp01.dbf in control file

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 16-SEP-15

channel aux1: starting datafile backup set restore
channel aux1: using network backup set from service oraprim
channel aux1: specifying datafile(s) to restore from backup set
channel aux1: restoring datafile 00001 to /u01/app/oracle/oradata/orastb/system01.dbf
channel aux2: starting datafile backup set restore
channel aux2: using network backup set from service oraprim
channel aux2: specifying datafile(s) to restore from backup set
channel aux2: restoring datafile 00003 to /u01/app/oracle/oradata/orastb/sysaux01.dbf
channel aux1: restore complete, elapsed time: 00:00:45
channel aux1: starting datafile backup set restore
channel aux1: using network backup set from service oraprim
channel aux1: specifying datafile(s) to restore from backup set
channel aux1: restoring datafile 00004 to /u01/app/oracle/oradata/orastb/undotbs01.dbf
channel aux2: restore complete, elapsed time: 00:00:45
channel aux2: starting datafile backup set restore
channel aux2: using network backup set from service oraprim
channel aux2: specifying datafile(s) to restore from backup set
channel aux2: restoring datafile 00005 to /u01/app/oracle/oradata/orastb/pdbseed/system01.dbf
channel aux1: restore complete, elapsed time: 00:00:07
channel aux1: starting datafile backup set restore
channel aux1: using network backup set from service oraprim
channel aux1: specifying datafile(s) to restore from backup set
channel aux1: restoring datafile 00006 to /u01/app/oracle/oradata/orastb/users01.dbf
channel aux1: restore complete, elapsed time: 00:00:03
channel aux1: starting datafile backup set restore
channel aux1: using network backup set from service oraprim
channel aux1: specifying datafile(s) to restore from backup set
channel aux1: restoring datafile 00007 to /u01/app/oracle/oradata/orastb/pdbseed/sysaux01.dbf
channel aux2: restore complete, elapsed time: 00:00:26
channel aux2: starting datafile backup set restore
channel aux2: using network backup set from service oraprim
channel aux2: specifying datafile(s) to restore from backup set
channel aux2: restoring datafile 00008 to /u01/app/oracle/oradata/orastb/testpdb1/system01.dbf
channel aux1: restore complete, elapsed time: 00:00:50
channel aux1: starting datafile backup set restore
channel aux1: using network backup set from service oraprim
channel aux1: specifying datafile(s) to restore from backup set
channel aux1: restoring datafile 00009 to /u01/app/oracle/oradata/orastb/testpdb1/sysaux01.dbf
channel aux2: restore complete, elapsed time: 00:00:35
channel aux2: starting datafile backup set restore
channel aux2: using network backup set from service oraprim
channel aux2: specifying datafile(s) to restore from backup set
channel aux2: restoring datafile 00010 to /u01/app/oracle/oradata/orastb/testpdb1/SAMPLE_SCHEMA_users01.dbf
channel aux2: restore complete, elapsed time: 00:00:01
channel aux2: starting datafile backup set restore
channel aux2: using network backup set from service oraprim
channel aux2: specifying datafile(s) to restore from backup set
channel aux2: restoring datafile 00011 to /u01/app/oracle/oradata/orastb/testpdb1/example01.dbf
channel aux2: restore complete, elapsed time: 00:00:25
channel aux1: restore complete, elapsed time: 00:00:46
Finished restore at 16-SEP-15

sql statement: alter system archive log current

contents of Memory Script:
{
switch clone datafile all;
}
executing Memory Script

datafile 1 switched to datafile copy
input datafile copy RECID=8 STAMP=890560571 file name=/u01/app/oracle/oradata/orastb/system01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=9 STAMP=890560571 file name=/u01/app/oracle/oradata/orastb/sysaux01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=10 STAMP=890560571 file name=/u01/app/oracle/oradata/orastb/undotbs01.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=11 STAMP=890560571 file name=/u01/app/oracle/oradata/orastb/pdbseed/system01.dbf
datafile 6 switched to datafile copy
input datafile copy RECID=12 STAMP=890560571 file name=/u01/app/oracle/oradata/orastb/users01.dbf
datafile 7 switched to datafile copy
input datafile copy RECID=13 STAMP=890560571 file name=/u01/app/oracle/oradata/orastb/pdbseed/sysaux01.dbf
datafile 8 switched to datafile copy
input datafile copy RECID=14 STAMP=890560571 file name=/u01/app/oracle/oradata/orastb/testpdb1/system01.dbf
datafile 9 switched to datafile copy
input datafile copy RECID=15 STAMP=890560571 file name=/u01/app/oracle/oradata/orastb/testpdb1/sysaux01.dbf
datafile 10 switched to datafile copy
input datafile copy RECID=16 STAMP=890560571 file name=/u01/app/oracle/oradata/orastb/testpdb1/SAMPLE_SCHEMA_users01.dbf
datafile 11 switched to datafile copy
input datafile copy RECID=17 STAMP=890560571 file name=/u01/app/oracle/oradata/orastb/testpdb1/example01.dbf
Finished Duplicate Db at 16-SEP-15

released channel: ch1

released channel: ch2
released channel: aux1
released channel: aux2

RMAN>

 

On the primary, I have 3 Online Redo Log Groups, so shall be creating 4 Standby redo log groups on the primary database, far sync instance and on the standby database.

 


SQL> select group#,bytes/1024/1024,members from v$log;

GROUP#     BYTES/1024/1024 MEMBERS
---------- --------------- ----------
1          50              1
2          50              1
3          50              1
SQL> select member,group# from v$logfile;

MEMBER                                                       GROUP#
------------------------------------------------------------ ----------
/u01/app/oracle/oradata/oraprim/redo03.log                   3
/u01/app/oracle/oradata/oraprim/redo02.log                   2
/u01/app/oracle/oradata/oraprim/redo01.log                   1

 

SQL> alter database add standby logfile group 4 '/u01/app/oracle/oradata/oraprim/redo04.log' size 50M;

Database altered.

SQL> alter database add standby logfile group 5 '/u01/app/oracle/oradata/oraprim/redo05.log' size 50M;

Database altered.

SQL> alter database add standby logfile group 6 '/u01/app/oracle/oradata/oraprim/redo06.log' size 50M;

Database altered.

SQL> alter database add standby logfile group 7 '/u01/app/oracle/oradata/oraprim/redo07.log' size 50M;

Database altered.

 

SQL> select group#,status from v$standby_log;

GROUP#     STATUS
---------- ----------
4          UNASSIGNED
5          UNASSIGNED
6          UNASSIGNED
7          UNASSIGNED

SQL>
SQL>
SQL> select group#,status from v$log;

GROUP#     STATUS
---------- ----------------
1          INACTIVE
2          INACTIVE
3          CURRENT

 

Add the same on the far sync instance.

On Far SYNC:

 


SQL> alter database add standby logfile group 4 '/u01/app/oracle/oradata/orafs/redo04.log' size 50M;

Database altered.

SQL> alter database add standby logfile group 5 '/u01/app/oracle/oradata/orafs/redo05.log' size 50M;

Database altered.

SQL> alter database add standby logfile group 6 '/u01/app/oracle/oradata/orafs/redo06.log' size 50M;

Database altered.

SQL> alter database add standby logfile group 7 '/u01/app/oracle/oradata/orafs/redo07.log' size 50M;

Database altered.

 

Finally, add them on the standby:

 

 


SQL> alter database add standby logfile group 4 '/u01/app/oracle/oradata/orastb/redo04.log' size 50M;

Database altered.

SQL> alter database add standby logfile group 5 '/u01/app/oracle/oradata/orastb/redo05.log' size 50M;

Database altered.

SQL> alter database add standby logfile group 6 '/u01/app/oracle/oradata/orastb/redo06.log' size 50M;

Database altered.

SQL> alter database add standby logfile group 7 '/u01/app/oracle/oradata/orastb/redo07.log' size 50M;

Database altered.

Now, start the MRP on the standby database. The below command starts the MRP and enables Real Time Apply.
Note that, in 12c, if Real Time Apply needs to be enabled, you do not have to use the “USING CURRENT LOGFILE” clause while starting the MRP.


SQL> alter database recover managed standby database disconnect;

Database altered.

SQL> select process,status,sequence# from v$managed_standby;

PROCESS   STATUS          SEQUENCE#
--------- ------------    ----------
ARCH      CONNECTED       0
ARCH      CLOSING         18
ARCH      CONNECTED       0
ARCH      CONNECTED       0
RFS       IDLE            0
MRP0      APPLYING_LOG    19
RFS       IDLE            19
RFS       IDLE            0
RFS       IDLE            0

9 rows selected.

 

On the Far Sync, run the v$managed_standby query to look what’s happening.

 


SQL> select process,status,sequence# from v$managed_standby;

PROCESS   STATUS        SEQUENCE#
--------- ------------  ----------
ARCH      CLOSING       16
ARCH      CLOSING       18
ARCH      CLOSING       17
ARCH      CLOSING       15
RFS       IDLE          0
RFS       IDLE          0
RFS       IDLE          0
LNS       WRITING       19
RFS       IDLE          19

9 rows selected.

 

We can see that the far sync is receiving (RFS process) the redo from the primary.
You can open the standby database in READ ONLY mode to make use of the Active DataGuard. (Active DataGuard option requires additonal licensing).

 


SQL> alter database recover managed standby database cancel;

Database altered.

SQL> alter database open ;

Database altered.

SQL> alter database recover managed standby database disconnect;

Database altered.

 

When the standby is opened in READ ONLY mode, you can also open the respective plugged in PDBs in READ ONLY mode.

 


SQL> select status,instance_name,database_role,open_mode from v$database,v$Instance;

STATUS   INSTANCE_NAME DATABASE_ROLE       OPEN_MODE
-------- ------------- ------------------- --------------------
OPEN     orastb        PHYSICAL STANDBY    READ ONLY WITH APPLY

SQL> show con_name

CON_NAME
------------------------------
CDB$ROOT
SQL>
SQL>
SQL> select name,open_mode from v$pdbs;

NAME        OPEN_MODE
----------- ------------
PDB$SEED    READ ONLY
TESTPDB1    MOUNTED

 

We can open the PDB TESTPDB1 in read only mode.

 


SQL> alter pluggable database testpdb1 open;

Pluggable database altered.

SQL> select name,open_mode from v$pdbs;

NAME        OPEN_MODE
----------- ------------
PDB$SEED    READ ONLY
TESTPDB1    READ ONLY

 

 

 

 

 

COPYRIGHT

© Shivananda Rao P, 2012 to 2018. Unauthorized use and/or duplication of this material without express and written permission from this blog’s author and/or owner is strictly prohibited. Excerpts and links may be used, provided that full and clear credit is given to Shivananda Rao and http://www.shivanandarao-oracle.com with appropriate and specific direction to the original content.

 

DISCLAIMER

The views expressed here are my own and do not necessarily reflect the views of any other individual, business entity, or organization. The views expressed by visitors on this blog are theirs solely and may not reflect mine.

 

 

Advertisement

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 )

Connecting to %s

%d bloggers like this: