oracle connection method

listener.ora and tnsnames.ora are two important files in the Oracle configuration, they differ in the following aspects. listener.ora:

file is a configuration file for Oracle Listener(). is a service that receives database connection requests from clients and forwards them to the database instance.
The listener.ora file contains configuration information such as name, protocol used, port number, etc. This file is usually located in the $ORACLE_HOME/network/admin directory.
Multiple listener.ora files can be configured so that the database instance can listen in different ways and port numbers.
tnsnames.ora:
The tnsnames.ora file is used to configure the connection information between the client and the database, including SID, server host name, port, etc.
The client resolves a connection descriptor by reading the tnsnames.ora file so that it can establish a connection to the database.
The tnsnames.ora file is located in the ORACLE_HOME/network/admin directory on the client system.
To sum up, the listener.ora file is used to configure the listener (Listener), and manage the logic and parameter settings of the database instance receiving connections. The tnsnames.ora file is used for client configuration and defines the connection descriptor of the database, which is used by the client to establish a connection with the database.

If you directly use the sqlplus / as sysdba command to connect to the database on the server, it will not actually go through the configuration of the tnsnames.ora or listener.ora file.
In this case, the connection is made directly through OS-level authentication. Therefore, sqlplus / as sysdba will bypass the TNS (Transparent Network Substrate) layer and the corresponding network connection configuration files.

This connection method is a special form based on local access rights and operating system authentication, which allows the user to log in to the database as a super administrator. It does not directly depend on network connectivity or TNS functionality, so configuration information in the tnsnames.ora or listener.ora files does not need to be used.
Note that under normal client connection conditions, tnsnames.ora or listener.ora will be used to resolve and locate information about the database instance when the connection is established by using the service name or service descriptor. But sqlplus / as sysdba is a special case designed to provide a quick way to access superuser privileges.

Guess you like

Origin blog.csdn.net/qq_39412605/article/details/131246348