Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Oracle RAC 11g Release 2 Client Connections
1. 1/22/2012
1
Oracle RAC 11g Release 2 Client Connections
Markus Michalewicz
Senior Principal Product Manager Oracle RAC and RAC One Node
2
1
2. 1/22/2012
Agenda
• Introduction to Oracle RAC
• Connecting to Oracle RAC using SCAN
• Load balancing, TAF, FAN and Oracle RAC
• More Information and Q&A
3
What is Oracle RAC?
Network
Centralized
Clients
Management
Console
Interconnect
No Single
SCAN
High Speed Point Of Failure
Switch or
Interconnect
Clustered
Database Servers
Hub or
Switch
Fabric Storage Area Network
Drive and Exploit
Mirrored Disk
Industry Advances
Subsystem
in Clustering
4
2
3. 1/22/2012
Oracle RAC Architecture
Clustered version of the Oracle Database
Based on a Shared Disk-Architecture
ONE database, SEVERAL instances
All nodes work concurrently
Revolutionary technique: “Cache Fusion“ = shared cache
Node 1 Node ... Node n
Oracle RAC
Oracle ASM / ACFS
Oracle Clusterware
Consolidated Pool of Storage with
Automatic Storage Management (ASM)
5
Agenda
• Introduction to Oracle RAC
• Connecting to Oracle RAC using SCAN
• Load balancing, TAF, FAN and Oracle RAC
• More Information and Q&A
6
3
4. 1/22/2012
Connecting to RAC: SCAN
Siebel • Used by clients to connect to
PSFT any database in the cluster
Oracle Grid Infrastructure
ClusterSCANname
RAC
• Removes the requirement to
change the client connection
DB1 if cluster changes
RAC • Load balances across the
DB2
instances providing a service
• Provides failover between
“moved instances”
FREE
RAC
One
7
Why SCAN is Easier
• Without SCAN (pre-11g Rel. 2) TNSNAMES has 1 entry per node
• With every cluster change, all client TNSNAMES need to be changed
PMRAC =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = node1)(PORT = 1521))
…
(ADDRESS = (PROTOCOL = TCP)(HOST = nodeN)(PORT = 1521))
(CONNECT_DATA =
… ))
• With SCAN only 1 entry per cluster is used, regardless of the # of nodes:
PMRAC =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = clusterSCANname)(PORT = 1521))
(CONNECT_DATA =
… ))
8
4
5. 1/22/2012
Connecting using SCAN
Application Server
Oracle RAC
Database
Cluster
SCAN Local
Listeners Listeners
Clients
9
Connecting using SCAN
Application Server
Oracle RAC
Database
Cluster
SCAN Local
Listeners Listeners
Clients
10
5
6. 1/22/2012
Network Configuration for SCAN
• Requires a DNS entry (or GNS) to be used for full functionality
• In DNS, SCAN is a single name defined to resolve to 3 IP-addresses:
clusterSCANname.example.com
IN A 133.22.67.194
IN A 133.22.67.193
IN A 133.22.67.192
• Each cluster will have 3 SCAN-Listeners,
combined with a SCAN-VIP defined as cluster resources
• The SCAN VIP/LISTENER combination will failover
to another node in the cluster, if the current node fails
Cluster Resources
--------------------------------------------
ora.LISTENER_SCAN1.lsnr 1 ONLINE ONLINE node1
ora.LISTENER_SCAN2.lsnr 1 ONLINE ONLINE node2
ora.LISTENER_SCAN3.lsnr 1 ONLINE ONLINE node3
11
SCAN re-configuration
• Requires a DNS entry (or GNS) to be used for full functionality
• What if… the configuration needs to change?
• Change the DNS entry first – e.g.:
NEWclusterSCANname.example.com
IN A 133.22.67.184
IN A 133.22.67.183
• Then issue:
• srvctl modify scan -n NEWclusterSCANname.example.com
• Most changes to the SCAN configuration can be performed
using 'srvctl modify scan‘ online, including:
• name changes (changes to the SCAN name)
• IP address changes (assuming that the new IP addresses
are taken from the same subnet as the old ones).
• The SCAN listeners need to be restarted using
'srvctl stop / start scan' to reflect an IP address change
12
6
7. 1/22/2012
SCAN and Load Balancing
• Load balancing using SCAN is still based on these parameters:
• local_listener
• remote_listener
• Using an Oracle Database 11g Release 2, the following
configuration will be the default for a newly, DBCA-created DB:
NAME TYPE VALUE
-------------------------- ----------- ------------------------------
local_listener string (DESCRIPTION=(ADDRESS_LIST=(AD
DRESS=(PROTOCOL=TCP)(HOST=133.
22.67.111)(PORT=1521))))
remote_listener string sales1-scan.example.com:1521
• Note the notation of the remote_listener for SCAN
• More information: “Oracle Real Application Clusters 11g Release
2 Overview of SCAN” on http://www.oracle.com/goto/rac
13
SCAN and “older Databases”
Oracle client version Oracle DB version Comments
Oracle Database Oracle Database
11g Release 2 11g Release 2 No change required
Oracle Database Pre-Oracle Database Add the SCAN VIPs as hosts
to the REMOTE_LISTENER
11g Release 2 11g Release 2 parameter.
Change the client
Pre-Oracle Database Oracle Database
TNSNAMES.ora to
11g Release 2 11g Release 2 include the SCAN VIPs
No change required, since
Pre-Oracle Database Pre-Oracle Database node VIPs can be used,
11g Release 2 11g Release 2 but use of SCAN is
recommended.
14
7
8. 1/22/2012
Agenda
• Introduction to Oracle RAC
• Connecting to Oracle RAC using SCAN
• Load balancing, TAF, FAN and Oracle RAC
• More Information and Q&A
15
Direct or Indirect Connection
• Connect Time Load Balancing (CTLB)
• Connect Time Connection Failover (CTCF)
• Runtime Connection Load Balancing (RTLB)
• Runtime Connection Failover (RTCF)
BATCH
Production
Email
SCAN
Connection
Pool
16
8
11. 1/22/2012
The Simple Failover Cases: RTCF
• Connect Time Connection Failover
• Runtime Connection Failover
PMRAC =
(DESCRIPTION =
(FAILOVER=ON)
(ADDRESS = (PROTOCOL = TCP)(HOST = MySCAN)(PORT = 1521))
(CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = Email)
...))
BATCH
Production
Email
MySCAN
? Connection
Pool
21
What happens to the client?
• Does the client get re-connected? empno name
• YES, configurable
7369 Smith
• Are transactions recovered? 7499 Allen
7521 Ward
• Write transactions: NO
7566 Jones
• Pure ‘selects’: Maybe
7654 Martin
• Using TAF only 7698 Blake
BATCH
Production
Email
MySCAN
? Connection
Pool
22
11
12. 1/22/2012
Two Ways To Protect the Client: TAF
1. Transparent Application Failover (TAF) empno name
• Tries to make the client unaware of a failure
• Provides means of CTCF and RTCF 7369 Smith
• Allows for pure ‘selects’ (reads) to continue 7499 Allen
• Write transactions need to be re-issued 7521 Ward
• The Application needs to be TAF aware 7566 Jones
7654 Martin
7698 Blake
2. Fast Application Notification (FAN)
BATCH
Production
Email
MySCAN
Connection
Pool
23
Set up TAF Policies on the Server
• TAF policies can be set on the client:
PMRAC =
(DESCRIPTION =
(FAILOVER=ON)
(ADDRESS = (PROTOCOL = TCP)(HOST = MySCAN)(PORT = 1521))
(CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = Email)
(FAILOVER_MODE= (TYPE=select)(METHOD=basic))))
• Or on the server using settings per service:
srvctl add service
-s Email -d ORCL
-e SELECT -m BASIC
-r ORCL1 -a ORCL2
-q TRUE
• This setting enables central TAF policy management per service.
24
12
13. 1/22/2012
Two Ways To Protect the Client: FAN
1. Transparent Application Failover (TAF)
2. Fast Application Notification (FAN)
• FAN wants to inform clients ASAP
• Expects clients to re-connect on failure (FCF)
• Sends messages about changes in the cluster
BATCH
Production
Email
MySCAN
Connection
Pool
25
The Benefits of a Connection Pool I
• If a connection pool is used
• The clients (users) get a physical connection
to the connection pool
• The connection pool creates a physical
connection to the database
• It is a direct client to the database
• Internally the pool maintains logical
connections
BATCH
Production Connection Pool
Email
MySCAN
26
13
14. 1/22/2012
The Benefits of a Connection Pool II
• The connection pool
• Invalidates connections to one instance
• Re-establishes new logical connections
• May create new physical connections
• Prevent new clients to be misrouted
• The application needs to handle the
transaction failure that might have occurred.
BATCH
Production Connection Pool
Email
MySCAN
27
The Load Balancing (LB) Cases
• Connect Time Load Balancing (CTLB)
• Runtime Connection Load Balancing (RTLB)
• On the Client Side
• On the Server Side
BATCH
Production
Email
MySCAN
Connection
Pool
28
14
15. 1/22/2012
Client Side Load Balancing
• Connect Time Load Balancing (CTLB) – On the client side
• Runtime Connection Load Balancing (RTLB)
PMRAC =
(DESCRIPTION =
(FAILOVER=ON)(LOAD_BALANCE=ON)
(ADDRESS = (PROTOCOL = TCP)(HOST = MySCAN)(PORT = 1521))
(CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = Email)))
BATCH
Production
Email
MySCAN
Connection
Pool
29
Server Side Load Balancing
• Connect Time Load Balancing (CTLB) – On the server
• Runtime Connection Load Balancing (RTLB)
BATCH
Production
Email
MySCAN
Connection
Pool
?
• Traditionally, PMON dynamically registers the services to the specified listeners with:
• service names for each running instance of the database and instance names for the DB
• The listener is updated with the load information for every instance and node as follows:
• 1-Minute OS Node Load Average all 30 secs.
• Number of Connections to Each Instance
• Number of Connections to Each Dispatcher
30
15
16. 1/22/2012
SCAN and Load Balancing
• Load balancing using SCAN is still based on these parameters:
• local_listener
• remote_listener
• Using an Oracle Database 11g Release 2, the following
configuration will be the default for a newly, DBCA-created DB:
NAME TYPE VALUE
-------------------------- ----------- ------------------------------
local_listener string (DESCRIPTION=(ADDRESS_LIST=(AD
DRESS=(PROTOCOL=TCP)(HOST=133.
22.67.111)(PORT=1521))))
remote_listener string sales1-scan.example.com:1521
• Note the notation of the remote_listener for SCAN
• More information: “Oracle Real Application Clusters 11g Release
2 Overview of SCAN” on http://www.oracle.com/goto/rac
31
FAN for the Load Balancing Cases
• Connect Time Load Balancing (CTLB)
• Connect Time Connection Failover (CTCF)
• Runtime Connection Load Balancing (RTLB)
• Runtime Connection Failover (RTCF) RAC
Database
30% connections
I’m busy
Instance1
10% connections
I’m very busy
I’m idle Instance2
60% connections
Instance3
32
16
17. 1/22/2012
FAN based Load Balancing in General
• Connect Time Load Balancing (CTLB)
• Runtime Connection Load Balancing (RTLB)
• Also via AQ (Advanced Queuing) based notifications
• Background is always the Load Balancing Advisory RAC
Database
30% connections
I’m busy
MySCAN Instance1
10% connections
I’m very busy
I’m idle Instance2
60% connections
Instance3
33
Use Services For FAN based LB
• Connect Time Load Balancing (CTLB)
• Runtime Connection Load Balancing (RTLB)
srvctl add service
-s EmailLBA -d ORCL
-j SHORT // Connection Load Balancing Goal {LONG|SHORT}
-B SERVICE_TIME // Runtime Connection Load Balancing Goal
{SERVICE_TIME|THROUGHPUT|NONE}
-r ORCL1,ORCL2,ORCL3
• CTLB Goal
• SHORT - used for application connections that are short in duration.
• LONG - used for application connections that are connected for a long
period; e.g. third party connection pools and SQL*Forms applications.
• RTLB Goal
• THROUGHPUT – Work requests are directed based on throughput.
• SERVICE_TIME – Work requests are directed based on response time.
• This example is most suitable for FAN integrated connection pools
34
17
18. 1/22/2012
Use Services For FAN based LB
• Connect Time Load Balancing (CTLB)
• Runtime Connection Load Balancing (RTLB)
srvctl add service
-s EmailLBA -d ORCL
-j SHORT // Connection Load Balancing Goal {LONG|SHORT}
-B SERVICE_TIME // Runtime Connection Load Balancing Goal
{SERVICE_TIME|THROUGHPUT|NONE}
-r ORCL1,ORCL2,ORCL3
-q TRUE // AQ HA Notifications {TRUE|FALSE}; for OCI / ODP.net
• The Listener uses the Load Balancing Advisory for CTLB
• IF the service has CLB_GOAL=SHORT
and RTLB-GOAL=SERVICE_TIME or THROUGHPUT
• IF CLB_GOAL=LONG
then the listener will load balance based on number of sessions
• The RTLB-GOAL setting will not be used in this case.
35
Use Services For FAN based LB
• Connect Time Load Balancing (CTLB)
• Runtime Connection Load Balancing (RTLB)
srvctl add service
-s Email -d ORCL
-j LONG // Connection Load Balancing Goal {LONG|SHORT}
-B SERVICE_TIME // Runtime Connection Load Balancing Goal
{SERVICE_TIME|THROUGHPUT|NONE}
-r ORCL1,ORCL2,ORCL3
-q TRUE // AQ HA Notifications {TRUE|FALSE}; for OCI / ODP.net
BATCH
Production
Email
MySCAN
!
200 100 160
Connection
Pool
?
36
18
19. 1/22/2012
Agenda
• Introduction to Oracle RAC
• Connecting to Oracle RAC using SCAN
• Load balancing, TAF, FAN and Oracle RAC
• More Information and Q&A
37
More Information
• www.oracle.com/goto/rac
• Oracle Real Application Clusters 11g Release 2 Overview of SCAN - Aug 2010
• Automatic Workload Management with Oracle RAC 11g Release 2 - Jan 2010
• XA and Oracle controlled Distributed Transactions - Aug 2010
• www.oracle.com/goto/clusterware
• Oracle Clusterware 11g Release 2 Technical Overview
- Updated for Oracle Clusterware 11.2.0.2
• Oracle Documentation
• Oracle® Real Application Clusters Administration and Deployment Guide
11g Release 2 (11.2): 5 Introduction to Automatic Workload Management
38
19