Listener. ora/sqlnet. ora/tnsnames. ora configuration file details

Source: Internet
Author: User
Tags dedicated server

Oracle Network Configuration
The listener. ora, sqlnet. ora, and tnsnames. ora configuration files are all stored in the $ ORACLE_HOME/network/admin directory.

English description:

The sqlnet. ora is an optional file expressing more parameters about the connection (eg: the trace level for debugging, the types of authentication you wowould like to support and so on ). it may be found on the client or the server.

The tnsnames. ora is used to find a Net8 listener and connect to it and pass to it the details of the database instance youwowould like to connect. it will be found on the client side. note that a SERVER can be a client of another database so it is typical
To find it on the SERVER as well.

The listener. ora is used to setup the configuration of the net8 listener. to specify the port it will listen on, give it the details of the databases it can connect to and so on. this file is on the SERVER only.

1. sqlnet. ora ----- use this file to determine how to find a connection string that appears in the connection..
For example, we enter
Sqlplus sys/oracle @ ora
Assume that my sqlnet. ora is like the following:
SQLNET. AUTHENTICATION_SERVICES = (CNT)
NAMES. DIRECTORY_PATH = (TNSNAMES, HOSTNAME)
Then, the client will first be in tnsnames. find the records of ora in the ora file. if there is no corresponding record, try to treat ora as a host name, resolve its ip address through the network, and then connect to the instance GLOBAL_DBNAME = ora on this ip address, of course, I am not a host name here.

If I look like this
NAMES. DIRECTORY_PATH = (TNSNAMES)
Then the client will only search for ora records from tnsnames. ora. There are other options in brackets, such as LDAP, which are not commonly used.

2. tnsnames. ora ------ this file is similar to the unix hosts file and provides a corresponding tnsname to the host name or ip address. 
This file is used only when NAMES. DIRECTORY_PATH = (TNSNAMES) is similar to that in sqlnet. ora, that is, the client uses TNSNAMES to parse the connection string.
Example:
ORA_TEST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP) (HOST = 127.0.0.1) (PORT = 1521 ))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ora)
)
)

ORA_TEST: the service alias used by the client to connect to the server. Be sure to write at the top; otherwise, the Service alias cannot be recognized.
PROTOCOL: the PROTOCOL for communications between the client and the server, which is generally TCP.
HOST: the IP address or hostname of the ORACLE server. Make sure that the server listening starts properly.
PORT: the PORT on which the database listens. You can view the listener. ora file on the server or run the lnsrctl status [listener name] command at the command prompt on the machine where the database listens. The Port value must be the same as the Port on which the database listens.
SERVICE_NAME: on the server side, run the "sqlplus> show parameter service_name" command after logging on to the system.

3. listener. ora ------ listener process configuration file
The listener process is not much said. The listener process accepts remote database access requests and transfers them to the oracle server process. Therefore, if you do not use a remote connection, the listener process is not required. Similarly, disabling the listener process does not affect the existing database connection.
Example:
# Listener. ora Network Configuration File: # E:/oracle/product/10.1.0/Db_2/NETWORK/ADMIN/listener. ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = ora)
(ORACLE_HOME = E:/oracle/product/10.1.0/Db_2)
(SID_NAME = ora)
)
)

LISTENER =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = hostname) (PORT = 1521 ))
)

LISTENER: LISTENER name. Multiple listeners can be configured. The port numbers of multiple listeners must be separated.
GLOBAL_DBNAME: Global Database Name. Obtained through the select * from global_name; query
ORACLE_HOME: oracle software and Directory
SID_NAME: SID of the server (Local Machine)
PROTOCOL: Listener PROTOCOL, which generally uses TCP
HOST: the IP address of the Local Machine. Floating IP addresses are used for Dual Servers.
PORT: the listening PORT number. Use netstat-an to check whether the PORT is occupied.

When you enter sqlplus sys/oracle @ orcl
1. query sqlnet. ora and check the name resolution method. It is TNSNAME.
2. query the tnsnames. ora file, find the orcl record from the file, and find the host name, port, and service_name.
3. If there is no problem with the listener process, establish a connection with the listener process.
4. Depending on different server modes, such as dedicated server mode or shared server mode, listener takes the next action. The default mode is dedicated server. If there is no problem, the client will connect to the server process of the database.
5. At this time, the network connection has been established, and the historical mission of the listener process has been completed.

Basic mechanism of SQL * plus operation:
After you enter sqlplus system/manager @ test, the sqlplus program automatically goes to sqlnet. find NAMES in the ora file. DEFAULT_DOMAIN parameter. If this parameter exists, the value in this parameter is taken out and added to the name of the network service, in this example, your input is automatically changed from sqlplus system/manager @ test to sqlplus system/manager@test.server.com, and then to tnsnames. the Network Service name test.server.com cannot be found in the ora file, because the file contains only the test network service name, so an error is returned. The solution is to comment out the NAMES. DEFAULT_DOMAIN parameter in the sqlnet. ora file, as shown in figure
# NAMES. DEFAULT_DOMAIN = server.com. Suppose NAMES. if the DEFAULT_DOMAIN parameter does not exist, the sqlplus program directly goes to tnsnames. find the name of the test network service in the ora file, and then extract the host, port, tcp, and service_name from the file to send the connection request to the correct database server.

Address: http://blog.csdn.net/aten_xie/article/details/6174069

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.