|
|
最初由 husthxd 发布
[B]For Example:
This is a four nodes cluster setup. The configuration is as follows. If you
replace your hostname, service_name, sid_name, instance_name and $ORACLE_HOME
in the example files, you should be able to configure a successful setup.
hostname service name sid name instance_name ORACLE_HOME
======== ============ ======== ============= =====================
node1 hprac-22 rac rac1 rac1 /oracle/9iship/rac901
node2 hprac-23 rac rac2 rac2 /oracle/9iship/rac901
node3 hprac-24 rac rac3 rac3 /oracle/9iship/rac901
node4 hprac-25 rac rac4 rac4 /oracle/9iship/rac901
All 4 nodes init.ora file have the following parameters:
remote_listener='LISTENERS_RAC'
rac1.local_listener="LISTENER_rac1�
rac2.local_listener="LISTENER_rac2"
rac3.local_listener="LISTENER_rac3"
rac4.local_listener="LISTENER_rac4"
# dispatchers="(pro=ipc)(dis=0)"
db_name='rac'
rac1.instance_name='rac1'
rac2.instance_name='rac2'
rac3.instance_name='rac3'
rac4.instance_name='rac4'
Since service_names is not specified in the init.ora file, it defaults to
db_name.db_domain. Each node should list it's own host name and instance_name.
With the above setup, after you start the instance, when checking the sql
session from node1, you will find the following info.
SQL> show parameter db_name
NAME TYPE VALUE
--------------------------- --------- -----------------------------------------
db_name string rac
SQL> show parameter db_domain
NAME TYPE VALUE
--------------------------- --------- -----------------------------------------
db_domain string
SQL> show parameter service_names
NAME TYPE VALUE
--------------------------- --------- -----------------------------------------
service_names string rac
SQL> show parameter instance_name
NAME TYPE VALUE
--------------------------- --------- -----------------------------------------
instance_name string rac1
SQL> show parameter listener
NAME TYPE VALUE
---------------------- ----- ----------------------------------------------
local_listener string LISTENER_rac1
mts_listener_address string
mts_multiple_listeners boolean FALSE
remote_listener string LISTENERS_RAC
hprac-22 listener.ora file
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
)
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = hprac-22)(PORT = 1521))
)
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /oracle/9iship/rac901)
(PROGRAM = extproc)
)
(SID_DESC =
(ORACLE_HOME = /oracle/9iship/rac901)
(SID_NAME = rac1)
)
)
hprac-22 ~ hprac-25 and client side tnsnames.ora file
LISTENERS_RAC =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = hprac-22)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = hprac-23)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = hprac-24)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = hprac-25)(PORT = 1521))
)
)
RAC1 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = hprac-22)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = rac)
(INSTANCE_NAME = rac1)
)
)
RAC2 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = hprac-23)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = rac)
(INSTANCE_NAME = rac2)
)
)
RAC3 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = hprac-24)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = rac)
(INSTANCE_NAME = rac3)
)
)
RAC4 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = hprac-25)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = rac)
(INSTANCE_NAME = rac4)
)
)
RAC =
(DESCRIPTION =
(LOAD_BALANCE = yes)
(ADDRESS = (PROTOCOL = TCP)(HOST = hprac-22)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = hprac-23)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = hprac-24)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = hprac-25)(PORT = 1521))
(CONNECT_DATA =
(SERVICE_NAME = rac)
)
)
failover =
(DESCRIPTION =
(enable=broken)
(LOAD_BALANCE = yes)
(ADDRESS = (PROTOCOL = TCP)(HOST = hprac-22)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = hprac-23)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = hprac-24)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = hprac-25)(PORT = 1521))
(CONNECT_DATA =
(SERVICE_NAME = rac)
(failover_mode=(type=select)(method=basic))
)
)
# For hprac-22 only
LISTENER_rac1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = hprac-22)(PORT = 1521))
)
# For hprac-23 only
LISTENER_rac2 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = hprac-23)(PORT = 1521))
)
# For hprac-24 only
LISTENER_rac3 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = hprac-24)(PORT = 1521))
)
# For hprac-25 only
LISTENER_rac4 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = hprac-25)(PORT = 1521))
)
Remarks:
1) LISTENERS_RAC, LISTENER_rac1, LISTENER_rac2, LISTENER_rac3, LISTENER_rac4,
is the net_service_name (connect descriptor) for remote_listener and
local_listener. On the client side, you do not need these net_service_name.
2) failover is the net_service_name for transparent application failover (TAF)
testing.
3) RAC is the net_service_name for client side load balance, if you do not
need to configure TAF.
There are few different ways to set up client side connect time load balance.
Here is another alternative:
4) RAC_alternative =
(DESCRIPTION =
(ADDRESS_LIST =
(LOAD_BALANCE = yes)
(ADDRESS = (PROTOCOL = TCP)(HOST = hprac-22)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = hprac-23)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = hprac-24)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = hprac-25)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = rac)
)
)
Note: The (load_balance=yes) instructs Net to progress through the list of
listener addresses in a random sequence, balancing the load on the various
listeners. When set to OFF, instructs Net to try the addresses sequentially
until one succeeds. This parameter must be correctly coded in your net
service name (connect descriptor). By default, this parameter is set to ON
for DESCRIPTION_LISTs. Load balancing can be specified for an ADDRESS_LIST or
associated with a set of ADDRESSes or set DESCRIPTIONs. If you use ADDRESS_LIST,
(load_balance=yes) should be within the (ADDRESS_LIST=) portion. If you do
not use ADDRESS_LIST, (load_balance=yes) should be within the (description=)
portion. We recommend not to use this (ADDRESS_LIST=) clause.
5) (failover=on) is default for ADDRESS_LISTs, DESCRIPTION_LISTs, and a set of
DESCRIPTIONs., therefore, you do not have to specify. This is for
connect-time-failover, please do not confuse it with transparent application
failover (TAF).
6) (failover_mode=): The FAILOVER_MODE parameter must be included in the
CONNECT_DATA portion of a net_service_name.
7) There is no (backup=failover) in (failover_mode=), this implies
(failover_mode=(type=select)(method=basic)(backup=failover)), which means
whenever failover occurs, the connected session will failover to the
net_service_name failover again. A backup should be specified when using
PRECONNECT to pre-establish connections. For details of TAF, please refer to
Oracle official documentations.
9i的配置,10g类似. [/B]
9i和10g不一样,
10g为了实现完全脱离ha,所以所有外界连接都是通过vip的. |
|