Change Listener Port (Single Instance)

In this Topic i will discuss how to change listener ports , The Database 10gR2 , Operating System RHEL 5.7  this demonstration will work on any Database or platforms , The Simplest way to change listener Ports

Information :
DB Version : 10.2.0.5
OS : RHEL 5.7
Listener Name : LISTENER
Old Port : 1521
New Port : 1523


Step one :  Check Listener Status .

The Below screen describe The Old Status For Listener Notice the Port is 1521 (Default One)

Step two : Stop Listener  (lsnrctl stop)

Step three : Use netca command  to Change Listener Port Follow the screens

in below screen you can choose the listener port you want to change .


Step Four : After Close netca GUI listener will start automatically


Step Five : Go to $ORACLE_HOME to change tnsnames.ora that used Old Listener port to new port.

Listener.ora will change automatically via netca GUI so no need to update it .

Step Six : Database will not register atomically after doing the above steps , so you have to set LOCAL_LISTENER Parameter Via Sqlplus like the following , i will post lsrnctl status to confirm what i saying, also notice new port that has been changed .

Now , Sqlplus / as sysdba

I Used Scope=memory to test the connection first  , after test the connection successfully you can change scope = spfile.

Step Seven : Test Connection to make sure Every User will Able To connect .

Thank you
Osama Mustafa

WARNING: Subscription for node down event still pending

Warning Appear like the following : 
 
[oracle@sun3 ~]$ cat /u01/app/oracle/product/10.2.0/network/log/listener1.log
 
19-NOV-2012 14:00:19 * (CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl1)(CID=(PROGRAM=sqlplus@sun3)(HOST=sun3)(USER=oracle))) * (ADDRESS=(PROTOCOL=tcp)(HOST=10.10.10.4)(PORT=53680)) * establish * orcl1 * 12514
TNS-12514: TNS:listener does not currently know of service requested in connect descriptor
19-NOV-2012 14:01:02 * ping * 0
19-NOV-2012 14:08:34 * service_update * orcl1 * 0
19-NOV-2012 14:18:37 * service_update * orcl1 * 0
WARNING: Subscription for node down event still pending
19-NOV-2012 14:23:32 * (CONNECT_DATA=(CID=(PROGRAM=)(HOST=sun3)(USER=oracle))(COMMAND=status)(ARGUMENTS=64)(SERVICE=LISTENER)(VERSION=169869568)) * status * 0
19-NOV-2012 14:23:59 * (CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl1)(CID=(PROGRAM=sqlplus@sun3)(HOST=sun3)(USER=oracle))) * (ADDRESS=(PROTOCOL=tcp)(HOST=10.10.10.4)(PORT=53505)) * establish * orcl1 * 12514
TNS-12514: TNS:listener does not currently know of service requested in connect descriptor
19-NOV-2012 14:28:40 * service_update * orcl1 * 0
19-NOV-2012 14:30:38 * (CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl1)(CID=(PROGRAM=sqlplus@sun3)(HOST=sun3)(USER=oracle))) * (ADDRESS=(PROTOCOL=tcp)(HOST=10.10.10.4)(PORT=5290)) * establish * orcl1 * 12514
TNS-12514: TNS:listener does not currently know of service requested in connect descriptor
19-NOV-2012 14:38:43 * service_update * orcl1 * 0
WARNING: Subscription for node down event still pending
 
Solution  


In Listener.ora add the following :


SUBSCRIBE_FOR_NODE_DOWN_EVENT_=OFF

Thank you
osama mustafa

Register Listener In Database

Listener listens to new connections who is trying to connect to DB server. If the listener goes down, new users would not be able to connect to DB server. But still, already connected users would be able to do their work normally.

Listener   waiting  requests  from Clients to connect to the Instance. By default, the Listener name is (amazingly enough)“Listener” (but you can call it anything you like). It listens for connection requests on aparticular port (the default port number in 8.0 and above is 1521, but once again you canset this to any valid port number if you wish). A client knows where to contact the Listener (the machine it’s running on, and the port it’s listening on) because  a local configuration file, called “tnsnames.ora”, gives it the necessary information. More advanced configurations can dispense with the  tnsnames.ora .

How  to  Register  Listener  In  Database  

1.) Static Instance Registration
2.) Dynamic Instance Registration

Lets Discuss These Method and Start With Static Instance Registration :

Its basic method , and use $ORACLE_HOME\NETWORK\ADMIN\listener.ora its look like

    LISTENER =
      (DESCRIPTION =
        (ADDRESS = (PROTOCOL = TCP)(HOST = xx.xx.xx.xx)(PORT = 1521))
      )
     

And When You Fire lsnrctl status , instance Name Appear with Unknown like the following :

Service “orcl” has 1 instance(s).
  Instance “orcl”, status UNKNOWN, has 1 handler(s) for this service…
Service “orcl” has 1 instance(s).
  Instance “orcl”, status UNKNOWN, has 1 handler(s) for this service…
The command completed successfully

 The status is unknown because there is no mechanism to guarantee that the specified status even exists.Here the listener assumes that instance will be there whenever there will be any request. It donot have inforamtion about the status of the Current Instance.

Dynamic Instance Registration (service registration):
  
in this Way the PMON is Responsible about Register Listener ,

Benefit for this way like the following :

1.) Simplified configuration  :  Service registration reduces the need for the SID_LIST_listener_name parameter setting, which specifies information about the databases served by the listener, in the listener.ora file.

Note :  The SID_LIST_listener_name parameter is still required if we are using Oracle Enterprise Manager to manage the database.

2.) Connect-time fail over  : Because the listener always knows the state of the instances, service registration facilitates automatic fail over of the client connect request to a different instance if one instance is down.
In a static configuration model, a listener would start a dedicated server upon receiving a client request. The server would later find out that the instance is not up, causing an “Oracle not available” error message.
3.) Connection load balancing : Service registration enables the listener to forward client connect requests to the least loaded instance and dispatcher or dedicated server. Service registration balances the load across the service handlers and nodes.  To ensure service registration works properly .
Services Summary…
Service “ORCL” has 1 instance(s).
  Instance “ORCL”, status READY, has 1 handler(s) for this service…
Service “ORCLXDB” has 1 instance(s).
  Instance “ORCL”, status READY, has 1 handler(s) for this service…
Service “ORCL2” has 1 instance(s).
  Instance “ORCL2”, status READY, has 1 handler(s) for this service…
The command completed successfully

 To register Database name with listener in this way you could use :

SQL> ALTER SYSTEM REGISTER;

Thank you
Osama Mustafa 

Set Listener Password

In Oracle 10g and above, the listener is secured by default, and only user who started the listener can run the commands.

In order to set password on listener, follow the steps:

1) LSNRCTL> set current_listener
2) LSNRCTL> change_password
Old password:
New password: yourpassword
Reenter new password: yourpassword
3) LSNRCTL> save_config
4) LSNRCTL> status

Now Any One Want Start Administrating Listener Will be Asked for Password , After This you can manager Your Listener .

As the another user, enter the password to administer the listener:

1) LSNRCTL> set password
Password: yourpassword
2) LSNRCTL> stop

Thank you
Osama mustafa

tns-12560 message 12560 not found

Sometimes Users Cannot access to Database You Need To check The following :

Sqlplus / as sysdba

Show parameter local_listener ;

You have to see output like this :


local_listener            (DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=you-ip-address)(PORT=1521))))

  If you see Null Value Do the Following :

Alter system set local_listener=’(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=172.16.250.25)(PORT=1521))))‘ scope=memory ;

Or For Real Application :

Alter system set local_listener=’(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=172.16.250.25)(PORT=1521))))‘ scope=memory sid=’you-node-name’;

Scope = memory For Test Purpose

Sql > Alter system register ;

Now You should see database name service on listener ;

to Apply these Changes all we have to do is scope=spfile like the following :

Alter system set local_listener=’(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=172.16.250.25)(PORT=1521))))‘ scope=spfile ;

Or For Real Application :

Alter system set local_listener=’(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=172.16.250.25)(PORT=1521))))‘ scope=spfile sid=’you-node-name’;

Thank you
Osama Mustafa

ORA-12528 tns listener all appropriate instances are blocking new connections

SQL> set ORACLE_SID=ORCL
SQL> startup nomount
ORACLE instance started.

Total System Global Area 263639040 bytes
Fixed Size 1332552 bytes
Variable Size 222300856 bytes
Database Buffers 33554432 bytes
Redo Buffers 6451200 bytes

C:\>lsnrctl services

LSNRCTL for 32-bit Windows: Version 11.1.0.6.0 - Production

Service "ORCL" has 2 instance(s).
Instance "ORCL", status UNKNOWN, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:0 refused:59
LOCAL SERVER
Instance "ORCL", status BLOCKED, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:0 refused:0 state:ready
LOCAL SERVER
Service "ORCL_XPT" has 1 instance(s).
Instance "ORCL", status BLOCKED, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:0 refused:0 state:ready
LOCAL SERVER
 
 
Want Solution Do the following : 
 
you can add the new TNS connect string (UR = A) to the tnsnames entry.
 
ORCL =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = ORCL)
(UR = A)
)
 
if the above Solution not working Make sure your listener look like :
 
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = D:\app\oraserver\product\11.2.0\dbhome_1)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:D:\app\oraserver\product\11.2.0\dbhome_1\bin\oraclr11.dll")
)
(SID_DESC =
(SID_NAME=orcl)
(ORACLE_HOME=D:\app\oraserver\product\11.2.0\dbhome_1)
)
)

LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
)
 


Thank you 
Osama Mustafa

Change Listener Port For Oracle RAC

I think its useful to document this since maybe i will need it too 🙂

Environment

2 Node , Linux  …..

RAC database name: ORCL
Node 1 vip: myhost1-vip
Node 2 vip: myhost2-vip
Instance 1: ORCL1
Instance 2: ORCL2
Version: 11.1.0.7
New port: 1522

STEPS :

1) First, use netca to adjust the the listener port from 1521 to 1522. It’s a good idea to use netca to do this cluster-wide and keep the OCR in check.  
NOTE: This will shutdown the listeners across both nodes.

2)

2) In the tnsnames.ora for ASM and RDBMS, ensure the following entry exists (they’ll probably be there but with the 1521 port, so adjust accordingly):

LISTENERS_ORCL=
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = myhost1-vip)(PORT = 1522))
(ADDRESS = (PROTOCOL = TCP)(HOST = myhost2-vip)(PORT = 1522))
)

LISTENER_ORCL2=
(ADDRESS = (PROTOCOL = TCP)(HOST = myhost2-vip)(PORT = 1522))

LISTENER_ORCL1=
(ADDRESS = (PROTOCOL = TCP)(HOST = myhost1-vip)(PORT = 1522))

3)
Connect to each instance and set the local_listener to parameter to either LISTENER_MYRACDB1 or 2 depending on the instance you connect to. Ensure you do this so it applies to the instance you are connected to only, and does not apply globally.

e.g. if connected to ORCL1

alter system set local_listener=’LISTENER_ORCL1′ sid=’ORCL1′;

4) Set the remote_listener parameter to LISTENERS_MYRACDB across all instances

e.g. alter system set remote_listener=’LISTENERS_ORCL’;

5) Repeat the above for both ASM instances

6) You should be able to start the listener on each node now.

e.g. srvctl start listener -n myhost1 

Thank you

Note :

On Single node instance all you need to do is
1-stop the listener
lsnrctl stop

2-Go to $ORACLE_HOME/network/admin/listener.ora
modified the port for new one .

3-start the listener
lsnrctl start

DONE

Osama mustafa
Oracle Database consultant