| Lesson 5 | Configuring the listener.ora file |
| Objective | Add a database to your listener.ora file. |
Oracle Net Listener settings can be stored in a text file named listener.ora. In most installations, the file is located
under $ORACLE_HOME/network/admin. On Windows, the exact path varies by install, but it typically ends with
\network\admin.
In older Oracle versions (and in many legacy tutorials), adding a database meant adding a static entry under a
SID_LIST_<listener_name> heading. In modern Oracle releases, the normal approach is dynamic service registration:
you keep listener.ora focused on the listener’s network address (host/port), and you ensure the database instance registers
its services with that listener.
This lesson shows both approaches:
SID_LIST_LISTENER block is structured (with a single annotated image).SID_LIST_... entry is still required (for example, external procedures).
SID_LIST_LISTENER.SID_LIST_LISTENER=
(SID_LIST=
(SID_DESC=
(SID_NAME=PLSExtProc)
(ORACLE_HOME = C:\Oracle\Ora81)
(PROGRAM =extproc)
)
(SID_DESC=
(GLOBAL_DBNAME=jonathan)
(ORACLE_HOME = C:\Oracle\Ora81)
(SID_NAME=JONATHAN)
)
)
SID_LIST_LISTENER entry marks the list of services handled by the listener. The list is enclosed within parentheses.
LISTENER) identifies which listener this configuration applies to.SID_DESC.PLSExtProc commonly represents the external procedure handler (extproc), used to interface Oracle with external libraries.SID_NAME for an instance (rather than only a PROGRAM).GLOBAL_DBNAME lets clients reference a service name that includes database name + domain (for example, sales.us.example.com).SID_NAME identifies the instance name used for routing the connection to the correct server process.ORACLE_HOME tells the listener where the Oracle home is located for that entry.
In Oracle 23c-era configurations, you usually do not add a new database by copying SID_DESC blocks.
Instead, you make sure the database (and its services) register with the listener. Conceptually, you are “adding” the database by
ensuring the listener can see the service.
Ensure your listener is configured to listen on the correct host and port. A minimal example looks like this:
LISTENER=
(DESCRIPTION=
(ADDRESS=(PROTOCOL=TCP)(HOST=sale-server)(PORT=1521))
)
If you are using external procedures, keep the IPC address as well:
LISTENER=
(DESCRIPTION=
(ADDRESS=(PROTOCOL=TCP)(HOST=sale-server)(PORT=1521))
(ADDRESS=(PROTOCOL=IPC)(KEY=extproc))
)
From SQL*Plus (or SQLcl) as SYSDBA, validate the service configuration. In a multitenant environment, you typically connect users to a service name (often a PDB service), not a SID.
-- Quick checks (names vary by environment)
SHOW PARAMETER service_names
SHOW PARAMETER local_listener
If the listener is not on the default host/port (or you have a custom listener name), set LOCAL_LISTENER and force
re-registration:
ALTER SYSTEM SET local_listener='(ADDRESS=(PROTOCOL=TCP)(HOST=sale-server)(PORT=1521))' SCOPE=BOTH;
ALTER SYSTEM REGISTER;
On the database host, confirm registration from the OS:
lsnrctl status
lsnrctl services
You should see your database service(s) listed. If you do not, typical causes include: wrong host/port, DNS/hosts mismatch, firewall,
listener started under a different Oracle home, or a missing/incorrect LOCAL_LISTENER value.
Static service registration (SID_LIST_...) is still used in specific scenarios, such as external procedures
(extproc) and certain management/monitoring setups. In those cases, you can add a static entry for a database service.
Example: a static database entry (use only when you have a clear requirement):
SID_LIST_LISTENER=
(SID_LIST=
(SID_DESC=
(GLOBAL_DBNAME = sales.us.example.com)
(ORACLE_HOME = /oracle23c)
(SID_NAME = sales)
)
)
Editing tip: the most common failure is broken parenthesis nesting. If you copy/paste, re-check indentation and matching parentheses before restarting the listener.
COIN database to your listener.ora file.