You are on page 1of 14

Introduction:

The following article describes the new features and enhancements that were added in Oracle Data
Guard 12c Release 1.

Oracle Data guard overview:


Oracle Data Guard provides solutions to maximize high availability of Oracle databases. Oracle Data
Guard maintains one or many secondary databases as alternatives to the primary production database
in order to protect the primary database from loss, corruptions, disasters , errors.
Oracle Data Guard also can be used for load balancing: the standby can be opened for queries, testing,
reporting.
Database administrator can choose either manual or automatic failover of production to a standby
database.

What's New in Oracle Data Guard 12cR1?

1- Far Sync Standby:

a. Introduction:
Prior to Oracle 12c, cascading standby database is a standby database that receives its redo logs from
another standby database, not from the original primary database. The standby database, which serves
the cascading standby database, is created from the primary database using RMAN (active) duplication
method or restored from a backup of the primary.
The following image shows a primary database sending redo data over Oracle network to a physical
standby database and a logical standby database. The physical standby database retransmits the redo
data to another physical standby database (Cascading standby 1).The logical standby database
generates the redo data into SQL statements, which are then transmitted to another physical standby
database (Cascading standby 2).

Wissem El Khlifi www.oracle-class.com 12 July 2013

Page 1

The Physical and logical serving the cascading databases are databases with standby control files, server
parameter files, data files etc
Oracle database 12cR1 comes with a new standby role called Far Sync Standby. The new Standby
works as a coordinator between the primary and all its standby databases. Far Sync Standby is a
cascading Standby Database which acts as an archive logs repository.
Far sync standby can only has a server parameter file, standby control file, standby redo logs and archive
logs received from primary database. Far sync standby cannot be opened for access, cannot run redo
apply, cannot function in the primary role or be converted to any type of standby database and doesnt
have any data file.
Far sync standby can have very limited server resources as it is acting only for archive logs repository for
other standby databases.
As of Oracle Database 12c Release 1, creating a far sync instance close to the primary has the benefit
having a local synchronous redo which guarantee Zero Data loss when standby databases are far away.
Performance gain for redo transport compression and for servicing asynchronous multiple destinations.
Switchover & Failover to standby is transparent.
Far sync standby can operate in maximum protection, maximum availability or maximum performance
mode.
Wissem El Khlifi www.oracle-class.com 12 July 2013

Page 2

The following image shows a primary database sending redo data over Oracle network to a far sync
standby. The far sync standby retransmits the redo data to the other physical standby databases.

b. Creating a Far Sync Standby Instance:


Below are the steps to create a far sync standby database.

Prerequisites
-

Primary database is running in archive log mode.


Primary and Far sync standby has the same version and same patch level applied.
FORCE LOGGING is enabled on the Primary Database
The Primary Database is using a SPFILE
There is Network Connectivity is configured between the Primary and far standby system
Listener is configured and running on the Primary database and far sync standby.
Create Standby redo log file on the primary database. The Standby redo logs must be at least as
large as the largest redo log file in the primary database. The standby redo log must have at
least one more redo log group that the redo log on the primary database.

Wissem El Khlifi www.oracle-class.com 12 July 2013

Page 3

Environment Information
In the following example, we have one primary database, one far sync standby and two physical standby
databases.
ROLE
Primary
Far Sync Standby
Standby database
Standby database

DB_UNIQUE_NAME
livedb
livefs
livestby1
livestby2

Create the Far Sync Standby


During the process of a physical standby creation, a physical standby control file must be created on the
primary. The standby control file is used to mount the physical standby database. However, during the
process of a far sync standby creation, a far sync standby control file must be used to mount the far
sync standby. Note the new alter database create far sync instance controlfile command:
Example:
Run the following command from the primary database
SQL> alter database create far sync instance controlfile as /home/oracle/wissem/far_stby_ctl.ctl;

Create TNS-Alias to resolve the far sync standby on primary database.


livedb =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = livedb.domain.com)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = livedb)

Wissem El Khlifi www.oracle-class.com 12 July 2013

Page 4

)
)

livefs =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = livefs.domain.com)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = livefs)
)
)

Set the following Initialization Parameters on the Primary Database:

log_archive_dest_1 = location=USE_DB_RECOVERY_FILE_DEST
log_archive_dest_2 ='SERVICE=livefs SYNC COMPRESSION=ENABLE
VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=livefs' (Note we enable
compression)
LOG_ARCHIVE_DEST_STATE_2=ENABLE
log_archive_config= dg_config=(livedb,livefs,livestby1,livestby2)
log_archive_max_processes = 8

Create a parameter file from the primary database spfile


SQL> create pfile=/home/oracle/wissem/pfile_far_stby.ora from spfile;

Edit the pfile created in the previous step and change the following parameters

*.control_files=/home/oracle/wissem/far_stby_ctl.ctl
*.db_unique_name=livefs
log_archive_config= dg_config=(livedb,livefs,livestby1,livestby2)
*.fal_server=livedb
log_archive_dest_1 = location=USE_DB_RECOVERY_FILE_DEST
VALID_FOR=(ALL_LOGFILES,ALL_ROLES)

Wissem El Khlifi www.oracle-class.com 12 July 2013

Page 5

DB_UNIQUE_NAME=livefs
log_archive_dest_2= SERVICE=livestby1 VALID_FOR=(STANDBY_LOGFILES,STANDBY_ROLE)
DB_UNIQUE_NAME=livestby1'
log_archive_dest_3= SERVICE=livestby2 VALID_FOR=(STANDBY_LOGFILES,STANDBY_ROLE)
DB_UNIQUE_NAME=livestby2'
LOG_ARCHIVE_DEST_STATE_2=ENABLE
LOG_ARCHIVE_DEST_STATE_3=ENABLE
log_archive_max_processes = 8

Create TNS-Alias to resolve primary database and the two physical standby databases on the far sync
standby. Copy the same information on the livestby1 and livestby2 databases.
livedb =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = livedb.domain.com)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = livedb)
)
)

livefs =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = livefs.domain.com)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = livefs)
)

Wissem El Khlifi www.oracle-class.com 12 July 2013

Page 6

)
Livestby1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = Livestby1.domain.com)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = Livestby1)
)
)
Livestby2=
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = Livestby2.domain.com)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = Livestby2)
)
)

Start up no mount the far sync standby:


Startup nomount pfile=/home/oracle/wissem/pfile_far_stby.ora;

Mount the far sync standby:


Alter database mount;

Query v$database:
Wissem El Khlifi www.oracle-class.com 12 July 2013

Page 7

Select database_role from v$database;

The command should return FAR SYNC STANDBY as database role.


Create the standby redo log files on far standby. Standby log files are required to store redo received
from the primary database. Standby redo logs must be at least as large as the largest redo log file in the
primary database. The standby redo log must have at least one more redo log group that the redo log
on the primary database.
SQL> alter database add standby logfile THREAD 1 size 1G;

Check the archive logs are received on the far sync standby, you can query the v$archive_dest_Status

Create the Physical Standby databases


Use the same procedure to create physical standby databases as of 11g Release 2.
You can use one of the following methods:
1. Creating manually via User-Managed Backups
2. Using RMAN Backup-based Duplication
3. Creating a Standby Database from the active Primary Database without a Backup using RMAN
Duplicate

Copy the pfile of primary database to the physical standby and change the following values:
For Livestby1 physical standby database:

*.db_unique_name=livestby1
log_archive_config= dg_config=(livedb,livefs,livestby1,livestby2)
*.fal_server=livefs <= the far sync standby name.
log_archive_dest_1 = location=USE_DB_RECOVERY_FILE_DEST
VALID_FOR=(ALL_LOGFILES,ALL_ROLES)
DB_UNIQUE_NAME=livestby1
log_archive_dest_2= SERVICE=livefs VALID_FOR=(STANDBY_LOGFILES,STANDBY_ROLE)
DB_UNIQUE_NAME=livefs'
LOG_ARCHIVE_DEST_STATE_2=ENABLE
log_archive_max_processes = 8

For Livestby2 physical standby database:

*.db_unique_name=livestby2
log_archive_config= dg_config=(livedb,livefs,livestby1,livestby2)

Wissem El Khlifi www.oracle-class.com 12 July 2013

Page 8

*.fal_server=livefs <= The far sync standby name.


log_archive_dest_1 = location=USE_DB_RECOVERY_FILE_DEST
VALID_FOR=(ALL_LOGFILES,ALL_ROLES)
DB_UNIQUE_NAME=livestby2
log_archive_dest_2= SERVICE=livefs VALID_FOR=(STANDBY_LOGFILES,STANDBY_ROLE)
DB_UNIQUE_NAME=livefs'
LOG_ARCHIVE_DEST_STATE_2=ENABLE
log_archive_max_processes = 8

The Steps to create the physical Standby database, we can directly start the RMAN Duplicate from the
Standby Site. This method will leave the physical standby in mount mode.
$ export ORACLE_SID = livestby1
SQL> startup nomount pfile =pfile_location
RMAN> connect target sys/<Password>@livedb
RMAN> connect auxiliary /
RMAN> duplicate target database for standby from active database nofilenamecheck;

Post-Creation Steps of the Physical Standby databases


The physical standby database is in mount state, shutdown the physical standby database (livestby1,
livestby2)
Restart the physical standby database using spfile
Add standby redo log file on physical standby databases.
Start the redo apply;
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE PARALLEL 8
DISCONNECT;

Check for any errors:


select message, timestamp
from v$dataguard_status
where severity in ('Error','Fatal')
Wissem El Khlifi www.oracle-class.com 12 July 2013

Page 9

order by timestamp;

c. Questions
Now, I leave the following questions:
1- What impacts on the data guard environment if the far sync standby is down?
2- Is it possible to make more servers running as far sync standby?
3- Using far sync standby option requires an extra cost?

2- Cascade a Standby Database in Real-Time


a. Introduction:
Prior to Oracle 12c, cascading standby database is a standby database that receives its redo logs from
another standby database, not from the original primary database. The standby database, which serves
the cascading standby database, is created from the primary database using RMAN (active) duplication
method or restored from a backup of the primary. The redo propagation to the terminal cascading
standby database is done in non real time mode. Non real time mode means when the Log Sequence is
transferred to the terminal standby database(s) only after a Log Switch on the primary database.
In Oracle 12c release 1, now it is possible to make real time propagation of the whole log sequence
which means as soon as the redo record is written to the standby redo log of the first standby database.

b. Prerequisites

First (Cascading) Standby must be a Physical or Far Sync Standby Database


Standby RedoLogs must be in Place and used at least on the Cascading Standby Database
Active Data Guard Option must be licensed
Primary, Cascading and Cascaded Standby Database db_unique_name must be present in the
dg_config of log_archive_config on all the databases.

c. Enable Cascade a Standby Database in Real-Time

Wissem El Khlifi www.oracle-class.com 12 July 2013

Page 10

Environment Information
In the following example, we have one primary database, one far sync standby and two physical standby
databases.
ROLE
Primary
First Cascading Standby (can be Far Sync Standby)
Terminal Standby database
Terminal Standby database

DB_UNIQUE_NAME
livedb
livefs
livestby1
livestby2

Enable cascade in real time


Setup cascading database following the same steps as of 11g release 2 or following the same steps
mentioned in the first chapter (far sync standby).

In the first setup, The Log Transport Method should be SYNC and Standby redo logs must be
configured on the cascading Standby Database, like shown in the previous chapter.
DG_CONFIG of log_archive_config parameter must have all the unique database names of
involved databases (Primary, first cascading database, terminal cascading databases).

log_archive_config= dg_config=(livedb,livefs,livestby1,livestby2)
log_archive_dest_n on the cascading Standby Database must have the attribute:
valid_for=(STANDBY_LOGFILES,STANDBY_ROLE)

FAL_SERVER on the first cascading Standby Database should be set to the Primary or any other
Standby Database served by the Primary Database directly.
FAL_SERVER on the terminal Standby Database should be set to the cascading Standby Database
or the Primary Database.
Specify the Log Transport Method ASYNC which enables Real-Time Cascading. SYNC log
transport method enables the Non Real time cascading.

3- Using DBMS_ROLLING to Perform a Rolling Upgrade


Oracle database 12cR1 comes with the possibility to split the data guard environment during an upgrade
into two groups; the leading group (LG) and the trailing group (TG).
The leading group is upgraded first which contains the new primary database. During an upgrade
process, the trailing group databases, which contain the current primary database, continue running the
old database software until all the databases in the leading group is upgraded. The future primary is
Wissem El Khlifi www.oracle-class.com 12 July 2013

Page 11

synchronized with the old primary by applying the changes that were generated at the old primary
database during the upgrade process. Rolling upgrade guarantee a high availability of the environment
during an upgrade process.
In the following example we will use DBMS_ROLLING to perform rolling upgrade.

Environment Information
In the following example, we have one primary database and two physical standby databases.
ROLE
Primary
Standby database
Standby database

DB_UNIQUE_NAME
livedb
livestby1
livestby2

GROUP
TG
TG
LG

Initialize the upgrade plan:

SQL> EXECUTE DBMS_ROLLING.INIT_PLAN (future_primary => 'livestby2');

Build the upgrade plan:

SQL> EXECUTE DBMS_ROLLING.BUILD_PLAN;

Start the rolling upgrade:

SQL> EXECUTE DBMS_ROLLING.START_PLAN;

Upgrade the LG standby and restart it in open write mode using the higher Oracle Database
software version.
Switchover to the LG:
SQL> EXECUTE DBMS_ROLLING.SWITCHOVER;

Mount the former primary livedb using the higher Oracle Database version.
Mount the physical standbys of the former primary livestby1 using the higher Oracle Database
version.
Finish the rolling upgrade:

SQL> EXECUTE DBMS_ROLLING.FINISH_PLAN;


Wissem El Khlifi www.oracle-class.com 12 July 2013

Page 12

More details on DBMS_ROLLING can be found here:


http://docs.oracle.com/cd/E16655_01/server.121/e17640/dbms_rolling_upgrades.htm#CJAEIFE
B

4- SYSDG Privilege
User granted the SYSDG privilege can execute all data guard Operations in SQL*Plus or using all the Data
Guard Broker commands via DGMGRL.
The following is a list of commands a user granted the SYSDG privilege can run

STARTUP
SHUTDOWN
ALTER DATABASE
ALTER SESSION
ALTER SYSTEM
CREATE RESTORE POINT (including GUARANTEED Restore Points)
CREATE SESSION
DROP RESTORE POINT (including GUARANTEED Restore Points)
FLASHBACK DATABASE
SELECT ANY DICTIONARY (DBA_ Views)
SELECT
o X$ Tables
o V$ and GV$ Views
o APPQOSSYS.WLM_CLASSIFIER_PLAN
DELETE
o APPQOSSYS.WLM_CLASSIFIER_PLAN
EXECUTE
o SYS.DBMS_DRS

5- Online Standby Datafile Movement


Prior to 12c, We can copy and rename a Datafile while Managed Recovery is stopped and the Datafile to
be copied is OFFLINE if the Physical Standby Database is opened READ ONLY using RMAN , SQL*Plus or
OS copy command.
From Oracle 12c release 1, it is possible to mode a standby data file ONLINE using the command:
alter database move datafile '/home/oracle/wissem/data.189.782738241' to '+DATA';

Wissem El Khlifi www.oracle-class.com 12 July 2013

Page 13

6- Recover Standby database using service names


From Oracle 12c release 1, it is possible to recover the standby database using a compressed backup
over the network. DBA can run the recover from standby database server using a valid primary database
service name. Run from RMAN the following command:
rman target/
recover database from service livedb using compressed backupset;

7- References:
http://docs.oracle.com/cd/E16655_01/server.121/e17640/create_fs.htm#CJAGJBBG
http://docs.oracle.com/cd/E16655_01/server.121/e17601/overview.htm#HAOVW111
http://docs.oracle.com/cd/E16655_01/server.121/e17640/dbms_rolling_upgrades.htm
http://allthingsoracle.com/data-guard-physical-standby-database-best-practices-part-i/
http://allthingsoracle.com/data-guard-physical-standby-database-best-practices-part-ii/

Wissem El Khlifi www.oracle-class.com 12 July 2013

Page 14

You might also like