High Availability Tests

Werbung
High Availability Tests
1. Umgebungsinformation ........................................................................................................ 2
2. Vorbereitungen ...................................................................................................................... 3
2.1 Anlegen Datenbank Services mittels EM Console ...................................................... 3
2.2 Anlegen Schema scott/tiger ........................................................................................... 4
3. Arbeiten mit Services............................................................................................................. 5
3.1 Überprüfen der Services mit der EM Console ............................................................ 5
3.2 HA Services Component with and without TAF......................................................... 5
4. Benutzung von TAF (Transparent Application Failover)................................................... 8
4.1 Read Modus : SELECT Reihenfolge............................................................................ 8
4.2 Transaktionsbehandlung: UPDATE Reihenfolge ....................................................... 9
5. Verwaltung von nicht-Oracle Applikationen im Cluster ................................................... 13
5.1 Vorbereitung................................................................................................................. 13
5.2 Registrierung und Starten der Applikation............................................................... 14
5.3 Starten der Client-Applikation ................................................................................... 15
5.4 Verwaltung der Komponenten.................................................................................... 16
5.5 Entfernen der Anwendung .......................................................................................... 18
6. Demonstration JDBC FCF (Fast Connection Failover)................................................... 19
6.1 Testumgebung............................................................................................................... 19
6.2 Anlegen der Benutzer................................................................................................... 19
6.3 Anlegen eines Service für FCF .................................................................................... 19
6.4 Anpassung und Übersetzung Java Programme ........................................................ 20
6.5 Test ohne FCF............................................................................................................... 21
6.6 Test mit FCF ................................................................................................................. 23
TestHA.doc
1/26
1. Umgebungsinformation
Es stehen für den Workshop jeweils 2-Knoten-Cluster zur Verfügung. Die Namen der Knoten
setzen sich wie folgt zusammen :
# = Nummer der Arbeitsgruppe
Knoten
1
2
Name
hpws#rac1
hpws#rac2
Also zum Beispiel für Arbeitsgruppe 1: hpws1rac1 und hpws1rac2.
Die Verzeichnisstruktur ist folgendermaßen:
Directory
ORACLE_BASE
ORACLE_HOME (Clusterware)
ORACLE_HOME (Datenbank)
Pfad
/opt/oracle
/opt/crs
/opt/oracle/product/db
Als Benutzer sind auf Betriebssystemebene eingerichtet :
User
root
oracle
Password
oracle
oracle
Auf Datenbankebene sind folgende Benutzer angelegt:
User
sys
system
sysman
alle anderen User
Password
oracle
oracle
oracle
oracle
Zum Starten der Umgebung wird der Tight vncviewer verwendet, mit dem Sie sich auf den
automatisch gestarteten vncserver auf den Clusterknoten verbinden und dort eine grafische
Oberfläche starten, die für die Installation benötigt wird. Die Login-Informationen sind :
vncserver
<Servername> :1
TestHA.doc
Password
oracle
2/26
2. Vorbereitungen
2.1 Anlegen Datenbank Services mittels EM Console
Starten Sie die EM Console in einem Browser über den während der Installation notierten
Link (# durch Gruppennummer ersetzen):
https://hpws#rac1.de.oracle.com:1158/em
Melden Sie sich an als User system. Nach Erscheinen des Standardbildschirms klicken Sie auf
das Register Verfügbarkeit, dann auf den Link Cluster-verwaltete Datenbank-Services. Im
folgenden Bildschirm tragen Sie die Credentials für den OS-User oracle und den DB-User sys
ein.
Es erscheint eine Übersicht aller registrierten Services, die allerdings noch keine Einträge
enthält. Die Services werden nun mittels Button Service erstellen angelegt.
Erstellen Sie Services gemäß folgender Aufstellung:
Service-Name
hataf
ha
Instanz 1
Bevorzugt
Bevorzugt
Instanz 2
Verfügbar
Verfügbar
TAF-Policy
Basis
Keine
Setzen Sie die entsprechende Checkbox, damit die lokale tnsnames.ora aktualisiert wird.
Wenn Sie bei der Installation nicht das Patch 11.1.0.7 installiert haben, so bekommen Sie
beim Anlegen der Services keine Checkbox angeboten sondern müssen den folgende
tnsnames.ora Einträge manuell (Hinweis: Bitte cut&paste aus pdf-Dokument nur über
Windows-Editor und dabei überflüssige Leerzeichen entfernen!) vornehmen:
hataf =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = hpws#rac1v)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = hpws#rac2v)(PORT = 1521))
(LOAD_BALANCE = YES)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = hataf)
(FAILOVER_MODE =
(TYPE = SELECT)(METHOD = BASIC)(RETRIES = 180)(DELAY = 5)
)
)
)
ha =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = hpws#rac1v)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = hpws#rac2v)(PORT = 1521))
(LOAD_BALANCE = YES)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ha)
)
)
TestHA.doc
3/26
Hinweis:
Kontrollieren Sie bitte in jedem Fall Ihre tnsnames.ora!
Wenn Sie die anschließenden Tests auf dem anderen Knoten durchführen wollen, so müssen
Sie die anlegeten tnsnames.ora Einträge manuell auf den zweiten Knoten kopieren.
2.2 Anlegen Schema scott/tiger
Starten Sie ein Terminal als User oracle und setzen Sie die Umgebung:
[oracle@hpws1rac1 ~]$ . oraenv
ORACLE_SID = [oracle] ? ws11
The Oracle base for ORACLE_HOME=/opt/oracle/product/db is /opt/oracle
Anschließend starten Sie SQL*plus, melden sich mit sysdba-Rechten an und starten das
Skript $ORACLE_HOME/rdbms/admin/utlsampl.sql, um das Schema scott anzulegen:
[oracle@hpws1rac1 ~]$ sqlplus /nolog
SQL*Plus: Release 11.1.0.7.0 - Production on Thu Sep 25 09:19:37 2008
Copyright (c) 1982, 2008, Oracle.
All rights reserved.
SQL> conn / as sysdba
Connected.
SQL> @$ORACLE_HOME/rdbms/admin/utlsampl.sql
[oracle@hpws1rac1 ~]$
TestHA.doc
4/26
3. Arbeiten mit Services
3.1 Überprüfen der Services mit der EM Console
Starten Sie die EM Console in einem Browser über den während der Installation notierten
Link (# durch Gruppennummer ersetzen):
https://hpws#rac1.de.oracle.com:1158/em
Melden Sie sich an als User system. Nach Erscheinen des Standardbildschirms klicken Sie auf
das Register Verfügbarkeit, dann auf den Link Cluster-verwaltete Datenbank-Services. Hier
sollten Sie die beiden oben angelegten Services sehen.
Alternativ können Sie mit dem crs_stat Utility sämtliche Services prüfen:
[oracle@hpws1rac1 ~]$ /opt/crs/bin/crs_stat -t
Name
Type
Target
State
Host
-----------------------------------------------------------ora....11.inst application
ONLINE
ONLINE
hpws1rac1
ora....12.inst application
ONLINE
ONLINE
hpws1rac2
ora.ws1.db
application
ONLINE
ONLINE
hpws1rac1
ora....S11.srv application
ONLINE
ONLINE
hpws1rac2
ora.ws1.ha.cs application
ONLINE
ONLINE
hpws1rac1
ora....S11.srv application
ONLINE
ONLINE
hpws1rac2
ora....ataf.cs application
ONLINE
ONLINE
hpws1rac1
ora....SM2.asm application
ONLINE
ONLINE
hpws1rac1
ora....C1.lsnr application
ONLINE
ONLINE
hpws1rac1
ora....ac1.gsd application
ONLINE
ONLINE
hpws1rac1
ora....ac1.ons application
ONLINE
ONLINE
hpws1rac1
ora....ac1.vip application
ONLINE
ONLINE
hpws1rac1
ora....SM1.asm application
ONLINE
ONLINE
hpws1rac2
ora....C2.lsnr application
ONLINE
ONLINE
hpws1rac2
ora....ac2.gsd application
ONLINE
ONLINE
hpws1rac2
ora....ac2.ons application
ONLINE
ONLINE
hpws1rac2
ora....ac2.vip application
ONLINE
ONLINE
hpws1rac2
3.2 HA Services Component with and without TAF
Öffnen Sie als User oracle mehrere Fenster auf Ihrem Knoten 1 (z. B. hpws1rac1) und führen
Sie folgende Operationen aus:
Fenster 1 (Knoten 1):
[oracle@hpws1rac1 ~]$ . oraenv
ORACLE_SID = [oracle] ? ws11
[oracle@hpws1rac1 ~]$ sqlplus scott/tiger@hataf
SQL> select count(*) from emp;
TestHA.doc
5/26
Fenster 2 (Knoten 1):
[oracle@hpws1rac1 ~]$ . oraenv
ORACLE_SID = [oracle] ? ws11
[oracle@hpws1rac1 ~]$ sqlplus scott/tiger@ha
SQL> select count(*) from emp;
Fenster 3 (Knoten 1): Prüfen Sie, dass die beiden Sessions auf Knoten 1 verbunden sind:
[oracle@hpws1rac1 ~]$ . oraenv
ORACLE_SID = [oracle] ? ws11
[oracle@hpws1rac1 ~]$ cd /home/oracle/workshop
[oracle@hpws1rac1 workshop]$ sqlplus system/oracle@hataf
SQL> @sel_sess
SID
----111
112
USERNAM
------SCOTT
SCOTT
SERVICE
INST_ID FAILOVER_METHOD
------- ---------- --------------hataf
1 BASIC
ha
1 NONE
FAILED_OVER
--------------NO
NO
SQL>
Fenster 4 (Knoten 1): Sie bringen Instanz 1 nun durch Abbruch des smon Prozesses (kill –9)
zum Absturz:
[oracle@hpws1rac1 ~]$
oracle
18446
1
oracle
20372 20286
oracle
23667
1
[oracle@hpws1rac1 ~]$
ps -efa
0 Sep24
0 12:03
0 11:23
kill -9
|grep smon
?
00:00:00 asm_smon_+ASM1
pts/2
00:00:00 grep smon
?
00:00:00 ora_smon_ws11
23667
Prüfen Sie in Fenster 1, dass der Client nach wie vor verbunden ist:
SQL> select count(*) from emp;
COUNT(*)
---------14
Anschließend prüfen Sie den Client in Fenster 2 und verbinden Sie sich erneut:
SQL> select count(*) from emp;
select count(*) from emp
*
ERROR at line 1:
ORA-03113: end-of-file on communication channel
Process ID: 6824
Session ID: 112 Serial number: 487
SQL> conn scott/tiger@ha
Connected.
TestHA.doc
6/26
SQL> select count(*) from emp;
COUNT(*)
---------14
In Fenster 3 prüfen Sie die laufenden Sessions:
SQL> @sel_sess
SID
----121
122
USERNAM
------SCOTT
SCOTT
SERVICE
INST_ID FAILOVER_METHOD
------- ---------- --------------ha
2 NONE
hataf
2 BASIC
FAILED_OVER
--------------NO
YES
Sie sehen, dass der User scott nun mit Instanz 2 verbunden ist.
Sie können prüfen, dass die Clusterware die Instanz automatisch auf Knoten 1
wiederhergestellt hat:
[oracle@hpws1rac1 ~]$ /opt/crs/bin/crs_stat -t
Name
Type
Target
State
Host
-----------------------------------------------------------ora....SM2.asm application
ONLINE
ONLINE
hpws1rac1
ora....C1.lsnr application
ONLINE
ONLINE
hpws1rac1
ora....ac1.gsd application
ONLINE
ONLINE
hpws1rac1
ora....ac1.ons application
ONLINE
ONLINE
hpws1rac1
ora....ac1.vip application
ONLINE
ONLINE
hpws1rac1
ora....SM1.asm application
ONLINE
ONLINE
hpws1rac2
ora....C2.lsnr application
ONLINE
ONLINE
hpws1rac2
ora....ac2.gsd application
ONLINE
ONLINE
hpws1rac2
ora....ac2.ons application
ONLINE
ONLINE
hpws1rac2
ora....ac2.vip application
ONLINE
ONLINE
hpws1rac2
ora.ws1.db
application
ONLINE
ONLINE
hpws1rac1
ora.ws1.ha.cs application
ONLINE
ONLINE
hpws1rac2
ora....s11.srv application
ONLINE
ONLINE
hpws1rac1
ora....ataf.cs application
ONLINE
ONLINE
hpws1rac2
ora....s11.srv application
ONLINE
ONLINE
hpws1rac1
ora....11.inst application
ONLINE
ONLINE
hpws1rac1
ora....12.inst application
ONLINE
ONLINE
hpws1rac2
Nutzen Sie zum Abschluß die EM Console, um durch einen Restart der Services diese wieder
auf die richtige Instanz zu verschieben.
TestHA.doc
7/26
4. Benutzung von TAF (Transparent Application Failover)
In diesem Abschnitt wird eine neue Tabelle longrun benötigt, die Sie mit einem
bereitstehenden Skript (/home/oracle/workshop/ha_install.sql) anlegen. Führen Sie dazu als
User oracle die folgenden Schritte aus:
[oracle@hpws1rac1 ~]$ . oraenv
ORACLE_SID = [oracle] ? ws11
The Oracle base for ORACLE_HOME=/opt/oracle/product/db is /opt/oracle
[oracle@hpws1rac1 ~]$ cd workshop
[oracle@hpws1rac1 workshop]$ sqlplus scott/tiger
SQL*Plus: Release 11.1.0.7.0 - Production on Thu Sep 25 12:40:14 2008
Copyright (c) 1982, 2008, Oracle.
All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
SQL> @ha_install
4.1 Read Modus : SELECT Reihenfolge
In dieser Übung wird gezeigt, wie TAF (Transparent Application Failover) bei einem
langlaufenden select-Statement in einer Applikation, die TAF-fähig ist (hier: SQL*plus),
reagiert. Hierzu wird eine spezielle Sortierung verwendet, die ordnungsgemäß zum Ende
kommt, auch wenn die Instanz, zu der Sie verbunden sind, abbricht.
Fenster 1 (Knoten 1):
[oracle@hpws1rac1 ~]$ . oraenv
ORACLE_SID = [oracle] ? ws11
The Oracle base for ORACLE_HOME=/opt/oracle/product/db is /opt/oracle
[oracle@hpws1rac1 ~]$ cd workshop
[oracle@hpws1rac1 workshop]$ sqlplus scott/tiger@hataf
Fenster 2 (Knoten 1): Prüfen Sie, dass die Session von User scott auf Knoten 1 verbunden
ist:
[oracle@hpws1rac1 ~]$ . oraenv
ORACLE_SID = [oracle] ? ws11
The Oracle base for ORACLE_HOME=/opt/oracle/product/db is /opt/oracle
[oracle@hpws1rac1 ~]$ cd workshop
[oracle@hpws1rac1 workshop]$ sqlplus system/oracle@hataf
SQL> @sel_sess
SID USERNAM SERVICE
INST_ID FAILOVER_METHOD FAILED_OVER
----- ------- ------- ---------- --------------- --------------114 SCOTT
hataf
1 BASIC
NO
TestHA.doc
8/26
Fenster 3 (Knoten 1): Bereiten Sie das Kommando kill –9 vor, aber lassen es noch nicht
laufen!
[oracle@hpws1rac1 ~]$
oracle
18446
1
oracle
22612
1
oracle
29635 29163
[oracle@hpws1rac1 ~]$
ps -efa
0 Sep24
0 12:06
0 13:01
kill -9
|grep smon
?
00:00:00 asm_smon_+ASM1
?
00:00:00 ora_smon_ws11
pts/2
00:00:00 grep smon
22612
Fenster 1 (Knoten 1): Führen Sie das langlaufende select-Statement aus, es läuft ca. 1 min:
SQL> @ha1.sql
Fenster 3 (Knoten 1): Das vorbereitete Kommando kill –9 laufenlassen:
[oracle@hpws1rac1 ~]$ kill -9 22612
Fenster 1 (Knoten 1): Beobachten Sie, wie das SELECT zum Ende kommt.
Fenster 2 (Knoten 1): Überprüfen Sie, dass die Session von User scott automatisch auf den
zweiten Knoten übertragen wurde (FAILED_OVER=YES), ohne die Abarbeitung des selectStatements zu behindern:
SQL> @sel_sess
SID USERNAM SERVICE
INST_ID FAILOVER_METHOD FAILED_OVER
----- ------- ------- ---------- --------------- --------------122 SCOTT
hataf
2 BASIC
YES
Nutzen Sie zum Abschluß die EM Console, um durch einen Restart der Services diese wieder
auf die richtige Instanz zu verschieben.
4.2 Transaktionsbehandlung: UPDATE Reihenfolge
In diesem Beispiel sehen Sie Fehler, die in SQL*plus auftreten, wenn eine Instanz abbricht
und das TAF während einer laufenden Aktion erfolgt. Auf diese Weise sehen Sie, welchen
Fehlercode eine TAF-fähige Applikation abfangen sollte.
Fenster 1 (Knoten 1):
[oracle@hpws1rac1 ~]$ . oraenv
ORACLE_SID = [oracle] ? ws11
The Oracle base for ORACLE_HOME=/opt/oracle/product/db is /opt/oracle
[oracle@hpws1rac1 ~]$ cd workshop
[oracle@hpws1rac1 workshop]$ sqlplus scott/tiger@hataf
Fenster 2 (Knoten 1): Prüfen Sie die Session von User scott auf Knoten1:
TestHA.doc
9/26
[oracle@hpws1rac1 ~]$ . oraenv
ORACLE_SID = [oracle] ? ws11
The Oracle base for ORACLE_HOME=/opt/oracle/product/db is /opt/oracle
[oracle@hpws1rac1 ~]$ cd workshop
[oracle@hpws1rac1 workshop]$ sqlplus system/oracle@hataf
SQL*Plus: Release 11.1.0.7.0 - Production on Thu Sep 25 14:02:02 2008
Copyright (c) 1982, 2008, Oracle.
All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
SQL> @sel_sess
SID USERNAM SERVICE
INST_ID FAILOVER_METHOD FAILED_OVER
----- ------- ------- ---------- --------------- --------------121 SCOTT
hataf
1 BASIC
NO
Fenster 3 (Knoten 1): Bereiten Sie das Kommando kill –9 vor, aber lassen es noch nicht
laufen!
[oracle@hpws1rac1 ~]$
oracle
2090
1
oracle
11356 11127
oracle
18446
1
[oracle@hpws1rac1 ~]$
ps -efa
0 13:07
0 14:05
0 Sep24
kill -9
|grep smon
?
00:00:00 ora_smon_ws11
pts/4
00:00:00 grep smon
?
00:00:00 asm_smon_+ASM1
2090
Fenster 1 (Knoten 1): Führen Sie ein vorbereitetes DML vollständig (siehe auch
Anmerkung weiter unten) aus:
SQL> delete from longrun where deptno=40 ;
Fenster 3 (Knoten 1): Das vorbereitete Kommando kill –9 laufenlassen:
[oracle@hpws1rac1 ~]$ kill -9 2090
Fenster 2 (Knoten 1): Prüfen Sie die Session von User scott, hier hat ein TAF
(FAILED_OVER=YES) stattgefunden:
SQL> @sel_sess
SID USERNAM SERVICE
INST_ID FAILOVER_METHOD FAILED_OVER
----- ------- ------- ---------- --------------- --------------130 SCOTT
hataf
2 BASIC
YES
Fenster 1 (Knoten 1): Führen Sie das commit; Kommando aus und beobachten Sie, was
passiert (u. U. anderes Verhalten beim Einsatz des Base-Releases 11.1.0.6!):
TestHA.doc
10/26
SQL> commit;
commit
*
ERROR at line 1:
ORA-25402: transaction must roll back
Führen Sie den Befehl select count(*) from longrun; aus und beobachten Sie den Fehlercode:
SQL> select count(*) from longrun;
select count(*) from longrun
*
ERROR at line 1:
ORA-25402: transaction must roll back
Anmerkung (MetaLink Note 337178.1 : Which are the Oracle Errors (TAF Events) to be
Handled for RAC Failover) :
An dieser Stelle kann auch der Fehler ORA-25405: transaction status unknown
auftreten. Die für TAF relevanten Fehlermeldungen und deren Behandlung sind in der
genannten Note gut beschrieben.
Führen Sie den Befehl rollback; aus:
SQL> rollback;
Rollback complete.
Führen Sie den Befehl select count(*) from longrun where deptno = 40; aus und beobachten
Sie, was passiert:
SQL> select count(*) from longrun where deptno=40 ;
COUNT(*)
---------123190
TestHA.doc
11/26
Anmerkung (MetaLink Note 473145.1: SQLPLUS does not failover service receiving FAN
events):
Wenn Sie das DML-Kommando nicht vollständig durchlaufen lassen haben, so erhalten Sie
folgende Meldung, weil FAN Events standardmäßig nicht korrekt verarbeitet werden:
SQL> delete from longrun where deptno=40 ;
delete from longrun where deptno=40
*
ERROR at line 1:
ORA-25408: can not safely replay call
Gemäß oben genannter Note gibt es ab Patch 10.2.0.4 die Möglichkeit, SQL*plus mit der
Option –F zu starten, und so die FAN-Events korrekt zu verarbeiten, wobei diese im
entsprechenden Service über die EM Console aktiviert sein müssen:
[oracle@hpws1rac1 workshop]$ sqlplus –F scott/tiger@hataf
Nutzen Sie zum Abschluß die EM Console, um durch einen Restart der Services diese wieder
auf die richtige Instanz zu verschieben.
TestHA.doc
12/26
5. Verwaltung von nicht-Oracle Applikationen im Cluster
In diesem Abschnitt wird gezeigt, dass es möglich ist, Applikationen mittels Oracle
Clusterware Services zu verwalten. Hierzu wird eine Applikation my-app mit der
dazugehörigen virtuellen IP-Adresse my-vip erzeugt, die durch CRS verwaltet werden. Es
wird eine Abhängigkeit zwischen my-app und my-vip definiert, wobei my-app vorzugsweise
auf Knoten 1 läuft und von Knoten 2 übernommen werden kann.
5.1 Vorbereitung
Notieren Sie die IP-Adresse Ihres Knotens aus dem File /etc/hosts (in diesem Beispiel
10.168.244.161 für Gruppe 1):
[oracle@hpws1rac1 ~]$ tail /etc/hosts
10.165.244.161
10.165.244.162
10.165.244.163
10.165.244.164
10.165.244.165
10.165.244.166
10.165.244.167
10.165.244.168
hpws1myvip
hpws2myvip
hpws3myvip
hpws4myvip
hpws5myvip
hpws6myvip
hpws7myvip
hpws8myvip
Ersetzen Sie den Platzhalter (export MYVIP=hpws#myvip) in den beiden Skripten
/home/oracle/workshop/myapp/Server/check.sh
und
/home/oracle/workshop/myapp/Client/showapp.sh
auf beiden Knoten durch den korrekten Eintrag, der zu Ihrer Gruppe (# durch
Gruppennummer ersetzen) gehört.
Anschließend melden Sie sich als User root an und lassen das Skript laufen, um die
Umgebung zu setzen:
[oracle@hpws1rac1 myapp]$ su - root
Password:
[root@hpws1rac1 ~]# cd /home/oracle/workshop/myapp
[root@hpws1rac1 myapp]# . ./setmyapp.sh
Dieses Skript setzt die folgenden Umgebungsvariablen:
ORACLE_HOME=/opt/oracle/product/db
ORA_CRS_HOME=/opt/crs
PATH=$ORACLE_HOME/bin:$ORA_CRS_HOME/bin:$PATH
Prüfen Sie den Status des Cluster:
[root@hpws1rac1 myapp]# /opt/crs/bin/crs_stat -t
Name
Type
Target
State
Host
-----------------------------------------------------------ora....SM2.asm application
ONLINE
ONLINE
hpws1rac1
ora....C1.lsnr application
ONLINE
ONLINE
hpws1rac1
TestHA.doc
13/26
ora....ac1.gsd
ora....ac1.ons
ora....ac1.vip
ora....SM1.asm
ora....C2.lsnr
ora....ac2.gsd
ora....ac2.ons
ora....ac2.vip
ora.ws1.db
ora.ws1.ha.cs
ora....s11.srv
ora....ataf.cs
ora....s11.srv
ora....11.inst
ora....12.inst
application
application
application
application
application
application
application
application
application
application
application
application
application
application
application
ONLINE
ONLINE
ONLINE
ONLINE
ONLINE
ONLINE
ONLINE
ONLINE
ONLINE
ONLINE
ONLINE
ONLINE
ONLINE
ONLINE
ONLINE
ONLINE
ONLINE
ONLINE
ONLINE
ONLINE
ONLINE
ONLINE
ONLINE
ONLINE
ONLINE
ONLINE
ONLINE
ONLINE
ONLINE
ONLINE
hpws1rac1
hpws1rac1
hpws1rac1
hpws1rac2
hpws1rac2
hpws1rac2
hpws1rac2
hpws1rac2
hpws1rac2
hpws1rac1
hpws1rac1
hpws1rac1
hpws1rac1
hpws1rac1
hpws1rac2
5.2 Registrierung und Starten der Applikation
Registrieren Sie my-app und my-vip im Cluster, wobei der erste Parameter der Knoten ist, auf
dem die Applikation laufen soll und die IP-Adresse diejenige aus der /etc/hosts im Klartext
ist:
[root@hpws1rac1 myapp]# /cd /home/oracle/workshop/myapp/Server
[root@hpws1rac1 Server]# . ./createapp.sh hpws1rac1 10.165.244.161
/opt/crs/bin/crs_profile -create my-vip -t application -p favored -h
hpws1rac2 -a /opt/crs/bin/usrvip -o
ap=1,oi=eth0,ov=10.165.244.161,on=255.255.254.0
/opt/crs/bin/crs_register my-vip
/opt/crs/bin/crs_setperm my-vip -u user:oracle:r-x
/opt/crs/bin/crs_profile -create my-app -t application -r my-vip -p favored
-h hpws1rac2 -a /home/oracle/workshop/myapp/Server/check.sh -o
ap=1,ci=30,ra=5
/opt/crs/bin/crs_register my-app
/opt/crs/bin/crs_setperm my-app -u user:root:r-x
[root@hpws1rac1 ~]#
Die Registrierung erfolgt durch die Funktionen crs_profile, crs_register und crs_setperm, die
das Profile der Komponente anlegen (Typ, Abhängigkeiten, …) die Applikation im CRS
eintragen und die Berechtigungen setzen. Im vorliegenden Fall bedeutet diese Abhängigkeit,
dass my-app nur ausgeführt werden kann, wenn my-vip auf dem gleichen Knoten ansprechbar
sind.
Prüfen Sie den Status des Clusters:
[root@hpws1rac1 ~]# /opt/crs/bin/crs_stat -t
Name
Type
Target
State
Host
-----------------------------------------------------------my-app
application
OFFLINE
OFFLINE
my-vip
application
OFFLINE
OFFLINE
ora....SM2.asm application
ONLINE
ONLINE
hpws1rac1
ora....C1.lsnr application
ONLINE
ONLINE
hpws1rac1
ora....ac1.gsd application
ONLINE
ONLINE
hpws1rac1
ora....ac1.ons application
ONLINE
ONLINE
hpws1rac1
ora....ac1.vip application
ONLINE
ONLINE
hpws1rac1
ora....SM1.asm application
ONLINE
ONLINE
hpws1rac2
ora....C2.lsnr application
ONLINE
ONLINE
hpws1rac2
TestHA.doc
14/26
ora....ac2.gsd
ora....ac2.ons
ora....ac2.vip
ora.ws1.db
ora.ws1.ha.cs
ora....s11.srv
ora....ataf.cs
ora....s11.srv
ora....11.inst
ora....12.inst
application
application
application
application
application
application
application
application
application
application
ONLINE
ONLINE
ONLINE
ONLINE
ONLINE
ONLINE
ONLINE
ONLINE
ONLINE
ONLINE
ONLINE
ONLINE
ONLINE
ONLINE
ONLINE
ONLINE
ONLINE
ONLINE
ONLINE
ONLINE
hpws1rac2
hpws1rac2
hpws1rac2
hpws1rac2
hpws1rac1
hpws1rac1
hpws1rac1
hpws1rac1
hpws1rac1
hpws1rac2
Wie Sie sehen, haben my-app und my-vip den Status OFFLINE.
Starten Sie nun die Applikation:
[root@hpws1rac1 ~]# $ORA_CRS_HOME/bin/crs_start my-app
Attempting to start `my-vip` on member `hpws1rac1`
Start of `my-vip` on member `hpws1rac1` succeeded.
Attempting to start `my-app` on member `hpws1rac1`
Start of `my-app` on member `hpws1rac1` succeeded.
[root@hpws1rac1 ~]#
Wegen der bestehenden Abhängigkeiten, startet my-vip automatisch vor my-app. Sie können
den Status durch den Befehl /opt/crs/bin/crs_stat –t prüfen:
[root@hpws1rac1 ~]# /opt/crs/bin/crs_stat -t
Name
Type
Target
State
Host
-----------------------------------------------------------my-app
application
ONLINE
ONLINE
hpws1rac2
my-vip
application
ONLINE
ONLINE
hpws1rac2
ora....SM2.asm application
ONLINE
ONLINE
hpws1rac1
ora....C1.lsnr application
ONLINE
ONLINE
hpws1rac1
ora....ac1.gsd application
ONLINE
ONLINE
hpws1rac1
ora....ac1.ons application
ONLINE
ONLINE
hpws1rac1
ora....ac1.vip application
ONLINE
ONLINE
hpws1rac1
ora....SM1.asm application
ONLINE
ONLINE
hpws1rac2
ora....C2.lsnr application
ONLINE
ONLINE
hpws1rac2
ora....ac2.gsd application
ONLINE
ONLINE
hpws1rac2
ora....ac2.ons application
ONLINE
ONLINE
hpws1rac2
ora....ac2.vip application
ONLINE
ONLINE
hpws1rac2
ora.ws1.db
application
ONLINE
ONLINE
hpws1rac2
ora.ws1.ha.cs application
ONLINE
ONLINE
hpws1rac1
ora....s11.srv application
ONLINE
ONLINE
hpws1rac1
ora....ataf.cs application
ONLINE
ONLINE
hpws1rac1
ora....s11.srv application
ONLINE
ONLINE
hpws1rac1
ora....11.inst application
ONLINE
ONLINE
hpws1rac1
ora....12.inst application
ONLINE
ONLINE
hpws1rac2
5.3 Starten der Client-Applikation
Starten Sie nun die Client-Applikation in Ihrem VNCServer auf dem zweiten Knoten, indem
Sie als User root folgende Kommandos absetzen:
[oracle@hpws1rac2 ~]$ su - root
Password:
[root@hpws1rac2 ~]# /home/oracle/workshop/myapp/Client/showapp.sh
TestHA.doc
15/26
Es öffnet sich ein grafisches Window, das anzeigt, wo die Applikation my-app derzeit läuft:
5.4 Verwaltung der Komponenten
Stoppen Sie my-app mittels crs indem Sie auf einem beliebiegen Knoten die folgenden
Kommandos absetzen:
[oracle@hpws1rac1 ~]$ /opt/crs/bin/crs_stop my-app
Attempting to stop `my-app` on member `hpws1rac1`
Stop of `my-app` on member `hpws1rac1` succeeded.
Prüfen Sie in der grafischen Anzeige den Status von my-app, diese sollte nun Application not
running anzeigen (Button Where is myapp betätigen!):
TestHA.doc
16/26
Starten Sie erneut die Applikation my-app:
[oracle@hpws1rac1 ~]$ /opt/crs/bin/crs_start my-app
Attempting to start `my-app` on member `hpws1rac1`
Start of `my-app` on member `hpws1rac1` succeeded.
Stoppen Sie den ersten Knoten, auf dem die Applikation läuft, prüfen Sie jedoch vorher, dass
die Client-Applikation auf dem zweiten Knoten aktiv ist:
[root@hpws1rac1 ~]# shutdown -rF now
Beobachten Sie mit der Client-Applikation, was mit der my-app Anwendung passiert. Die
Anwendung my-app sollte durch die Clusterware automatisch auf dem anderen Knoten erneut
gestartet werden. Der Zusammenhang mit my-vip wird deutlich, indem Sie das Kommando
/opt/crs/bin/crs_stat –t verwenden:
[oracle@hpws1rac2 ~]$ /opt/crs/bin/crs_stat -t
Name
Type
Target
State
Host
-----------------------------------------------------------my-app
application
ONLINE
OFFLINE
my-vip
application
ONLINE
ONLINE
hpws1rac1
ora....SM2.asm application
ONLINE
ONLINE …
kurze Zeit später:
[oracle@hpws1rac1 ~]$ /opt/crs/bin/crs_stat -t
Name
Type
Target
State
Host
-----------------------------------------------------------my-app
application
ONLINE
ONLINE
hpws1rac1
my-vip
application
ONLINE
ONLINE
hpws1rac1
ora....SM2.asm application
ONLINE
ONLINE …
TestHA.doc
17/26
Sobald der durchgestartete Knoten wieder da ist, können Sie die Anwendung my-app zurück
auf den ersten Knoten verschieben:
[oracle@hpws1rac1 ~]$ /opt/crs/bin/crs_relocate -f my-app
Attempting to stop `my-app` on member `hpws1rac1`
Stop of `my-app` on member `hpws1rac1` succeeded.
Attempting to stop `my-vip` on member `hpws1rac1`
Stop of `my-vip` on member `hpws1rac1` succeeded.
Attempting to start `my-vip` on member `hpws1rac2`
Start of `my-vip` on member `hpws1rac2` succeeded.
Attempting to start `my-app` on member `hpws1rac2`
Start of `my-app` on member `hpws1rac2` succeeded.
Nachdem Sie diesen Schritt durchgeführt haben, können Sie den Vorgang auch wieder
umkehren:
[oracle@hpws1rac1 ~]$ /opt/crs/bin/crs_relocate -f my-app -c hpws1rac1
Attempting to stop `my-app` on member `hpws1rac2`
Stop of `my-app` on member `hpws1rac2` succeeded.
Attempting to stop `my-vip` on member `hpws1rac2`
Stop of `my-vip` on member `hpws1rac2` succeeded.
Attempting to start `my-vip` on member `hpws1rac1`
Start of `my-vip` on member `hpws1rac1` succeeded.
Attempting to start `my-app` on member `hpws1rac1`
Start of `my-app` on member `hpws1rac1` succeeded.
5.5 Entfernen der Anwendung
Um die Anwendung wieder zu entfernen, rufen Sie zum Abschluß als User root folgende
Kommandos auf:
[oracle@hpws1rac1 myapp]$ su - root
Password:
[root@hpws1rac1 ~]# cd /home/oracle/workshop/myapp
[root@hpws1rac1 myapp]# . ./setmyapp.sh
[root@hpws1rac1 myapp]# /home/oracle/workshop/myapp/Server/rmapp.sh
Attempting to stop `my-app` on member `hpws1rac1`
Stop of `my-app` on member `hpws1rac1` succeeded.
Attempting to stop `my-vip` on member `hpws1rac1`
Stop of `my-vip` on member `hpws1rac1` succeeded.
TestHA.doc
18/26
6. Demonstration JDBC FCF (Fast Connection Failover)
Dieser Testfall zeigt die Funktionalitäten Fast Application Notification (FAN) und Fast
Connection Failover (FCF) mit einem Java Programm, das einen Connection Pool steuert.
Dieser Connection Pool wird durch den Oracle Notification Service (ONS) mit Nachrichten
über den Instanz Status (up/down) versorgt. Hierdurch wird die einwandfreie Funktion der
Connections im Pool sichergestellt.
6.1 Testumgebung
Die Testumgebung besteht aus folgenden Komponenten:
2 Java Programme:
o JDBC_Thin.java (ohne FCF, User cache)
o JDBC_Thin_FCF.java (mit FCF, User cachefcf)
2 Skripte zum Übersetzen der Java-Programme
o compil_JDBC_Thin.sh
o compil_JDBC_Thin_FCF.sh
2 Skripte zum Starten der Java-Programme
o run_JDBC_Thin.sh
o run_JDBC_Thin_FCF.sh
2 Skripte zum Prüfen der Datenbankverbindungen
o conn_cache.sh
o conn_cachefcf.sh
Benutzung Oracle JDBC Driver’s Pool Manager (JDBC Implicit Connection Cache)
Das Java Programm initialisiert den Pool mit 10 Verbindungen, die auf beide Cluster
Instanzen verteilt werden. Anschließend wird eine Verbindung aus dem Pool
verwendet.
Das Programm zeigt:
o Die Instanz, zu der die Verbindung besteht
o Die Anzahl der aktiven Verbindungen aus dem Pool
o Die Anzahl der verfügbaren Verbindungen aus dem Pool
6.2 Anlegen der Benutzer
Legen Sie nun die beiden Benutzer an, die für die zwei Demos verwendet werden. Dieses tun
Sie mit folgenden Kommandos als User oracle:
[oracle@hpws1rac1 ~]$ . oraenv
ORACLE_SID = [oracle] ? ws11
The Oracle base for ORACLE_HOME=/opt/oracle/product/db is /opt/oracle
[oracle@hpws1rac1 ~]$ cd /home/oracle/workshop/fcf
[oracle@hpws1rac1 fcf]$ ./createusercache.sh
6.3 Anlegen eines Service für FCF
Starten Sie die EM Console in einem Browser über den während der Installation notierten
Link (# durch Gruppennummer ersetzen):
TestHA.doc
19/26
https://hpws#rac1.de.oracle.com:1158/em
Melden Sie sich an als User system. Nach Erscheinen des Standardbildschirms klicken Sie auf
das Register Verfügbarkeit, dann auf den Link Cluster-verwaltete Datenbank-Services. Hier
sollten Sie die beiden bereits angelegten Services sehen.
Legen Sie durch drücken des Buttons Service erstellen einen Datenbank-Service an, der dem
FCF dient. Nennen Sie den Service fcf und legen Sie ihn mit den default Attributen an.
6.4 Anpassung und Übersetzung Java Programme
Passen Sie bitte in diesem Schritt noch die beiden Java Programme an. Hierzu sind lediglich
die Verbindungsinformationen (Aliase der virtuellen IP-Adresse beider Knoten) und die
Informationen zu dem angelegten Service folgendermaßen anzupassen:
[oracle@hpws1rac1 ~]$ cd /home/oracle/workshop/fcf
[oracle@hpws1rac1 fcf]$ vi JDBC_Thin.java
…
//Change this URL:
String dbURL="jdbc:oracle:thin:@" +
"(DESCRIPTION= " +
"(ADDRESS_LIST=(LOAD_BALANCE=ON)(FAILOVER=ON)" +
"(ADDRESS=(PROTOCOL=TCP)" +
"(HOST=hpws#rac1v)(PORT=1521))" +
"(ADDRESS=(PROTOCOL=TCP)" +
"(HOST=hpws#rac2v)(PORT=1521)))" +
"(CONNECT_DATA=(SERVICE_NAME=fcf)))";
…
:x!
[oracle@hpws1rac1 fcf]$ vi JDBC_Thin_FCF.java
…
//Change this URL:
String dbURL="jdbc:oracle:thin:@" +
"(DESCRIPTION= " +
"(ADDRESS_LIST=(LOAD_BALANCE=ON)(FAILOVER=ON)" +
"(ADDRESS=(PROTOCOL=TCP)" +
"(HOST=hpws#rac1v)(PORT=1521))" +
"(ADDRESS=(PROTOCOL=TCP)" +
"(HOST=hpws#rac2v)(PORT=1521)))" +
"(CONNECT_DATA=(SERVICE_NAME=fcf)))";
…
// For FCF:
ods.setFastConnectionFailoverEnabled(true);
ods.setONSConfiguration("nodes=hpws#rac1:6251,hpws#rac2:6251");
// FCF – End
…
:x!
Nun müssen diese Programme noch übersetzt werden:
[oracle@hpws1rac1 fcf]$ ./compil_JDBC_Thin.sh
[oracle@hpws1rac1 fcf]$ ./compil_JDBC_Thin_FCF.sh
Damit sind die vorbereitenden Arbeiten nun abgeschlossen und die Tests können beginnen.
TestHA.doc
20/26
6.5 Test ohne FCF
Fenster 1 (Knoten 1): Verbinden Sie sich als User oracle und lassen Sie das Skript
run_JDBC_Thin.sh laufen:
[oracle@hpws1rac1 ~]$ . oraenv
ORACLE_SID = [oracle] ? ws11
The Oracle base for ORACLE_HOME=/opt/oracle/product/db is /opt/oracle
[oracle@hpws1rac1 ~]$ cd /home/oracle/workshop/fcf
[oracle@hpws1rac1 fcf]$ ./run_JDBC_Thin.sh
Sie sehen dann folgende sich wiederholende Ausgaben:
Instance name: ws11
Url=jdbc:oracle:thin:@(DESCRIPTION=
(ADDRESS_LIST=(LOAD_BALANCE=ON)(FAILOVER=ON)(ADDRESS=(PROTOCOL=TCP)(HOST=hp
ws1rac1v)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=hpws1rac2v)(PORT=1521)))(
CONNECT_DATA=(SERVICE_NAME=FCF)))
NO FCF - Sessions Activ(cache): 1
NO FCF - Sessions Avail(cache): 9
Fenster 2 (Knoten1): In dem zweiten Fenster starten Sie als user oracle das Skript
conn_cache.sh, um die Verbindungen zur Datenbank zu sehen:
[oracle@hpws1rac1 ~]$ . oraenv
ORACLE_SID = [oracle] ? ws11
The Oracle base for ORACLE_HOME=/opt/oracle/product/db is /opt/oracle
[oracle@hpws1rac1 ~]$ cd /home/oracle/workshop/fcf
[oracle@hpws1rac1 fcf]$ ./conn_cache.sh
SQL*Plus: Release 11.1.0.7.0 - Production on Fri Sep 26 13:06:01 2008
Copyright (c) 1982, 2008, Oracle.
All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
INST_ID
---------1
1
1
1
1
1
1
2
2
2
USERNAME
-----------------------------CACHE
CACHE
CACHE
CACHE
CACHE
CACHE
CACHE
CACHE
CACHE
CACHE
10 rows selected.
TestHA.doc
21/26
Disconnected from Oracle Database 11g Enterprise Edition Release 11.1.0.7.0
- Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
In diesem Beispiel gibt es:
10 Datenbank Verbindungen
7 auf Instanz ws11
3 auf Instanz ws12
Das Java Programm läuft auf Instanz ws11
Fenster 3 (Knoten2): Der Zweck dieser Übung ist weniger zu zeigen, was mit der Java
Applikation passiert, wenn eine Instanz abbricht, sondern vielmehr, was mit dem
Verbindungs Pool passiert. Brechen Sie nun die Instanz, auf der die Java Anwendung nicht
läft, als User root mit dem Kommando kill –9 ab:
[root@hpws1rac2 ~]# ps -efa |grep smon
oracle
5913
1 0 Sep25 ?
00:00:00 asm_smon_+ASM1
oracle
6212
1 0 Sep25 ?
00:00:02 ora_smon_ws12
root
18298 18164 0 13:13 pts/3
00:00:00 grep smon
[root@hpws1rac2 ~]# kill -9 6212
Der Pool reagiert nicht, wie die Anzeige in Fenster 1 (Knoten1) zeigt:
Instance name: ws11
Url=jdbc:oracle:thin:@(DESCRIPTION=
(ADDRESS_LIST=(LOAD_BALANCE=ON)(FAILOVER=ON)(ADDRESS=(PROTOCOL=TCP)(HOST=hp
ws1rac1v)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=hpws1rac2v)(PORT=1521)))(
CONNECT_DATA=(SERVICE_NAME=FCF)))
NO FCF - Sessions Activ(cache): 1
NO FCF - Sessions Avail(cache): 9
Es sind immernoch 10 Verbindungen im Pool, ein erneuter Aufruf des Skriptes in Fenster 2
(Knoten 1) zeigt jedoch nur noch die 7 Verbindungen von Instanz ws11:
[oracle@hpws1rac1 fcf]$ ./conn_cache.sh
SQL*Plus: Release 11.1.0.7.0 - Production on Fri Sep 26 13:14:19 2008
Copyright (c) 1982, 2008, Oracle.
All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
INST_ID
---------1
1
1
1
TestHA.doc
USERNAME
-----------------------------CACHE
CACHE
CACHE
CACHE
22/26
1 CACHE
1 CACHE
1 CACHE
7 rows selected.
Disconnected from Oracle Database 11g Enterprise Edition Release 11.1.0.7.0
- Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
6.6 Test mit FCF
Fenster 1 (Knoten 1): Verbinden Sie sich als User oracle und lassen Sie das Skript
run_JDBC_Thin_FCF.sh laufen:
[oracle@hpws1rac1 ~]$ . oraenv
ORACLE_SID = [oracle] ? ws11
The Oracle base for ORACLE_HOME=/opt/oracle/product/db is /opt/oracle
[oracle@hpws1rac1 ~]$ cd /home/oracle/workshop/fcf
[oracle@hpws1rac1 fcf]$ ./run_JDBC_Thin_FCF.sh
Sie sehen dann folgende sich wiederholende Ausgaben:
Instance name: ws11
Url=jdbc:oracle:thin:@(DESCRIPTION=
(ADDRESS_LIST=(LOAD_BALANCE=ON)(FAILOVER=ON)(ADDRESS=(PROTOCOL=TCP)(HOST=hp
ws1rac1v)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=hpws1rac2v)(PORT=1521)))(
CONNECT_DATA=(SERVICE_NAME=fcf)))
FCF - Sessions Activ(cache): 1
FCF - Sessions Avail(cache): 9
Fenster 2 (Knoten1): In dem zweiten Fenster starten Sie als User oracle das Skript
conn_cachefcf.sh, um die Verbindungen zur Datenbank zu sehen:
[oracle@hpws1rac1 ~]$ . oraenv
ORACLE_SID = [oracle] ? ws11
The Oracle base for ORACLE_HOME=/opt/oracle/product/db is /opt/oracle
[oracle@hpws1rac1 ~]$ cd /home/oracle/workshop/fcf
[oracle@hpws1rac1 fcf]$ ./conn_cachefcf.sh
SQL*Plus: Release 11.1.0.7.0 - Production on Fri Sep 26 13:29:16 2008
Copyright (c) 1982, 2008, Oracle.
All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
INST_ID
---------1
1
1
TestHA.doc
USERNAME
-----------------------------CACHEFCF
CACHEFCF
CACHEFCF
23/26
1
1
1
2
2
2
2
CACHEFCF
CACHEFCF
CACHEFCF
CACHEFCF
CACHEFCF
CACHEFCF
CACHEFCF
10 rows selected.
Disconnected from Oracle Database 11g Enterprise Edition Release 11.1.0.7.0
- Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
In diesem Beispiel gibt es:
10 Datenbank Verbindungen
6 auf Instanz ws11
4 auf Instanz ws12
Das Java Programm läuft auf Instanz ws11
Fenster 3 (Knoten2): Wie in dem vorigen Test brechen Sie nun die Instanz, auf der die Java
Anwendung nicht läuft, als User root mit dem Kommando kill –9 ab:
[root@hpws1rac2 ~]# ps -efa |grep smon
oracle
5803
1 0 07:52 ?
00:00:00 asm_smon_+ASM2
oracle
25053
1 0 13:40 ?
00:00:00 ora_smon_ws12
root
32737 20427 0 13:51 pts/1
00:00:00 grep smon
[root@hpws1rac2 ~]# kill -9 25053
Der Pool wird benachrichtigt, wie die Anzeige in Fenster 1 (Knoten1) zeigt:
Instance name: ws11
Url=jdbc:oracle:thin:@(DESCRIPTION=
(ADDRESS_LIST=(LOAD_BALANCE=ON)(FAILOVER=ON)(ADDRESS=(PROTOCOL=TCP)(HOST=hp
ws1rac1v)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=hpws1rac2v)(PORT=1521)))(
CONNECT_DATA=(SERVICE_NAME=fcf)))
FCF - Sessions Activ(cache): 1
FCF - Sessions Avail(cache): 5
Es sind nur noch 1 aktive und 5 verfügbare Verbindungen Verbindungen im Pool, ein erneuter
Aufruf des Skriptes in Fenster 2 (Knoten 1) zeigt die 6 Verbindungen von Instanz ws11:
[oracle@hpws1rac1 fcf]$ ./conn_cachefcf.sh
SQL*Plus: Release 11.1.0.7.0 - Production on Fri Sep 26 13:14:19 2008
Copyright (c) 1982, 2008, Oracle.
All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
TestHA.doc
24/26
and Real Application Testing options
INST_ID
---------1
1
1
1
1
1
1
USERNAME
-----------------------------CACHE
CACHE
CACHE
CACHE
CACHE
CACHE
CACHE
6 rows selected.
Disconnected from Oracle Database 11g Enterprise Edition Release 11.1.0.7.0
- Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
Sobald die Instanz ws12 neu gestartet ist, wird der Pool erneut benachrichtigt und neue
Verbindungen werden bereitgestellt, wie Fenster 2 (Knoten 1) zeigt:
[oracle@hpws1rac1 fcf]$ ./conn_cachefcf.sh
SQL*Plus: Release 11.1.0.7.0 - Production on Fri Sep 26 14:07:01 2008
Copyright (c) 1982, 2008, Oracle.
All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
INST_ID
---------1
1
1
1
1
1
1
2
USERNAME
-----------------------------CACHEFCF
CACHEFCF
CACHEFCF
CACHEFCF
CACHEFCF
CACHEFCF
CACHEFCF
CACHEFCF
8 rows selected.
Disconnected from Oracle Database 11g Enterprise Edition Release 11.1.0.7.0
- Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
Das MinLimit (Pool Property) wird erreicht, sobald der Pool benutzt wird. In unserem
Beispiel ist dieses nicht der Fall. In dem Moment, wenn die abgebrochene Instanz
wiederanläuft, wird der Pool benachrichtigt und legt eine inaktive Verbindung zu der neuen
Instanz an.
TestHA.doc
25/26
Anmerkung (siehe MetaLink Note 371822.1: Fan: Implictcache Doesn'T Support Minlimit
After Instance Crash):
Gemäß JDBC Dokumentation gilt:
Setting the MinLimit property does not initialize the cache to contain the minimum
number of connections. To do this, use the InitialLimit property.
When InitialLimit is greater than MinLimit, it is possible to have any number of
connections specified by InitialLimit upto a value specified by MaxLimit. Therefore,
InitialLimit does not depend on MinLimit.
Connections can fall below the minimum limit set on the connection pool when JDBC
Fast Connection Failover DOWN events are processed. The processing removes
affected connections from the pool. MinLimit will be honored as requests to the
connection pool ramp up and the number of connections gets past the MinLimit value.
TestHA.doc
26/26
Herunterladen