Vous êtes sur la page 1sur 20

1/22/2012

Oracle RAC 11g Release 2 Client Connections


Markus Michalewicz Senior Principal Product Manager Oracle RAC and RAC One Node

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

What is Oracle RAC?


Network

Centralized Management Console Interconnect High Speed Switch or Interconnect SCAN

Clients

No Single Point Of Failure

Clustered Database Servers

Hub or Switch Fabric Mirrored Disk Subsystem

Storage Area Network Drive and Exploit Industry Advances in Clustering

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)

Agenda
Introduction to Oracle RAC Connecting to Oracle RAC using SCAN Load balancing, TAF, FAN and Oracle RAC More Information and Q&A

1/22/2012

Connecting to RAC: SCAN

Siebel

Oracle Grid Infrastructure

PSFT

Used by clients to connect to any database in the cluster ClusterSCANname Removes the requirement to change the client connection if cluster changes Load balances across the instances providing a service Provides failover between moved instances

RAC DB1

RAC DB2

RAC One

FREE

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 = ))

1/22/2012

Connecting using SCAN

Application Server

Oracle RAC Database Cluster SCAN Listeners Clients


9

Local Listeners

Connecting using SCAN

Application Server

Oracle RAC Database Cluster


SCAN Listeners Clients
10

Local Listeners

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 ora.LISTENER_SCAN2.lsnr 1 ora.LISTENER_SCAN3.lsnr 1 ONLINE ONLINE ONLINE ONLINE

node1 node2 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

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 local_listener TYPE string VALUE (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 Database 11g Release 2 Oracle Database 11g Release 2 Pre-Oracle Database 11g Release 2 Pre-Oracle Database 11g Release 2 Oracle DB version Oracle Database 11g Release 2 Pre-Oracle Database 11g Release 2 Oracle Database 11g Release 2 Pre-Oracle Database 11g Release 2 Comments No change required
Add the SCAN VIPs as hosts to the REMOTE_LISTENER parameter. Change the client TNSNAMES.ora to include the SCAN VIPs

No change required, since node VIPs can be used, but use of SCAN is recommended.

14

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

1/22/2012

TNSNAMES.ora or JDBC(:THIN)
PMRAC = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = MySCAN)(PORT = 1521)) (CONNECT_DATA = )) jdbc:oracle:thin:@MySCAN:1521/Email

BATCH Production

MySCAN

Email

Connection Pool

17

The Simple Failover Cases: CTCF


Connect Time Connection Failover
jdbc:oracle:thin:@MySCAN:1521/Email PMRAC = (DESCRIPTION = (FAILOVER=ON) (ADDRESS = (PROTOCOL = TCP)(HOST = MySCAN)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = Email)))

BATCH Production Email

MySCAN

Connection Pool

18

1/22/2012

CTCF Further Optimization


Connect Time Connection Failover
PMRAC = (DESCRIPTION = (FAILOVER=ON)(CONNECT_TIMEOUT=10)(RETRY_COUNT=3) (ADDRESS = (PROTOCOL = TCP)(HOST = MySCAN)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = Email)))

BATCH Production Email

MySCAN

Connection Pool

19

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

20

10

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?
YES, configurable

empno
7369 7499 7521 7566 7654 7698

name
Smith Allen Ward Jones Martin Blake

Are transactions recovered?


Write transactions: NO Pure selects: Maybe
Using TAF only BATCH Production Email

MySCAN

Connection Pool

22

11

1/22/2012

Two Ways To Protect the Client: TAF


1. Transparent Application Failover (TAF)
Tries to make the client unaware of a failure Provides means of CTCF and RTCF Allows for pure selects (reads) to continue Write transactions need to be re-issued The Application needs to be TAF aware empno name

2. Fast Application Notification (FAN)


BATCH Production Email

7369 7499 7521 7566 7654 7698

Smith Allen Ward Jones Martin Blake

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 -e -r -q Email -d ORCL SELECT -m BASIC ORCL1 -a ORCL2 TRUE

This setting enables central TAF policy management per service.

24

12

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 Email

Connection Pool

MySCAN

26

13

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 Email
Connection Pool

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

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

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 local_listener TYPE string VALUE (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)
30% connections Im busy Instance1 10% connections Im very busy Im idle Instance2

RAC Database

60% connections

Instance3

32

16

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


30% connections Im busy

RAC Database

Instance1

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 -B SERVICE_TIME // Connection Load Balancing Goal {LONG|SHORT} // Runtime Connection Load Balancing Goal {SERVICE_TIME|THROUGHPUT|NONE}

MySCAN
-r ORCL1,ORCL2,ORCL3

10% connections Im very busy Im idle Instance2

60% connections

Instance3

33

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

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 -B SERVICE_TIME // Connection Load Balancing Goal {LONG|SHORT} // Runtime Connection Load Balancing Goal {SERVICE_TIME|THROUGHPUT|NONE} // AQ HA Notifications {TRUE|FALSE}; for OCI / ODP.net

-r ORCL1,ORCL2,ORCL3 -q TRUE

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 -B SERVICE_TIME // Connection Load Balancing Goal {LONG|SHORT} // Runtime Connection Load Balancing Goal {SERVICE_TIME|THROUGHPUT|NONE} // AQ HA Notifications {TRUE|FALSE}; for OCI / ODP.net

-r ORCL1,ORCL2,ORCL3 -q TRUE
BATCH

Production Email

!
200 100 160

MySCAN

Connection Pool

?
36

18

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

1/22/2012

From the Documentation

39

40

20

Vous aimerez peut-être aussi