Home  >  Article  >  Backend Development  >  Oracle Faq (Oracle TAF configuration)_PHP tutorial

Oracle Faq (Oracle TAF configuration)_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 16:10:29929browse


If you need to reprint, please indicate the source! (Thank you in advance, Diao Yan...)
Oracle TAF configuration

TAF is the abbreviation of Transparent Application FailOver. Generally, TAF is applied in the OPS/RAC environment. This function, which has been available since 8i, has a good purpose and idea, but its current application is still very limited. This article will discuss in detail TAF-related issues.

The test environment of this article is Tru64 V5.1+ Oracle9.2.0.1 RAC.

1. Description of related parameters

To be honest, Oracle’s several configuration parameters about the network are really messy. Many people can’t figure out what is going on. Common mistakes For:
"ORA-12514 :TNS:listener could not resolve SERVICE_NAME given in connect descriptor" and
"ORA-12154 :TNS: Could not resolve service name"
The essence is the same and needs to be solved Such a problem requires us to fiddle with several parameters:

Several parameters in initsid.ora:
DB_NAME --- database name, which is the name provided when building the database.
GLOBAL_NAMES --- True/false, set whether to use the database domain name.
DB_DOMAIN --- Database domain name, if GLOBAL_NAMES=True, this parameter is required.
SERVICE_NAMES --- service names list, there can be multiple service names.

INSTANCE_NAME --- instance name, supported starting from 817 like SERVICE_NAMES, that is, starting from 817, database, instance and service names can be separated. The default value of instance_name is the SID of the instance, which is the value corresponding to the environment variable ORACLE_SID. Before 817, when there was no instance_name parameter, different instances were distinguished by SID. According to the document explanation after oracle817: SID is to distinguish the shared memory of each instance on the same host. It is not the only distinguishing mark of the instance, and instance_name is to distinguish each instance.

Environment variable:
ORACLE_SID --- When there was no instance_name parameter before 817, different instances were distinguished by SID (see the initsid.ora parameter explanation above for details).

Several parameters in listener.ora:
GLOBAL_DBNAME --- global database name, uniquely determines different databases in a distributed environment. Its value is the combination of DB_NAME and DB_DOMAIN in initsid.ora, that is, GLOBAL_DBNAME=DB_NAME.DB_DOMAIN, where DB_DOMAIN is not needed if it is not set here. This parameter is recommended to be specified explicitly in distributed environments.
SERVICE_NAME --- Service name, just select one from the service_names list in initsid.ora.
SID_NAME --- The value corresponding to the environment variable ORACLE_SID.
INSTANCE_NAME ---corresponds to the initialization parameter instance_name.

Several parameters in tnsnames.ora:
service_name --- service name, just take the service_names list in initsid.ora to one.
sid_name --- can be abbreviated as: sid, corresponding to ORACLE_SID, or it can be the initialization parameter instance_name. When it is equal to instance_name and instance_name is not equal to ORACLE_SID, Oracle will automatically register a listening process, which is used to distinguish different instances.
instance_name --- Starting from 817, this new parameter can be used, corresponding to the initialization parameter instance_name.

In this way, the parameters will be very complicated, but we will not use them in actual use. Of course, the simpler the better in October.

2. Related parameter settings

Below I will give examples to illustrate the settings of related parameters:
1. Environment variable: ORACLE_SID=rac1/2

2. initsid. ora:
db_name=ora92
service_names = ora92
instance_name=rac1/2
global_names=false
db_domain=""

3. listener.ora:
SID_LIST_RAC1 =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = ora92)
(ORACLE_HOME = /oracle/oracle9/app/oracle/product/9.2.0)
(SERVICE_NAME=ora92 )(SID_NAME = rac1)
)
)

SID_LIST_RAC2 =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = ora92)
(ORACLE_HOME = /oracle /oracle9/app/oracle/product/9.2.0)
(SERVICE_NAME=ora92)(SID_NAME = rac2)
)
)

RAC1 =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.1.3.1)(PORT = 1522))
)
)
)

RAC2 =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.1.3.2)(PORT = 1522))
)
)
)

3. TAF settings
In fact, TAF settings are very simple. Just add failover=on in tnsnames.ora. There are two different setting methods:
1. Common tns name method: =========================================== =========
myrac =
(description=
(load_balance=on)
(failover=on)
(address= (protocol=tcp)(host= 10.1.3.1)(port=1522))
(address= (protocol=tcp)(host=10.1.3.2)(port=1522))
(connect_data= (service_name=ora92)
(failover_mode =(type=select)(method=basic)(retries=20)(delay=20))
)
)
================= ================================================== =======

2. Specify the instance backup method: ============================== =================
rac1 =
(description=
(load_balance=on)
(failover=on)
(address= (protocol=tcp)(host=10.1.3.1)(port=1522))
(connect_data= (service_name=ora92)
(failover_mode=(type=select)(method=basic)
(backup =rac2)(retries=20)(delay=20))
)
)

rac2 =
(description=
(load_balance=on)
(failover= on)
(address= (protocol=tcp)(host=10.1.3.2)(port=1522))
(connect_data= (service_name=ora92)
(failover_mode=(type=select)(method =basic)
(backup=rac1)(retries=20)(delay=20))
)
)
================= ================================================== =======

4. TAF test method
Generally, the currently connected instance can be brought down. The client will not be disconnected and will automatically switch to the backup node. On the contrary, it will automatically switch back.

Of course, some people have proposed using post_transaction to test TAF. In fact, this sometimes does not result in the expected results. The reason is that after Oracle connects to an instance, it will try to connect to the instance first. When you disconnect, the client will automatically try to connect to the most recently connected instance whenever there is a new request. If unsuccessful, it will try to connect to the backup instance.





www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/314196.htmlTechArticleIf you need to reprint, please indicate the source! (Thank you in advance, Diao Chan...) Configuration of Oracle TAF TAF is the abbreviation of Transparent Application FailOver. Generally, TAF is applied in the OPS/RAC environment. ...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn