Oracle Net Services

38.1 Components

Listener (tnslsnr, default port 1521) accepts connections and hands them off to server processes.

Service names and dynamic service registration (LREG). LOCAL_LISTENER, REMOTE_LISTENER (RAC/SCAN).

Configuration files in $ORACLE_HOME/network/admin or $TNS_ADMIN:

# listener.ora
LISTENER = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = dbhost)(PORT = 1521)))

# tnsnames.ora
ORCLPDB1 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = dbhost)(PORT = 1521))
    (CONNECT_DATA = (SERVER = DEDICATED)(SERVICE_NAME = orclpdb1)))

# sqlnet.ora
NAMES.DIRECTORY_PATH = (TNSNAMES, EZCONNECT)
SQLNET.ENCRYPTION_SERVER = REQUIRED
SQLNET.EXPIRE_TIME = 10

38.2 Commands

lsnrctl status | start | stop | services | reload
tnsping ORCLPDB1
EXEC DBMS_SERVICE.CREATE_SERVICE('reporting', 'reporting.example.com');
EXEC DBMS_SERVICE.START_SERVICE('reporting');
SELECT name, network_name FROM v$services;

38.3 Naming Methods

Local naming (tnsnames), EZConnect (host:port/service), EZConnect Plus (19c), directory naming (LDAP/OID/AD), centralized config (23ai: Azure App Config / OCI Object Storage).

38.4 Advanced Net Features

Shared server (DISPATCHERS, SHARED_SERVERS), Connection Manager (CMAN) as a proxy, Traffic Director mode.

Failover and load balancing: FAILOVER=ON, LOAD_BALANCE=ON, TAF, FAN, Application Continuity / Transparent Application Continuity.

Network encryption: native network encryption or TLS (TCPS with wallets). Valid node checking (TCP.VALIDNODE_CHECKING).