Oracle: listener. ora, sqlnet. ora, tnsnames. ora configuration and example

Source: Internet
Author: User
Tags dedicated server

Oracle: listener. ora, sqlnet. ora, tnsnames. ora configuration and example
1. Solve the problem: TNS or the database cannot log on.
The simplest and most effective method: use the tool netca provided by the Oracle System to configure (delete the original one and reconfigure it)
$ Netca 2. However, I still have questions: how do I specify the directory where 'listener. ora 'is stored? Do not default directory ($ ORACLE_HOME/network/admin)

Add in '. profile'

  1. TNS_ADMIN =/f01/oracle11/app/oracle/product/8.0.6/network/admin
  2. Export TNS_ADMIN

3. Three configuration files

1) listener. ora

2) sqlnet. ora

3) tnsnames. ora

These three files are all stored in the $ ORACLE_HOME/network/admin directory.

1) sqlnet. ora (client and server)

The function is similar to the nsswitch. conf file of linux or other unix systems. This file is used to determine 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:

  1. SQLNET. AUTHENTICATION_SERVICES = (CNT)
  2. NAMES. DIRECTORY_PATH = (TNSNAMES, HOSTNAME)
Then, the client will first be in tnsnames. find the orcl record in the ora file. If there is no corresponding record, try to treat orcl as a host name, resolve the ip address through the network and connect to the instance GLOBAL_DBNAME = orcl on the ip address. Of course, here, orcl is not a host name.
  
If I look like this
  1. 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.

2) Tnsnames. ora (customer and server)

This file is similar to the unix hosts file. It provides the tnsname to the host name or ip address, only when the sqlnet. ora file is similar
  
NAMES. DIRECTORY_PATH = (TNSNAMES), that is, the file will be used only when the client parses the order of the connection string that contains TNSNAMES.
  
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 Shared Server Mode for connection. The sentence is as follows:

  1. # Enter TNSNAME when you want to connect
  2. ORCL =
  3. (DESCRIPTION =
  4. (ADDRESS_LIST =
  5. # The host, port, and Protocol corresponding to this TNSNAME
  6. (ADDRESS = (PROTOCOL = TCP) (HOST = 127.0.0.1) (PORT = 1521 ))
  7. )
  8. (CONNECT_DATA =
  9. # 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.
  10. # Automatic Adjustment
  11. (SERVER = DEDICATED)
  12. # Corresponding service_name, SQLPLUS> show parameter service_name;
  13. # View
  14. (SERVICE_NAME = orcl)
  15. )
  16. )
  17. # The following is similar
  18. SALES =
  19. (DESCRIPTION =
  20. (ADDRESS_LIST =
  21. (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.188.219) (PORT = 1521 ))
  22. )
  23. (CONNECT_DATA =
  24. (SERVER = DEDICATED)
  25. (SERVICE_NAME = sales)
  26. )
  27. )

3) listener. ora (server side) -- configuration file of 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 of Listener. ora File

  1. # Listener. ora Network Configuration File: # E:/oracle/product/10.1.0/Db_2/NETWORK/ADMIN/listener. ora
  2. # Generated by Oracle configuration tools.
  3. # The following defines the instance for which the LISTENER process provides services
  4. # Here Is ORCL, And it corresponds to ORACLE_HOME and GLOBAL_DBNAME
  5. # GLOBAL_DBNAME is not required unless you use HOSTNAME for database connection
  6. SID_LIST_LISTENER =
  7. (SID_LIST =
  8. (SID_DESC =
  9. (GLOBAL_DBNAME = boway)
  10. (ORACLE_HOME = E:/oracle/product/10.1.0/Db_2)
  11. (SID_NAME = ORCL)
  12. )
  13. )
  14. # Listener name. A database can have more than one listener.
  15. # Next we will talk to the listener about the protocol, ip address, port, etc. Here we use the tcp1521 port and use the # Host Name
  16. LISTENER =
  17. (DESCRIPTION =
  18. (ADDRESS = (PROTOCOL = TCP) (HOST = boway) (PORT = 1521 ))
  19. )

  
The above example is the simplest, but also the most common. A listener process provides services for an instance (SID.
  • 1
  • 2
  • 3
  • Next Page

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.