Oracle Drivers Config For HA
Oracle Drivers Config For HA
is it a developer's job?
Ludovico Caldara - Computing Engineer @CERN, Oracle ACE Director
Ludovico Caldara
■ Two decades of DBA experience (Not Only Oracle)
■ ITOUG co-founder
■ http://www.ludovicocaldara.net
■ @ludodba
■ ludovicocaldara
The Large Hadron Collider (LHC)
PetaBytes
--------------
1.056794738695
Or complex ones
Oracle Cloud Infrastructure
oracle.com/gbtour
+
30-Day Free Trial
Free credits you can use for more services
unsplash.com/@helloquence
A new project is coming in your company
… and the development starts
Disclaimer
• Some oversimplifications
• A very complex topic
• Requires DBA and developer skills
• Assume you know some basic concepts
• High availability and failover concepts
• Connections to database
• Basic NET configurations
(SCAN, Listener, Services, TNS)
• Assume you have recent DB and client (>=12.2)
"Failure happens all the time.
It happens every day in practice.
What makes you better
is how you react to it."
― Mia Hamm
What do you have to protect?
• New network session • Established network session
Registered with
the listener
HR_SVC HR_SVC
CRM_SVC REP_SVC
HR_SVC HR_SVC
REP_SVC
CRM_SVC
CRM_SVC
CRM_SVC
CRM_SVC
CRM_SVC
ONS
CRM_SVC
register
ONS
connect
CRM_SVC
notification!
ONS
ONS ONS
CRM_SVC CRM_SVC
No draining
CRM_SVC
CRM_SVC
CRM_SVC
Oracle Net
Fetched
Transparent Application Failover (TAF)
• For OCI drivers only
• Automates reconnect
• Allows resumable queries (session state restored in 12.2)
• Transactions and PL/SQL calls not resumed (rollback)
Oracle Net
Fetched
Lost
Transparent Application Failover (TAF)
• For OCI drivers only
• Automates reconnect
• Allows resumable queries (session state restored in 12.2)
• Transactions and PL/SQL calls not resumed (rollback)
Oracle Net
Fetched Discarded
Lost
Transparent Application Failover (TAF)
• For OCI drivers only
• Automates reconnect
• Allows resumable queries (session state restored in 12.2)
• Transactions and PL/SQL calls not resumed (rollback)
Oracle Net
Fetched Discarded
Lost Fetched
Transparent Application Failover (TAF)
Server side:
srvctl add service –db orcl –service hr_svc
-failovertype SELECT -failoverdelay 1 -failoverretry 180
-failover_restore LEVEL1 # restores session state (>=12.2)
-notification TRUE
Client side:
HR = (DESCRIPTION =
(FAILOVER=ON) (LOAD_BALANCE=OFF)
(ADDRESS=(PROTOCOL=TCP)(HOST=server1)(PORT=1521))
(CONNECT_DATA =
(SERVICE_NAME = HR.cern.ch)
(FAILOVER_MODE =
(TYPE = SESSION)
(METHOD = BASIC)
(RETRIES = 180)
(DELAY = 1)
)))
Fast Connection Failover and FAN
• Like for planned maintenance, but…
CLIENT CLIENT
CMAN is the
end point of
SQLNet is client
redirected connections
transparently
cman cman
CMAN opens
its own
connection to
the DB
DB DB
Session Failover with TDM
• Client connects to cman:1521/pdb1
CLIENT
cman
PDB1
CDBA CDBA
Session Failover with TDM
• Client connects to cman:1521/pdb1
• Cman opens a connection to pdb1
CLIENT
cman
PDB1
CDBA CDBA
Session Failover with TDM
• Client connects to cman:1521/pdb1
• Cman opens a connection to pdb1
CLIENT
• Upon PDB/service relocate, cman detects
the stop and closes the connections at
transaction boundaries
cman
PDB1
CDBA CDBA
Session Failover with TDM
• Client connects to cman:1521/pdb1
• Cman opens a connection to pdb1
CLIENT
• Upon PDB/service relocate, cman detects
the stop and closes the connections at
transaction boundaries
cman
• The next request is executed on the
surviving instance
PDB1
CDBA CDBA
Session Failover with TDM
• Client connects to cman:1521/pdb1
• Cman opens a connection to pdb1
CLIENT
• Upon PDB/service relocate, cman detects
the stop and closes the connections at
transaction boundaries
cman
• The next request is executed on the
surviving instance
• The connection client-cman is intact, the
client does not experience a
disconnection
PDB1
CDBA CDBA
Magic does not happen, you need to plan
Thank you!
Ludovico Caldara - Computing Engineer @CERN, Oracle ACE Director