Solve the Problem of Oracle Database client random port connection

Source: Internet
Author: User
Solve the Problem of Oracle Database client random port connection. Add the comment to your favorites on your mobile phone at on so that the Oracle client can normally connect to an Oracle server installed on windows with a firewall, it is not enough to open a single 1521 or custom listening port.


Sometimes we need to map the port to remotely access the Oracle database. Here there is a firewall problem, in UNIX
But it cannot be accessed correctly on the win platform. The following information can be found on the Internet:


Document 1,


Recently, the Oracle9i database has been installed on the Windows XP platform for testing. However, when the client connects to the server, it always times out. First, I think of the firewall. When I open port 1521, the connection operation still fails. I suspect that the network is faulty. Use Telnet.
Server_ip: 1521 attempt. The connection is accepted. port 1521 is enabled.


No way. After querying the Oracle data, you can understand that network listener only plays an intermediary role. When the customer connects to it, it finds the corresponding database instance process according to the configuration, then spawned a new database connection. The connection port is
After the listener is passed to the client, the client will no longer deal with the client, even if the listener stops working. This new connection port is unpredictable and will be blocked by the firewall.


The Windows socket2 specification has a new feature: Shared socket. The so-called shared socket refers to the socket where one process shares another process (For details, refer to the msdn reference ). If you want the network listener to share the socket with the database service process, the connection port will not change.


How to Set shared socket?


Create a new string value in the Registry: HKEY_LOCAL_MACHINE \ SOFTWARE \ oracle \ home0: use_shared_socket = true. If multiple directories are installed, set HKEY_LOCAL_MACHINE \ SOFTWARE \ oracle \ homex (X Directory number) for each similar directory)


Restart the instance after setting (only restart listener to find no effect)


Document 2,


When the Oracle client connects to the server, it first finds the 1521 listening port. The server's 1521 listening port then sends a request to the server process and returns a random port to the client, connect the client to this port. In this way, the firewall settings on the server are troublesome. This port is random. How can this port be opened?


This problem on Windows has become a major problem. Many forums have asked, but few can solve it.
There is no need to worry about UNIX platforms, and the system will automatically solve this problem. matalink provides three solutions. In fact, use_shared_socket is the most effective and convenient. However, after numerous implementations, it was still unsuccessful. Finally, it was found that Oracle 8.1.7 had to be patched and upgraded to Oracle 8.1.7.1.2.


In the MTS mode (shared mode), Oracle uses the dedicated mode by default.


The test showed that if the parameter is not set in the init file, Oracle still requires a random port to communicate with port 1521, but this random port, it does not change as the client session and logon change. It is fixed when the server is not restarted. (The test found that in dedicated mode, each connection, the Oracle server will provide a non-1521 port in the + 1 mode .) Therefore, you must add the following parameter at the end of the init. ora file:

Mts_dispatchers = "(address = (Protocol = TCP) (host = myoradb) (Port = 1521) (dispatchers = 1 )"

Restart the instance after setting (only restart listener to find no effect)

In this way, only one port is used to pass through the firewall.

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.