Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Oracle 11g R2 Network listener Lab

2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

In a single instance environment (not RAC), the listener and the instance must be on the same machine. Communication between the two machines 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, there is a client to connect to the oracle server, the two machines to communicate using the oracleNET protocol, and the above protocol is the same. If there is a protocol, there must be a corresponding port, so oracleNET has a default listening port 1521.

In fact, to configure the oracle network is to configure the oracle listener, which is very important. If the listener is not configured, the client cannot connect to the oracle server. In fact, even if you connect to the oracle server locally, the listener must be run. When the client connects remotely to the oracle server, it uses the oracleNet protocol, which is encapsulated in the tcp/ip protocol. IPC is used if you are connecting directly to the database locally. IPC means.

Listeners are used to receive external requests and deliver them to the instance through the server process, so the instance must register with the listener. It must not work if the listener does not know that there is a corresponding instance-- that is, let the listener know that there is an instance to connect to. The port of the oracle default listener is 1521.

The listener's configuration file is stored in: instener.ora in $ORACLE_HOME/network/admin/ is the listener's configuration file

If the default port of listerner is 1521, you can do without listener.ora, but it is recommended that you do not delete this file.

Create a listener

Besides modifying listener.ora to configure listeners, you can also use other tools to configure listeners

Netca

Netmgr

The method of adding listeners using netca

View the status of the default listener

View the status of LISTENER1

Remote client connection mode

Remote clients can connect to the oracle server in the following two ways:

1.easy connect: conn user/password@ip:port/orcl as sysdba

2.tnsnames: conn user/password@XX

Use easy connect to remotely connect to the oracle server

The client is a win7 system, and the oracle client program needs to be installed.

Delete the identified line in the listener.ora file

Stop the listener service

[oracle@orclsrv admin] $lsnrctlstop

Start the listener service

[oracle@orclsrv admin] $lsnrctl start

When you connect to the instance again, you will not be able to connect, indicating that there is no listener.

Restore the listener to its previous state without deletion, and then restart the service lsnrctl stop/start

Use the netmgr tool

Delete the listener1 listener and click the X button on the left

You can connect using easy connect and tnsnames

Tnsnames connection method: conn user/password@XX

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, the original content is as follows

Copy and paste the part of the original content as shown in the figure into a blank position in tnsnames.ora and modify it.

Modify to

Then save the exit.

Connect an instance

Use netmgr to add listeners

Using the listener1 listener to connect to the instance, the result is that you cannot connect to the instance because the instance orcl is not registered with the listener1 listener. By default, the orcl instance is registered with the default listener 1521, so currently only 1521 can be used to connect.

The following methods can be used to register an instance with a listener

Static registration: manually specified in the listener.ora file

Dynamic registration: the pmon process registers the service name and instance name with the listener every other minute

Method of registering an instance with a listener

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

ORCL is the resolution name in tnsnames: you can resolve this address (ADDRESS = (PROTOCOL = TCP) (HOST = orclsrv) (PORT = 1521) even with ORCL.

SQL > alter system set local_listener= "(ADDRESS = (PROTOCOL = TCP) (HOST= orclsrv) (PORT = 1521))"; is equivalent to alter system set local_listener=ORCL.

Register the instance with listener1

SQL > alter system set local_listener= "(ADDRESS = (PROTOCOL = TCP) (HOST= orclsrv) (PORT = 1522))

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

Modify files in tnsnames.ora

SQL > alter system setlocal_listener=LISTENER2

The system has changed.

Check which listener the instance is registered to: show parameter local

If you have any questions about this article, please add Wechat below to discuss it.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report