Oracle Faq (Oracle TAF configuration)_PHP tutorial
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.

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



SQL*Plus is a command-line tool for interacting with Oracle databases. Its main functions include executing SQL statements, querying data, creating tables, and managing users. It is easy to use, cross-platform compatible, and provides strong access to Oracle databases, but is limited to the command-line interface and lacks a graphical user interface.

How to view table notes in Navicat: Connect to the database and navigate to the target table. Switch to the Notes tab. Check whether there is any table notes.

Navicat for Oracle does not support viewing database passwords for security reasons. If you forget your password, you can reset it by using the system's own tools (such as sqlplus) and having sufficient permissions. Use the database password reset mechanism to contact the database administrator or refer to the official documentation. Reinstall the configuration database (most thorough but clumsiest).

不同数据库系统添加列的语法为:MySQL:ALTER TABLE table_name ADD column_name data_type;PostgreSQL:ALTER TABLE table_name ADD COLUMN column_name data_type;Oracle:ALTER TABLE table_name ADD (column_name data_type);SQL Server:ALTER TABLE table_name ADD column_name data_

Steps to perform SQL in Navicat: Connect to the database. Create a SQL Editor window. Write SQL queries or scripts. Click the Run button to execute a query or script. View the results (if the query is executed).

To connect to a database using Navicat, perform the following steps in sequence: Create a connection in Navicat. Enter the host name, port, user name, password, and database name. Adjust advanced settings (optional). Save the connection. Test the connection. Connect to the database. View the database object.

Navicat password reset: Confirm reset target: Navicat connection password or database user password. Navicat connection password reset: Modify the connection configuration in Navicat. Reset the database user password (taking MySQL as an example): Use a user with permission to log in to the server and execute the SQL statement SET PASSWORD. Pay attention to permission issues, password strength and root password forgetting. Other database types are different, so you need to consult the document. It is recommended to use a password manager to store the database password securely.

Add Columns in SQL Graphics Tool: Select the table to which columns you want to add. Right-click and select "Alter Table" or similar options. Defines the properties of the new column (name, data type, length, or whether it is empty). Specifies the default value for the new column, if applicable. Select the appropriate data type to avoid data errors. Use meaningful column names. Consider the performance impact when performing column addition operations on large tables. Always back up the database before the operation to prevent data loss.
