The 3 files of the Listener.ora, Tnsnames.ora, and Sqlnet.ora are the 3 main files that are related to the ORACLE network configuration and are placed in the $oracle_home\network\admin directory. Where Listener.ora is related to the database server side, and Tnsnames.ora and Sqlnet.ora these 2 files are not only related to the server side, the main or the client close.
One, client settings
1.sqlnet.ora
Use this file to determine how to find a connection string that appears in a connection ORCL
Sql>conn sys/[email protected] as Sysdba
Sample files:
# Sqlnet.ora Network Configuration File:f:\oracle\product\10.2.0\db_1\network\admi\sqlnet.ora
# Generated by Oracle configuration tools.
# This file was actually generated by NETCA. But if customers choose to
# install ' Software only ', this file wont exist and without the native
# Authentication, they'll is not being able to connect to the database on NT.
Sqlnet. Authentication_services= (NTS)
NAMES. Directory_path= (Tnsnames,hostname, Onames, Ezconnect)
#NAMES. Default_domain = oracle.com
Content Description:
sqlnet. authentication_services= (NTS)----This indicates OS authentication, and on the database server, Sqlplus/as SYSDBA can be exploited. Generally this configuration on Windows is OK, in the UNIX environment may be problematic, generally under Unix can be removed from this configuration.
NAMES. Directory_path= (TNSNames, HOSTNAME, onames)----indicates that the tnsnames will be used first to parse, and if TNSNames is not resolved, HOSTNAME parsing will be used, and if HOSTNAME cannot be resolved, The onames will be used for parsing, and finally the ezconnect is used. For example our client input: Sqlplustest/[email protected] , the client will first find the ORCL record in the Tnsnames.ora file. If there is no corresponding record, try to use the ORCL as a hostname, through the network to resolve its IP address and then to connect to the IP global_name= ORCL this instance, of course I orcl here is not a hostname.
commented-Out names.default_domain = changbai.com----that the default domain name is changbai.com, if the corresponding resolution is configured in Tnsnames.ora, if the original database alias is oralocal (that is, the network service name), then when this parameter is enabled, The configuration in TNSNames is changed to oralocal.changbai.com. When using tnsping or Sqlplus login, just write the previous alias, the system will automatically add the following domain name to parse.
2.tnsnames.ora
This file is placed on the client machine, which records the local configuration of the client's access to the database, in fact, defines the network service only if there is "NAMES" in Sqlnet.ora. Directory_path= (tnsnames), this file is only attempted when there is tnsnames in the order in which the client resolves the connection string.
Sample files:
# 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))//access the database using the protocol, the database computer hostname or IP address, the port number of the database
)
(Connect_data =
(SID = HN)//DB instance name, if the connected database is Oracle8 or lower
)
)
ORCL =
(DESCRIPTION =
(Address_list =
(ADDRESS = (PROTOCOL = TCP) (HOST = localhost) (PORT = 1521))
)
(Connect_data =
(server = dedicated)//use private server mode to connect, which needs to match the server mode, if not, automatically adjust according to the server mode
(service_name = ORCL)//database service name, which is the global database name, sql>show parameter service_name view
)
)
Two, server-side settings Listener.ora
It is the configuration file for the listener listener process. As for the listener process, it is not much to say, accept remote access to the database and transfer the server process to Oracle. So if you are not using a remote connection, the listener process is not required, as is the case if shutting down the listener process does not affect the database connection that already exists.
Sample 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 = //Here defines which instance the LISTENER process serves
(sid_list =
(Sid_desc =
(Sid_name = Plsextproc)
(Oracle_home =/u01/oracle/product/10.2.0/db_1)
(program = extproc)
)
--------------- Static registration ORCL Simply add the following-----------
(Sid_desc =
(global_dbname = ORCL)
(Oracle_home =/u01/oracle/product/10.2.0 /db_1)
(sid_name = ORCL)
)
----------------------------------------------------
)
LISTENER =//listener name, a database can have more than one listener
(Description_list =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = Dabeng) (port = 1521))//Listener Listening Protocol, IP, port, etc.
(ADDRESS = (PROTOCOL = IPC) (KEY = EXTPROC1))
)
)
The above example is one of the simplest examples, but it is also the most common. A listener process provides services for a DB instance (SID).
======================
Configure dynamic Listening: Set parameters Local_listener,instance_name and service_names three parameters in the database, write to SPFile, and then restart the database.
Sql> alter system set local_listener= ' (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.80.128) (PORT = 1521)) ' Scope=spfile;
Sql> alter system set Instance_name= ' ORCL ' scope=spfile;
Sql> alter system set service_names= ' ORCL ' scope=spfile;
sql> shutdown Immediate
Iii. Summary
The three files mentioned above can be configured using the graphical Configuration tool: Database configuration assistant,net Configuration Assistant
$ netca //Open graphical interface
or with $ NETMGR   &NBSP
Profile is configured with Sqlnet.ora, which is how name resolution
Service name is configured with Tnsnames.ora file
Listeners is configured with the Listener.ora file, which is the listener process
Specific configuration can try, and then look at the configuration file, so that the overall structure is, when you enter sql>sqlplustest/[email protected]
1. Query Sqlnet.ora look at the name of the parsing method, found to be tnsname
2. Query the Tnsnames.ora file, find the ORCL record from the inside, and find the hostname, port and Service_Name
3. If there is no problem with the listener process, establish a connection to the listener process.
4. Depending on the server mode, such as dedicated server mode or shared server mode, listener takes the next action. The default is the private server mode, and the client connects to the database's server process if there is no problem.
5. Now that the network connection has been established, the historical mission of the listener process has been completed.
A different angle to understand:
ORCL is the name of the service we use to connect to the remote database, but eventually it must be translated into a connection string such as Host:port:servide_name, which can be interpreted as a process of translation, and to be successful, a translation method must be chosen. Then Sqlnet.ora is we use to choose the method of translation, Names.directory_path= (tnsnames) is our choice of the name resolution method; Tnsnames.ora is a configuration file----The local name resolution method in the translation method, as if we had chosen to look up the dictionary method, which is the same as our dictionary which contains all the service names corresponding to the connection string, and Listener.ora is responsible for accepting our request----connection The connection address of the connection owner, as well as the database information that he allows to connect to. This makes up Oracle's network architecture
Oracle's Network Monitoring configuration