2

I'm using ORACLE 12c. I have 1 CDB and 1 PDB (for what I know). To practice, I have created 2 listeners. I have made the appropriate settings in my tnsnames.ora file.

Observations:

  • when I just run lsnrctl start i.e. without specifying one on my listeners name, **TNSLSNR actually loads a listener located in /ora01/app/oracle/product/12.1.0/db_1/bin/tnslsnr (this is the path indicated by ps) Before running lsnrctl start, there is no listener.ora in $ORACLE_HOME/network/admin. I have renamed it to xxxxxlistener.ora for testing what "zombie" listener was loaded by simple lsnrctl start. The worst part is that the response message says it loaded a listener from $ORACLE_HOME/network/admin/listener.ora. This is AWFUL since I renamed that file to xxxxxlistener.ora

There is a ghost file on my computer. Please help me as I can't even practice my custom listeners.

I can't practice my custom listener as if I don't put them on port 1521, I can NEVER user them to connect on the DB. That "ghost" listener seems to be messing things up

3 Answers 3

2

lsnrctl START [listener_name]

In the preceding command, listener_name is the name of the listener defined in the listener.ora file. It is not necessary to identify the listener if you are using the default listener name LISTENER.

If you just hit lsnrctl start without the listener name then Oracle tries to start default listener which listens on two address:

(ADDRESS=(PROTOCOL=ipc)(KEY=PNPKEY))
(ADDRESS=(PROTOCOL=tcp)(PORT=1521))

If you wish to start a specific listener then, first of all define the listener in listener.ora file and specify listener name to start it as lsnrctl start listener_name as shown below:

[oracle@ora12c admin]$ lsnrctl start listener3

LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 07-JAN-2017 19:53:16

Copyright (c) 1991, 2014, Oracle.  All rights reserved.

Starting /u01/app/oracle/product/12.1.0/db_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 12.1.0.2.0 - Production
System parameter file is /u01/app/oracle/product/12.1.0/db_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/ora12c/listener3/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.30.133)(PORT=1523)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.30.133)(PORT=1523)))
STATUS of the LISTENER
------------------------
Alias                     listener3
Version                   TNSLSNR for Linux: Version 12.1.0.2.0 - Production
Start Date                07-JAN-2017 19:53:17
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/12.1.0/db_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/ora12c/listener3/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.30.133)(PORT=1523)))
The listener supports no services
The command completed successfully
[oracle@ora12c admin]$ cat listener.ora 
# listener.ora Network Configuration File: /u01/app/grid/product/12.1.0/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.

ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER2 = ON

VALID_NODE_CHECKING_REGISTRATION_LISTENER = SUBNET

VALID_NODE_CHECKING_REGISTRATION_LISTENER2 = SUBNET

LISTENER1 =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.30.133)(PORT = 1522))
    )
  )

LISTENER3 =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.30.133)(PORT = 1523))
    )
  )

ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER = ON

Set the local_listener initialization parameter. Its up to you use the number of listeners. In my case I have used both.

SQL>alter system set local_listener='(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.30.133)(PORT=1522))','(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.30.133)(PORT=1523))';

Update

ORA-00119: invalid specification for system parameter LOCAL_LISTENER

ORA-00132: syntax error or unresolved network name 'LISTENER1'

Oracle says-

00132, 00000, "syntax error or unresolved network name '%s'"

Cause: Listener address has syntax error or cannot be resolved.

Action: If a network name is specified, check that it corresponds to an entry in TNSNAMES.ORA or other address repository as configured for your system. Make sure that the entry is syntactically correct.

When we create a database and provide the listener name, Oracle creates a TNS alias in tnsnames.ora file and that alias is used as local_listener value.

$ cat $ORACLE_HOME/network/admin/tnsnames.ora
#LISTENER1 =
#  (ADDRESS = (PROTOCOL = TCP)(HOST = ora12c.dba.com)(PORT = 1522))

In your case the alias name should be LISTENER_ORA12C instead of LISTENER1. I had commented that alias to simulate the scenario.

So go to the tnsnames.ora make sure that alias is there. Then try again to start your Oracle instance.

[oracle@ora12c admin]$ vi tnsnames.ora 
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/12.1.0/db_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

LISTENER1 =
  (ADDRESS = (PROTOCOL = TCP)(HOST = ora12c.dba.com)(PORT = 1522))



[oracle@ora12c admin]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Sun Jan 8 09:10:35 2017

Copyright (c) 1982, 2014, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup
ORACLE instance started.

Total System Global Area  838860800 bytes
Fixed Size          2929936 bytes
Variable Size         624954096 bytes
Database Buffers      100663296 bytes
Redo Buffers            5455872 bytes
In-Memory Area        104857600 bytes
Database mounted.
Database opened.
SQL> show parameter local_listener

NAME                     TYPE    VALUE
------------------------------------ ----------- ------------------------------
local_listener               string  LISTENER1

Reference:Configuring and Administering Oracle Net Listener

6
  • pretty much the same thing as the above answer. Thanks man. But you know there is no setting for that default listener in my listener.ora file. Where are its settings ? (Using Oracle Net Manager, I did not even see that default listener also)
    – Jason Krs
    Jan 7, 2017 at 15:05
  • nonono. I did not even get a chance to do alter system .... I launched the default listener ; then I connected like that connect / as sysdba and then when I tried startup it failed. So I could not even alter the system to add my other listeners....
    – Jason Krs
    Jan 7, 2017 at 15:42
  • What is the error message? Is that the one you have post in another answer's comment? I think you have chose that listener during the database creation time. You can rename listener configuration file back to original name where the definition of LISTENER_ORA12C exists. Then start the database.
    – atokpas
    Jan 7, 2017 at 15:44
  • ORA-00119: invalid specification for system parameter LOCAL_LISTENER ORA-00132: syntax error or unresolved network name 'LISTENER_ORA12C' For the value LISTENER_ORA12C, I can change it in the init file
    – Jason Krs
    Jan 7, 2017 at 15:48
  • Also when I launch lsnrctl for the defalult listener, it works fine but it also says : The listener supports no services
    – Jason Krs
    Jan 7, 2017 at 16:06
2

Based on Balazs Papp and JSapkota answers, below is a step by step of how the issue got solved. Note that you must read Balazs Papp and JSapkota answers for more details

Step 1

  • Edit you initialization parameter file on LOCAL_LISTENER parameter to add listeners on ports different than 1521

    local_listener='(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))' ,' (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1522))' , '(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1523))'

  • If you only have a spfile, hopefully you can do :

    connect / as sysdba

    startup

    alter system set local_listener = '(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))' ,' (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1522))' , '(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1523))'

Step 2

Connect using OS authentification and startup the database

  • connect / as sysdba and STARTUP PFILE = <path>/you_init_file.ora

  • If you did not have an init file and had to modify the spfile, just shutdown immediate and startup again

Step 3

A this point you are all set. You can open the pluggable database and disconnect from the client. After disconnecting, assuming your listener.ora and tnsnames.ora are properly configured with the LOCAL_LISTENER parameter file, and also that the listener you need to connect to is started on the server, you can re-connect to the client by that listener using connect username/password@descriptor where "descriptor" corresponds to the network service name associated with your custom running listener.

For further details on syntax, please read :

https://docs.oracle.com/database/121/NETRF/tnsnames.htm#NETRF260

https://docs.oracle.com/cd/B28359_01/network.111/b28317/listener.htm#NETRF008

Special thanks to Balazs Papp and JSapkota

1

lsnrctl start starts the default listener, named LISTENER, on the port 1521. This does not need any configuration, this listener can be started without listener.ora.

I can't practice my custom listener as if I don't put them on port 1521, I can NEVER user them to connect on the DB.

The database registers into a listener running on the default 1521 port without any configuration. If you want the database to be registered dynamically in other listeners listening on other ports as well, you need to set the local_listener parameter. For example, if you have 2 listener on ports 1521 and 1522, you need to set the below in the database instance, with your actual hostname or IP after HOST:

alter system set local_listener='(ADDRESS=(PROTOCOL=TCP)(HOST=...)(PORT=1521)), (ADDRESS=(PROTOCOL=TCP)(HOST=...)(PORT=1522))';
1
  • Oops I think I've messed things up. 1st : I don't have the default listener in my listener.ora. I think I have delete it to add my own listeners (still lsnrctl start works fine). Second, when I started the default listener to be able to connect to the DB, I could not startup the database to make the changes you've suggested. It says : ORA-00119: invalid specification for system parameter LOCAL_LISTENER ORA-00132: syntax error or unresolved network name 'LISTENER_ORA12C' How can I change that initialisatoin parameter now ? I saw that in my initORA12C.ora file. What should I put there ?
    – Jason Krs
    Jan 7, 2017 at 15:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.