Sqlnet. ora, tnsnames. ora, and listener. ora files used for Oracle Network Configuration

Source: Internet
Author: User
Tags dedicated server

Listener. ora, tnsnames. ora, and sqlnet. ora are the three main files related to Oracle network configuration. They are all stored in the $ ORACLE_HOME \ Network \ ADMIN directory. Listener. ora is related to the database server, while tnsnames. ora and sqlnet. ora are not only related to the server, but also closely related to the client.

I. Client settings
1. sqlnet. ora

This file is used to determine how to find a connection string

Example file:
# Sqlnet. ora network configuration file: F: \ oracle \ product \ 10.2.0 \ db_1 \ Network \ admin \ sqlnet. ora
# Generated by Oracle configuration tools.

# This file is actually generated by netca. But if MERs choose
# Install "software only", this file wont exist and without the native
# Authentication, they will not be able to connect to the database on NT.

Sqlnet. authentication_services = (CNT)

Names. directory_path = (tnsnames, hostname, onames, ezconnect)

# names. default_domain = oracle.com

Description:
sqlnet. authentication_services = (CNT) ---- This indicates that OS authentication is used. sqlplus/As sysdba can be used on the database server. Generally, this configuration is OK on Windows and may be faulty in Unix. This configuration can be removed in UNIX.
names. directory_path = (tnsnames, hostname, onames) ---- indicates that tnsnames will be used for parsing first. If tnsnames cannot be parsed, hostname will be used for parsing. If hostname cannot be parsed, onames will be used for parsing; use ezconnect for resolution. For example, if we enter sqlplus Zidi/Zidi @ Changbai on the client, the client will first be in tnsnames. orcl records in the ora file. if there is no corresponding record, try to use orcl as a host name, resolve its IP address through the network, and then connect to the instance global_name = Changbai on this IP address, of course, here, orcl is not a host name.
commented out names. default_domain = changyun.com ---- indicates that the default domain name is changyun.com. if the corresponding resolution is configured in ora, if the original database alias is oralocal (that is, the network service name), after enabling this parameter, the configuration in tnsnames should be changed to oralocal.changbai.com. When you use tnsping or sqlplus to log on, you only need to write the preceding alias. The system will automatically add the following domain name for resolution.

2. tnsnames. ora
This file is stored on the client machine and records the local configuration of client access to the database. In fact, it defines network services only when sqlnet. ora contains "names. directory_path = (tnsnames) "is used only when the client parses the connection string in the order of tnsnames.
Example file:
# Tnsnames. ora network configuration file: F: \ oracle \ product \ 10.2.0 \ db_1 \ Network \ admin \ tnsnames. ora
# Generated by Oracle configuration tools.

Huinamn = network service name
(Description =
(Address_list =
(Address = (Protocol = TCP) (host = 108.108.108.108) (Port = 1521) The protocol used to access the database, the host name or IP address of the database computer, and the database port number.
)
(CONNECT_DATA =
(SID = HN) database instance name, provided that the connected database is oracle8 or earlier
)
)
Changbai =
(Description =
(Address_list =
(Address = (Protocol = TCP) (host = 208.208.208.208) (Port = 1521 ))
)
(CONNECT_DATA =
(SERVICE_NAME = CB) Database Service name, that is, Global Database Name
)
)
Orcl =
(Description =
(Address_list =
(Address = (Protocol = TCP) (host = localhost) (Port = 1521 ))
)
(CONNECT_DATA =
(Server = dedicated) use the dedicated server mode to connect, which needs to match the server mode. If not, it is automatically adjusted according to the server mode.
(SERVICE_NAME = orcl)
)
)

Ii. Set listener. ora on the server
It is the configuration file of the listener process. 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 file:
# Listener. ora network configuration file: F: \ oracle \ product \ 10.2.0 \ db_1 \ Network \ admin \ listener. ora
# Generated by Oracle configuration tools.

Sid_list_listener = specifies the instance for which the listener process provides services.
(Sid_list =
(Sid_desc =
(Sid_name = plsextproc)
(ORACLE_HOME = F: \ oracle \ product \ 10.2.0 \ db_1)
(Program = EXTPROC)
)
)

Listener = listener name. A database can have more than one listener.
(Description_list =
(Description =
(Address = (Protocol = IPC) (Key = extproc1) protocol, IP address, port, etc.
(Address = (Protocol = TCP) (host = dabeng) (Port = 1521 ))
)
)
The above example is the simplest, but also the most common. A listener process provides services for a database instance (SID.
Iii. Summary
The three files mentioned above can be configured through the graphical Configuration tool: Database Configuration assistant, net configuration Assistant
You can try the specific configuration, and then look at the configuration file, so that the overall structure is available, when you enter sqlplus Zidi/Zidi @ Changbai
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.
From another perspective:
Changbai is the service name used to connect to the remote database, but it must be converted to a connection string such as host: Port: servide_name, which can be understood as a translation process, to make the translation successful, You must select a proper translation method. Then, sqlnet. ora is used to select the translation method, among which names. directory_path = (tnsnames) is the name resolution method we selected; tnsnames. ora is a configuration file of the local name resolution method in the translation method, as if we chose the Dictionary Lookup method, this file stores the connection strings corresponding to all service names in the same way as our dictionary; as for listener. ora is the responsible person responsible for receiving our request-the connection address configuration file, which contains the connection address of the connection owner and the information of the database that can be connected through him. This constitutes the network architecture of oracle.

Related Article

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.