InOracle Network StructureInConnectionThe problem is a headache for many people. It is the connection problem in the Oracle network structure that has brought a lot of inconvenience to everyone's work, next, we will teach you how to solve the connection problem in the Oracle network structure.
First, the network structure of Oracle can be combined with encryption, LDAP, and so on .. We will not discuss it here, focusing on the basic network structure, which is the most common situation.
Three configuration files
Listener. ora, sqlnet. ora, and tnsnames. ora are all stored in the $ ORACLE_HOME etworkadmin directory.
Key points: Functions and usage of the three files
#-----------------------
Sqlnet. ora ----- functions similar to linux or other unix nsswitch. conf files. This file determines how to find a connection string that appears in the connection,
For example, we enter
Sqlplus sys/oracle @ orcl
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. 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_DBNAME = orcl on this ip address, of course, here, orcl is not a host name.
If I look like this
NAMES. DIRECTORY_PATH = (TNSNAMES)
Then the client will only search for orcl records from tnsnames. ora
There are other options in brackets, such as LDAP, which are not commonly used.
#------------------------
Tnsnames. ora ------ this file is similar to the unix hosts file. It provides the corresponding tnsname to the host name or ip address, only when the file is similar
NAMES. DIRECTORY_PATH = (TNSNAMES), that is, the client will try to use this file only when TNSNAMES is in the order in which the client parses the connection string.
In this example, there are two local IP addresses corresponding to ORCL and another IP address corresponding to SALES, which also defines whether to use the master server or the Shared Server Mode for connection.
# Enter TNSNAME when you want to connect
ORCL =
(DESCRIPTION =
(ADDRESS_LIST =
# The host, port, and Protocol corresponding to this TNSNAME
(ADDRESS = (PROTOCOL = TCP) (HOST = 127.0.0.1) (PORT = 1521 ))
)
(CONNECT_DATA =
# Use the dedicated server mode to connect to the server. The connection mode must match the server mode. If not, the connection is based on the server mode.
# Automatic Adjustment
(SERVER = DEDICATED)
# Corresponding service_name, SQLPLUS> show parameter service_name;
# View
(SERVICE_NAME = orcl)
)
)
According to the content described above, you can solve the connection problem in the Oracle network structure. I hope you can learn from this article to gain some benefits, similar problems can be easily solved in future work.