apps-dba journal

A working journal for Oracle DBAs.

October 03, 2026

Oracle DBA Lesson 40A — Register Services at the Right Listener

An Oracle instance sends information about its services and connection handlers to a listener through dynamic registration. In Oracle Database 19c, the Listener Registration process (LREG) performs this work. The listener uses the registered information to route requests for a service.

Oracle DBA Lesson 40A — Register Services at the Right Listener

This helps answer a practical question: which listener receives the instance's registration information? A listener on an alternative port needs the database's registration destination to match its endpoint.

Choose the registration destination

LOCAL_LISTENER identifies local listener addresses for registration. Its default is the local host's TCP address on port 1521. For a listener already running on 1522, configure that verified address.

The address must work from the database server. A listener alias is resolved through the database host's Oracle Net naming configuration. Its entry contains the listener address and omits CONNECT_DATA. An application connection alias has a different purpose: it also identifies the requested service.

This lesson uses an already running, isolated listener named LISTENER_COURSE at lab-db.example:1522. The database instance is LABCDB, and an existing service LABPDB routes to the pluggable database LABPDB. These are course example values. In a real deployment, service and PDB names can differ. See LOCAL_LISTENER and configuring service registration.

Capture the current setting before changing it

Use the instructor's disposable Oracle 19c single-instance CDB on Linux. The common administrative account needs commonly granted ALTER SYSTEM for this root exercise and access to V$PARAMETER (SELECT on V_$PARAMETER for SQL*Plus parameter inspection). Confirm the container and the current setting:

SHOW USER
SHOW CON_NAME
SHOW PARAMETER local_listener

The intended administrative container is CDB$ROOT. Root scope is this exercise's chosen configuration context. Oracle's 19c LOCAL_LISTENER reference also lists the parameter as modifiable in a PDB. The exercise does not change PDB overrides.

Capture the complete current value. SHOW PARAMETER is a convenient first inspection. Use a sufficiently wide, spooled query so a longer address list is not cut off:

SET LINESIZE 32767
SET PAGESIZE 100
COLUMN value FORMAT A4000
SPOOL local-listener-before.log
SHOW CON_NAME
SELECT value
FROM v$parameter
WHERE name = 'local_listener';
SPOOL OFF

Retain the full address, alias, or address list exactly, and explicitly record a null value when applicable. A null LOCAL_LISTENER selects the default local TCP address on port 1521. Keep the administrative session available through an independent connection during the exercise.

Direct LREG to the alternative endpoint

After the listener owner has verified the isolated endpoint and the database host can resolve and reach it, run in the root:

ALTER SYSTEM SET local_listener=
  '(ADDRESS=(PROTOCOL=TCP)(HOST=lab-db.example)(PORT=1522))'
  SCOPE=MEMORY;

The descriptor selects TCP, the example database host, and port 1522. SCOPE=MEMORY applies the parameter change immediately to the running instance and preserves the startup parameter file. The setting lasts until shutdown unless another parameter change replaces it. It affects the root and PDBs inheriting this parameter. Separately overridden PDB values require their own assessment. See LREG in the process architecture and ALTER SYSTEM.

The listener must already be running at that endpoint. Changing LOCAL_LISTENER controls the destination of database registration. Creation and startup of a listener are separate tasks. On this disposable single-instance example, setting one address replaces the current value. An existing alias or list must be captured for accurate restoration.

Check the new value and request registration:

SHOW PARAMETER local_listener
ALTER SYSTEM REGISTER;

ALTER SYSTEM REGISTER asks LREG to register immediately with its configured listeners, avoiding the normal discovery delay. A wrong port is still a wrong destination. Correct the address before requesting registration. Oracle also documents that the request has no effect when all services are already registered or the listener is down. See immediate LREG registration.

Verify advertisement and a fresh destination

From the listener owner's operating system shell:

lsnrctl services LISTENER_COURSE

Find the full intended service name, the expected instance, and the appropriate ready handler in the report. In this example, look for LABPDB associated with LABCDB. A dedicated handler's state:ready indicates it can accept new connections. Use the actual report from this listener. See SERVICES evidence.

Then open a new client connection through the same port and service:

sqlplus -L course_reader@//lab-db.example:1522/LABPDB

SQL*Plus prompts for the account's password. In the new session:

SHOW USER
SHOW CON_NAME
SELECT SYS_CONTEXT('USERENV','SERVICE_NAME') AS service_name,
       SYS_CONTEXT('USERENV','CON_NAME') AS container_name
FROM dual;

The intended observations are the authorized reader, the intended connected service, and container LABPDB. Compare the actual full service name with the instructor's inventory. A domain-qualified name may appear. These observations establish that this new connection used the intended route and reached its intended destination. See SQL*Plus SHOW and SYS_CONTEXT.

If registration is absent, check the database server's address resolution and reachability, PDB and service availability, and the listener's registration policy. Registration-specific settings can restrict permitted nodes, subnets, or transports. Have the listener owner assess those settings. Broad firewall or registration-security relaxation is outside this exercise.

Application service management remains a separate task. Oracle deprecated customer use of SERVICE_NAMES in 19c and recommends the appropriate service manager or DBMS_SERVICE instead. This exercise uses an existing service. See SERVICE_NAMES.

Restore the captured configuration

Restore the exact original value in the retained root administrative session. This is a template: replace the placeholder with the saved value, preserving Oracle quoting for that value.

ALTER SYSTEM SET local_listener='<captured original value>'
  SCOPE=MEMORY;
ALTER SYSTEM REGISTER;

If the recorded original value was null, use this branch:

ALTER SYSTEM SET local_listener='' SCOPE=MEMORY;
ALTER SYSTEM REGISTER;

Confirm that LOCAL_LISTENER matches the saved baseline. Check the original listener's service advertisement, then test a fresh connection through the original endpoint and confirm its service and container. Record the cleanup outcome. No SPFILE change, listener lifecycle change, or new service is needed for this exercise.

Practice and conditions

Before applying the example, have the instructor confirm the exact database release update, instance, root account, and privileges; a disposable CDB; a running isolated listener; hostname resolution; applicable registration restrictions; an available existing service; a suitable PDB open state; and a reader with login permission. Keep a baseline service report and an independent root connection. The example replaces the instance's registration value and can affect new connection routing while it is in use.

  1. Capture the original value and baseline reports completely.
  2. Set the verified alternative address in memory and request registration.
  3. Capture this listener's actual service and handler report.
  4. Open a new connection through port 1522 and record the service and container identity.
  5. Restore the original value, request registration, and verify the original route.

Pass when the actual service and handler evidence and the fresh session agree on the intended destination, the learner explains the distinction between destination and request, and cleanup returns the setting and the tested original route to baseline. Use only the designated lab. Shared listeners and production databases are outside the exercise.

The configuration and intended observations here are authored examples checked against documentation. No database or listener commands were executed while preparing this lesson, and no displayed service state is a captured lab result.

Quiz

1. Which Oracle 19c process registers instance and service information with the listener?

2. A local listener is already running at TCP port 1522. What directs the example instance's registration there?

3. Does ALTER SYSTEM REGISTER repair an incorrect port?

4. What does SCOPE=MEMORY do for this root instance parameter change?

5. Which completion evidence matches the exercise's pass criterion?

No comments:

Post a Comment

Oracle DBA Lesson 42B — Measure Shared Queues, Then Drain the Lab

Shared-server queue delay helps you decide where to investigate: dispatching, execution, resource contention, or a configured limit. Co...