Listener. ora adds the listening port and listener. ora listens.
A simple listener. ora
# Listener. ora Network Configuration File: d: \ app \ zyd \ product \ 11.2.0 \ dbhome_1 \ network \ admin \ listener. ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = d: \ app \ zyd \ product \ 11.2.0 \ dbhome_1)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS = ONLY: d: \ app \ zyd \ product \ 11.2.0 \ dbhome_1 \ bin \ lrlr11.dll ")
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC) (KEY = EXTPROC1521 ))
(ADDRESS = (PROTOCOL = TCP) (HOST = localhost) (PORT = 1521 ))
(ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.1.160) (PORT = 1666 ))
)
)
ADR_BASE_LISTENER = d: \ app \ zyd
------------------------ End of file ---------------------------
Note that the firewall must allow port 1666.
How can I check which Database Service the remote server listening?
Lsnrctl status <server address: lsnrctl status 192.168.0.126 if the remote server listens to another port, configure the connection to the remote server listening on the local machine, the specific method is $ ORACLE_HOME/network/admin/listener. add a listener to the ora file. The Listener ADDRESS is the remote server ADDRESS and the port is the remote port, for example, LISTENER126 = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.0.126) (PORT = 1522) indicates connecting to the 1522 listening PORT of 192.168.0.126. Then, use lsnrctl status LISTENER126 to display the monitoring status of the remote server. Similarly, you can use this method to start and stop remote server listening.
Why I used oracle to create two databases with only one port of 1521
In a TCP/IP network, (IP, Port Number) can uniquely determine the address of a process. The oracle listener is also a process in a TCP/IP network. The default port number is 1521.
The oracle listener process can serve multiple databases at the same time.
The client process obtains the IP address and port of the oracle listener process through listener. ora)
The oracle listener process receives all customer connection requests through port 1521, and identifies information about the database process to be connected from the customer connection request, such as SID, SERVICE_NAME, and DB_NAME. Based on this information, query a local file (tnsnames. the oracle listener process can obtain the connection information of the master process of the database to be connected, and return the information to the client. The client returns the connection information based on the returned connection information, reconnect to the corresponding primary database process.
By querying the local configuration file tnsnames. ora, an oracle listener process can serve multiple databases (primary processes) at the same time.