Oracle 12c Data Guard * Far Sync and what*s new

Oracle 12c Data Guard –
Far Sync and what’s new
Author & Presenter: Nassyam Basha
Date: 18-DEC-2014
Nassyam Basha
•
•
•
•
•
•
•
•
Post Graduation in computers from University of Madras
Oracle Database Consultant @ Pythian
Frequent OTN contributor (CKPT) /MOSC certified GURU
Co-Author of Oracle 11gR2 Data Guard administration beginners Guide
Blogger
Author of OTN Articles
11g Oracle Certified Master
Co-Founder of
@nassyambasha
/nassyambasha
2
© 2014 Pythian
Oracle Data Guard Evolution
12c
7.x
Now lets See
Managed standby Database
11g
8i
ADG, Heterogeneous Platform support
Snapshot Standby , Rolling Upgrade,
Tuning Reports
Read-only Physical standby database
Managed Recovery of standby
Remote archiving of redo log files
Logical standby database
Integrated zero data loss
Broker, Switchover & Failover
Automatic GAP resolution
Cascade redo log destinations
3
10g
9i
Real-Time Apply, Simplified
Configuration, SRL Support with
Logical standby database, FSFO,
Flashback database over Data Guard
© 2014 Pythian
What’s new in 12c Data Guard?
• Fast Sync
• Far Sync
• Real-time Cascade standby database
• Switchover Preview
• DBMS_ROLLING
• Online standby data file movement
• Restore datafile & Recover standby database using
primary service
• SYSDG role
4
© 2014 Pythian
Quick look at Protection modes – 12c
•
Maximum Performance:
– Works as independent database
– (ASYNC/NOAFFIRM)
– Oracle no longer recommends ARCH transport
•
Maximum Protection:
– Highest level of data protection, No data loss
– Must recommended to have more than one standby database.
– (SYNC/AFFIRM)
•
Maximum Availability(11g/12c):
– Flexibility to run in Maximum Protection and Maximum Performance
– (SYNC/AFFIRM) - Maximum protection in maximum Availability
– (SYNC/NOAFFIRM) – Maximum performance with maximum Availability
5
MAX_PERFORMANCE
MAX_PROTECTION
MAX_AVAILABILITY
ASYNC
SYNC
SYNC
NOAFFIRM
AFFIRM
AFFIRM/NOAFFIRM
© 2014 Pythian
What’s new in 12c Data Guard?
• Fast Sync
• Far Sync
• Real-time Cascade standby database
• Switchover Preview
• DBMS_ROLLING
• Online standby data file movement
• Restore datafile & Recover standby database using
primary service
• SYSDG role
6
© 2014 Pythian
Protection with Maximum Availability – 11.x
• SYNC/AFFIRM – Maximum Availability
SYNC
Primary
2
LGWR
NSS
RFS
7
Commit
11.x
5
11.x
1
Standby
3
4
6
LOG1
LOG2
MRP
SLOG1
-bash-3.2$ ps -ef|grep nss
oracle
12908
1 0 22:06 ?
oracle
17079 15150 0 23:31 pts/2
-bash-3.2$ ps -ef|grep lns
oracle
17081 15150 0 23:31 pts/2
-bash-3.2$
© 2014 Pythian
SLOG2
00:00:02 ora_nss2_mcdb
00:00:00 grep nss
00:00:00 grep lns
Performance with Maximum Availability – 12c FastSync
• SYNC/NOAFFIRM – Maximum Availability
Primary
2
LGWR
NSS
RFS
Ack Receipt
12c
Standby
3
SYNC
2
12c
4
NOAFFIRM
1
8
Commit
5
LOG1
LOG2
MRP
SLOG1
© 2014 Pythian
SLOG2
Performance with Maximum Availability – Fast Sync
•
Prior to 12c it Maximum availability supports only SYNC/AFFIRM,
SQL> alter system set log_archive_dest_2='service=india sync noaffirm
valid_for=(online_logfiles,primary_role) db_unique_name=india' scope=both;
System altered.
SQL> select protection_mode from v$database;
PROTECTION_MODE
-------------------MAXIMUM PERFORMANCE
SQL> alter database set standby database to maximize availability;
Database altered.
SQL>
9
© 2014 Pythian
What’s new in 12c Data Guard?
• Fast Sync
• Far Sync
• Real-time Cascade standby database
• Switchover Preview
• DBMS_ROLLING
• Online standby data file movement
• Restore datafile & Recover standby database using
primary service
• SYSDG role
10
© 2014 Pythian
Far Sync – Road Map (Topology 1:n)
•
•
•
•
11
Multiple standby databases support(dest_n)
Standby database can be Physical or Logical or Snapshot
What is throughput and network traffic from one to many topology?
Is your all of standby sites will have same network speed across global?
© 2014 Pythian
Far Sync – Evolution
•
Cascade standby
–
12
Disadvantages?
© 2014 Pythian
Far Sync - Introduction
•
Light weight Oracle database instance
•
SPFILE, Password file, Standby Control file , SRL’s and ARL’s
•
No Datafiles
•
No Database Open
•
No storage cost and It consumes very less server resources (CPU, Memory…)
•
Far Sync supports both Physical standby and also Logical standby.
•
Far Sync doesn’t require a license but other nodes must required Oracle Active Data Guard
License
•
Far Sync supports either Maximum Availability or Maximum Performance… Why?
•
Far Sync supports Data Guard Broker.
•
Compression of redo can be enabled with advanced compression license.
13
© 2014 Pythian
Far Sync – Best Location to create
•
14
Considerations before creating FAR SYNC
– Redo write size
– Available network bandwidth
– Round Trip Network latency
– Standby I/O performance
© 2014 Pythian
Far Sync – Zero Data Loss Protection- How?
•
•
15
As soon as Far Sync receives synchronous redo from primary, it also completes sending
committed transactions to the standby destination(s) of Data Guard configuration.
- My data is safe in standby database(s)
Now it lefts to you whether you wish to configure FSFO for failover operations or you prefer to do
using manual method.
© 2014 Pythian
Far Sync – Implementation: Prerequisites







16
Change to SPFILE in case of PFILE.
Create Password file on Primary
- Copy password file to Far Sync instance and standby servers
Primary database should be in Archive log mode
Enable FORCE LOGGING on Primary database
Listener configuration on all locations (Primary, Far Sync and Standby)
Network connection
- Primary to Far Sync and vice versa
- Far Sync to remote standby database(s) and vice versa
- Primary to remote database(s), useful in case of switchover and any checks
Create SRL(Standby redo logs) and recommended to have same or more size than
ORL(online redo logs) and create same or more number of standby redo log groups(SRL)
than online redo log group(ORL)
- Creation of SRL’s on overall Data Guard configuration including primary will helps us in
case of role transition
- Avoid multiplexing of SRL(standby redo logs)
© 2014 Pythian
Far Sync – Implementation: Know your environment
•
In this scenario, We have Primary database and one standby, Now we introducing Far Sync
instance to transmit redo information through it.
DATABASE_ROLE
DB_UNIQUE_NAME
Oracle Net
Primary
CANADA
CANADA
Far Sync
CANFAR
CANFAR
Standby
INDIA
INDIA
•
Now create control file for Far Sync instance from primary database
•
•
•
Create SPFILE and copy it to Far Sync server and modify required parameters
Copy Password file to remote servers and rename it as per instance name
Copy control file backup(above location) to the Far Sync server, Either you can restore using
RMAN even directly copy to the required location and perform mount.
17
© 2014 Pythian
Far Sync – Implementation
•
18
The new values of parameters from all destinations are
© 2014 Pythian
Far Sync – Implementation(critical)
•
•
Create standby redo logs on primary
– Because of LOG_FILE_NAME_CONVERT parameter the standby redo logs will be created
automatically on Far Sync if they are created.
Increase protection mode to avail Maximum availability with zero data loss
•
Black Box
Primary database is in MAXIMUM AVAILABILITY mode
Changing standby controlfile to MAXIMUM AVAILABILITY mode
Changing standby controlfile to RESYNCHRONIZATION level
Standby controlfile consistent with primary
•
19
Recovery (MRP)
– When recovery comes into picture, probably recovery can started from Far Sync? Then you will run
into “ORA-01665: control file is not a standby control file”
– Moreover there are no data files to update any committed transaction, its any instance which works
as broker between primary and standby database, Recovery(MRP) should start only on standby
database(s).
© 2014 Pythian
Far Sync - Validation
•
After the successful configuration of introducing Far Sync, Overall status of the configuration
•
SRL’s are being used?
•
Parent and child relationship of Data Guard configuration.
20
© 2014 Pythian
Far Sync: Flexible
•
Alternate destination
- alter system set log_archive_dest_2='service=canfar SYNC AFFIRM MAX_FAILURE=1
ALTERNATE=LOG_ARCHIVE_DEST_3 DB_UNIQUE_NAME=canfar
VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE)';
- alter system set log_archive_dest_3='service=india ASYNC ALTERNATE=LOG_ARCHIVE_DEST_2
DB_UNIQUE_NAME=india VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE)';
•
21
By thus configurations, redo will be sent asynchronously to alternate destinations and when far
sync is available Data Guard automatically resynchronizes far sync(canfar) instance and redo will
be transmitted towards far sync.
© 2014 Pythian
Far Sync: High Availability
•
•
After role transition(Switch over), will be the commit response time remains same
between new primary and the Far Sync-1(canfar)?
To avail maximum availability for zero data loss establish a new far sync instance
near to the primary.
SYNC
Distance ?
ASYNC
22
Switch
over
ASYNC
Switch
over
SYNC
© 2014 Pythian
Far Sync – Add second far instance
•
Adding Far Sync instance near to remote destination is easy.
–
–
–
–
–
23
Create SPFILE from new/modified PFILE
Copy Password file
Network connection between all the locations.
Create new Far Sync control file from Primary database and mount.
Ensure SRL’s are available for maximum availability in case of role transition
© 2014 Pythian
What’s new in 12c Data Guard?
• Fast Sync
• Far Sync
• Real-time Cascade standby database
• Switchover Preview
• DBMS_ROLLING
• Online standby data file movement
• Restore datafile & Recover standby database using
primary service
• SYSDG role
24
© 2014 Pythian
Real-Time Cascaded Standby Databases
•
•
Cascaded destinations now receives redo in Real-Time
Must have Active Data Guard License
•
•
•
Cascading Standby can be in any Protection Mode
Data Guard Broker now supports cascade standby
First standby should be either Physical or Far Sync Standby but no Logical Standby
25
© 2014 Pythian
Real-Time Cascaded Standby Databases - Setup
•
Real-Time Cascade, Then transport mode should be ASYNC and it can be any destinations.
•
For Non Real-Time Cascade, Transport mode should be SYNC and use the destinations from 1 to 10.
•
Standby Redo Logs(SRLs) must have created already on cascaded standby database.
Primary to Cascading:
SQL> alter system set log_archive_dest_2='SERVICE=INDIA SYNC AFFIRM VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE)
DB_UNIQUE_NAME=INDIA' scope=both;
Cascading to Cascade:
SQL> alter system set log_archive_dest_2='SERVICE=UK ASYNC VALID_FOR=(STANDBY_LOGFILES, STANDBY_ROLE)
DB_UNIQUE_NAME=UK' scope=both;
26
© 2014 Pythian
Real-Time Cascade with Broker
•
From 12c Cascade standby now with Broker support
•
Configure RedoRoutes
DGMGRL> edit database CANADA set property redoroutes='(LOCAL:INDIA) (INDIA:UK)';
Property "redoroutes" updated
DGMGRL> edit database INDIA set property redoroutes='(CANADA:UK ASYNC)';
Property "redoroutes" updated
DGMGRL>
27
© 2014 Pythian
What’s new in 12c Data Guard?
• Fast Sync
• Far Sync
• Real-time Cascade standby database
• Switchover Preview
• DBMS_ROLLING
• Online standby data file movement
• Restore datafile & Recover standby database using
primary service
• SYSDG role
28
© 2014 Pythian
Simpler Role Transitions
•
•
29
Simple Switchover with “SQL> alter database switchover to india;”
Simple Failover with “SQL> alter database failover to india;”
© 2014 Pythian
Simpler Role Transitions
30
© 2014 Pythian
What’s new in 12c Data Guard?
• Fast Sync
• Far Sync
• Real-time Cascade standby database
• Switchover Preview
• DBMS_ROLLING
• Online standby data file movement
• Restore datafile & Recover standby database using
primary service
• SYSDG role
31
© 2014 Pythian
11g Rolling Upgrade
•
•
•
•
•
•
•
•
•
•
•
•
32
Disable Broker
Create Guaranteed restore point on primary & Standby
Convert standby to Transient Logical standby
Create 2nd Guaranteed restore point
Upgrade Transient Logical standby
Switchover to Primary
Flashback Original Primary
Mount Primary from new home and convert to physical standby
Start Switchover on primary
Complete switchover on standby
Restart Old primary as standby
Drop Restore points
© 2014 Pythian
DBMS_ROLLING
•
•
•
33
Legacy Rolling Upgrade Vs DBMS_ROLLING
PL/SQL package of ADG Feature
Very useful in case of any maintenance, Patching.
© 2014 Pythian
DBMS_ROLLING
•
High Level Steps
•
•
DBMS_ROLLING.DESTROY_PLAN ();
DBMS_ROLLING.ROLLBACK_PLAN;
34
© 2014 Pythian
DBMS_ROLLING
35
© 2014 Pythian
What’s new in 12c Data Guard?
• Fast Sync
• Far Sync
• Real-time Cascade standby database
• Switchover Preview
• DBMS_ROLLING
• Online standby data file movement
• Restore datafile & Recover standby database using
primary service
• SYSDG role
36
© 2014 Pythian
Online standby data file movement
•
Online standby data file is feature of 12c and this is applicable either primary or standby but now it
is more flexible… How?
–
–
–
37
No need to terminate the recovery (MRP)
No need to set STANDBY_FILE_MANAGMENT to MANUAL
If using ADG no need to bounce database to mount either.
© 2014 Pythian
What’s new in 12c Data Guard?
• Fast Sync
• Far Sync
• Real-time Cascade standby database
• Switchover Preview
• DBMS_ROLLING
• Online standby data file movement
• Restore datafile & Recover standby database using
primary service
• SYSDG role
38
© 2014 Pythian
Recover standby database using primary service
From 12c to fill huge archive lags, incremental backups on fly procedure can be performed for faster and simple form
of recovery by using service name from standby and no need to have any backup either in primary or standby to do.
•
Should be in mount status or else
– Recovery cannot be performed in open status and data file fall into exclusive enqueue
– No need to have backup from primary
•
39
Restore Datafile
RMAN> restore datafile 6 from service “canada" ;
© 2014 Pythian
What’s new in 12c Data Guard?
• Fast Sync
• Far Sync
• Real-time Cascade standby database
• Switchover Preview
• DBMS_ROLLING
• Online standby data file movement
• Restore datafile & Recover standby database using
primary service
• SYSDG role
40
© 2014 Pythian
SYSDG Role
•
•
SYSDG administrative privilege specific to Data Guard.
If you want to manage with SYSDG role then ensure you have fresh copy of password file.
–
–
–
–
–
–
–
41
ALTER SYSTEM,
ALTER SESSION
ALTER DATABAE,
FLASHBACK DATABASE
DROP RESTORE POINT
SELECT ANY DICTIONARY
All DGMGRL Commands
© 2014 Pythian
Finally……
"There is a law written somewhere in the universe
that says the day your standby's config diverges
from your primary is the day you will need to
failover. Better hope such divergence doesn't hurt
the end user experience now that they are using
the standby."
- Brian Peasland
42
© 2014 Pythian
Thank you and Q&A
[email protected]
@nassyambasha
www.oracle-ckpt.com
43
© 2014 Pythian