ITPub博客

首页 > 数据库 > 数据库开发技术 > rac

rac

原创 数据库开发技术 作者:atgc 时间:2007-07-10 17:05:38 0 删除 编辑

参考文档
http://download-west.oracle.com/doc...g.htm#NETAG0153


假设存在2 instance sales1 and sales2
数据库 sales

client 设置

sales.us.acme.com=
(DESCRIPTION=
(LOAD_BALANCE=on)
(FAILOVER=on)
(ADDRESS=(PROTOCOL=tcp)(HOST=sales1-server)(PORT=1521))
(ADDRESS=(PROTOCOL=tcp)(HOST=sales2-server)(PORT=1521))
(CONNECT_DATA=(SERVICE_NAME=sales.us.acme.com)))



sales1 上 tnsnames.ora内容

listener_sales2=
(DESCRIPTION=
(ADDRESS=(PROTOCOL=tcp)(HOST=sales2-server)(PORT=1521)))

sales1 上spfile内容

REMOTE_LISTENER=listener_sales2
service_names=sales.us.acme.com
instance_name = sales1



这里使用到 tnsnames.ora 中的 listener_sales2 表示instance启动的时候pmon通过tnsnames中服务名连接注册到指定的listener


同理,在sales2上
tnsnames.ora

listener_sales1=
(DESCRIPTION=
(ADDRESS=(PROTOCOL=tcp)(HOST=sales1-server)(PORT=1521)))


spfile

REMOTE_LISTENER=listener_sales1
service_names=sales.us.acme.com
instance_name = sales2







*****************************************************************************************************
几种client TAF 配置方式

Example: TAF with Connect-Time Failover and Client Load Balancing
Implement TAF with connect-time failover and client load balancing for multiple addresses.
In the following example, Oracle Net connects randomly to one of the protocol addresses
on sales1-server or sales2-server. If the instance fails after the connection,
the TAF application fails over to the other node's listener, reserving any SELECT statements in progress.

sales.us.acme.com=
(DESCRIPTION=
(LOAD_BALANCE=on)
(FAILOVER=on)
(ADDRESS=
(PROTOCOL=tcp)
(HOST=sales1-server)
(PORT=1521))
(ADDRESS=
(PROTOCOL=tcp)
(HOST=sales2-server)
(PORT=1521))
(CONNECT_DATA=
(SERVICE_NAME=sales.us.acme.com)
(FAILOVER_MODE=
(TYPE=select)
(METHOD=basic))))

Example: TAF Retrying a Connection
TAF also provides the ability to automatically retry connecting if the first
connection attempt fails with the RETRIES and DELAY parameters.
In the following example, Oracle Net tries to reconnect to the listener on sales1-server.
If the failover connection fails, Oracle Net waits 15 seconds before trying to reconnect again.
Oracle Net attempts to reconnect up to 20 times.

sales.us.acme.com=
(DESCRIPTION=
(ADDRESS=
(PROTOCOL=tcp)
(HOST=sales1-server)
(PORT=1521))
(CONNECT_DATA=
(SERVICE_NAME=sales.us.acme.com)
(FAILOVER_MODE=
(TYPE=select)
(METHOD=basic)
(RETRIES=20)
(DELAY=15))))

Example: TAF Pre-Establishing a Connection
A backup connection can be pre-established. The initial and backup connections must be explicitly specified.
In the following example, clients that use net service name sales1.us.acme.com to connect to the listener
on sales1-server are also preconnected to sales2-server. If sales1-server fails after the connection,
Oracle Net fails over to sales2-server, preserving any SELECT statements in progress. Likewise,
Oracle Net preconnects to sales1-server for those clients that use sales2.us.acme.
com to connect to the listener on sales2-server.

sales1.us.acme.com=
(DESCRIPTION=
(ADDRESS=
(PROTOCOL=tcp)
(HOST=sales1-server)
(PORT=1521))
(CONNECT_DATA=
(SERVICE_NAME=sales.us.acme.com)
(INSTANCE_NAME=sales1)
(FAILOVER_MODE=
(BACKUP=sales2.us.acme.com)
(TYPE=select)
(METHOD=preconnect))))
sales2.us.acme.com=
(DESCRIPTION=
(ADDRESS=
(PROTOCOL=tcp)
(HOST=sales2-server)
(PORT=1521))
(CONNECT_DATA=
(SERVICE_NAME=sales.us.acme.com)
(INSTANCE_NAME=sales2)
(FAILOVER_MODE=
(BACKUP=sales1.us.acme.com)
(TYPE=select)
(METHOD=preconnect))))





FAILOVER_MODE Parameters
The FAILOVER_MODE parameter must be included in the CONNECT_DATA section of a connect descriptor.
FAILOVER_MODE can contain the subparameters described in Table 15-6.

Table 15-6 Subparameters of the FAILOVER_MODE Parameter
FAILOVER_MODE Subparameter Description
BACKUP
Specify a different net service name for backup connections.
A backup should be specified when using preconnect to pre-establish connections.

TYPE
Specify the type of failover. Three types of Oracle Net failover functionality are available by
default to Oracle Call Interface (OCI) applications:

session: Set to failover the session. If a user's connection is lost,
a new session is automatically created for the user on the backup.
This type of failover does not attempt to recover selects.
select: Set to enable users with open cursors to continue fetching on them after failure.
However, this mode involves overhead on the client side in normal select operations.
none: This is the default. No failover functionality is used.
This can also be explicitly specified to prevent failover from happening.

METHOD
Determines how fast failover occurs from the primary node to the backup node:

basic: Set to establish connections at failover time.
This option requires almost no work on the backup server until failover time.
preconnect: Set to pre-established connections. This provides faster failover but requires that the
backup instance be able to support all connections from every supported instance.

RETRIES
Specify the number of times to attempt to connect after a failover.
If DELAY is specified, RETRIES defaults to five retry attempts.

Note: If a callback function is registered, then this subparameter is ignored.

DELAY
Specify the amount of time in seconds to wait between connect attempts.
If RETRIES is specified, DELAY defaults to one second.

Note: If a callback function is registered, then this subparameter is ignored.



--------------------------------------------------------------------------------
Note:
Oracle Net Manager does not provide support for TAF parameters. These parameters must be manually added.

--------------------------------------------------------------------------------


TAF Implementation
Important:
Do not set the GLOBAL_DBNAME parameter in the SID_LIST_listener_name section of the listener.ora.
A statically configured global database name disables TAF.

[@more@]

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/94041/viewspace-925784/,如需转载,请注明出处,否则将追究法律责任。

下一篇: from asktom
请登录后发表评论 登录
全部评论

注册时间:2008-01-18

  • 博文量
    22
  • 访问量
    217030