Oracle 11g R2 Network Listener Experiment

Source: Internet
Author: User

Single-instance environment (not RAC), listeners and instances must be on the same machine. Two machine communication must use a network protocol to communicate, if browsing the web requires the use of HTTP protocol, remote connection requires the use of rdp/ssh/telnet and so on.

There is an Oracle server, a client to connect to the Oracle server, the two machines communicate using the Oraclenet protocol, and the above protocol is the same. There is a protocol that will have a corresponding port, so oraclenet has a default listening port of 1521.

In fact, configuring the Oracle network is the configuration of the Oracle Listener, the listener is very important, if you do not configure the listener, the client is unable to connect to the Oracle server above. In fact, even if you are connecting to an Oracle server locally, the listener must be running. When a client remotely connects to an Oracle server, it uses the Oraclenet protocol, which is encapsulated in the TCP/IP protocol. If you are connecting directly to the database locally, use the IPC. IPC refers to the communication > between < processes.

The listener is used to receive requests outside, and the outside request is handed over to the instance through the server process, so the instance must be registered with the listener. If the listener does not know that there is a corresponding instance, it is certainly not possible-that is, let the listener know that there are instances to connect. The Oracle default listener port is 1521.

The configuration file for the listener is stored in: The Instener.ora in the $ORACLE _home/network/admin/is the profile of the listener

If the Listerner port uses the default of 1521, there can be no listener.ora, but it is recommended that you do not delete this file.

Creating listeners

You can configure listeners by modifying Listener.ora, and you can also use other tools to configure listeners

Netca

Netmgr

Ways to add listeners using NETCA









To view the status of the default listener

View the status of LISTENER1


How Remote clients Connect

The following two ways can be used by remote clients to connect to an Oracle server:

1.easy connect:conn user/[email protected]:p ORT/ORCL as Sysdba

2.tnsnames:conn User/[email protected]

Connect to an Oracle server remotely using the Easy Connect method

The client is a win7 system and needs to install the Oracle client program

Delete the identified lines in the Listener.ora file

Stop the Listener service

[Email protected] admin]$ Lsnrctlstop

Start the Listener service

[[email protected] admin]$ lsnrctl start

When you connect to the instance, you cannot connect, and the hint is not listener.

Restore the listener to a state that was not previously deleted, and then restart the service Lsnrctl Stop/start

Using the Netmgr tool

To delete the Listener1 listener, click the X button on the left

You can connect using Easy Connect and TNSNames

TNSNames Connection method:< recommended Client connection mode > Conn User/[email protected]

TNSNames involves a file: Tnsnames.ora is a client-side tool that copies Tnsnames.ora to the Oracle Client installation directory.


Use Notepad to open the Tnsnames.ora file with the original content as follows

Modify parts of the original content that are copied and pasted to a blank location in Tnsnames.ora

Revision changed to

Then save the exit.

Connecting instances

Adding listeners using Netmgr






Using the Listener1 listener to connect to an instance, the result is that you cannot connect to the instance because the instance ORCL is not registered on the Listener1 listener. By default, the ORCL instance is registered to the default listener 1521, so it is only possible to use 1521来 connections at this time.

The methods that the instance registers with the listener are:

Static registration: Manually specified in the Listener.ora file

Dynamic registration: The Pmon process registers the service name and instance name to the listener every minute

How to register an instance to a listener
Use the ALTER system register to register an instance on a listener. Which listener does this command register an instance with? This command registers the instance with the default listener.


ORCL is the parse name in TNSNames: This address can be resolved with ORCL (address = (PROTOCOL = TCP) (HOST =orclsrv) (PORT = 1521)).

Sql>alter system Set local_listener= "(ADDRESS = (PROTOCOL = TCP) (host= orclsrv) (PORT = 1521)"; with alter system set LOCAL_ The LISTENER=ORCL is equivalent.

Registering an instance with the Listener1 above

Sql>alter system Set local_listener= "(ADDRESS = (PROTOCOL = TCP) (host= orclsrv) (PORT = 1522)";

You cannot connect to the instance by using the default listener at this time.

To modify a file in a Tnsnames.ora

Sql>alter system setlocal_listener=listener2;

The system has changed.

See which listener the instance is registered to: Show parameter local;

If you have any questions about this article, please add the following discussion

Oracle 11g R2 Network Listener Experiment

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.