Oracle DBA - Networking & Connectivity
Oracle Net stack management for Oracle 19c and 23ai (EE; single_instance and Data
Guard; on-prem): the listener lifecycle, listener.ora / tnsnames.ora
maintenance, static and dynamic service registration, connectivity testing, and
layered ORA-12xxx connection-error diagnosis. Everything self-executing is
T1 (observe) or T2 (reversible, dry-run-default). Connection Manager
(CMAN) setup and deep network / SDU / buffer tuning are T3 and live only
in references/runbooks.md — they print commands for a human and never self-execute.
In-DB SQL (service registration, connection diagnostics) runs through the SQLcl MCP
saved connection dba_ai_conn ("sqlcl-mcp"). Host operations (lsnrctl,
srvctl, tnsping, editing *.ora) cannot go through SQLcl MCP (restrict level 4 =
no host commands) and ship as behaviour-equivalent .sh / .ps1 scripts (to
later front a guarded oracle-dba-ops MCP).
Scope & risk map
| Task |
Level |
Tier |
Mechanism (script / sql / runbook path) |
Idempotent? |
| Listener restart / reload / start / stop |
L1 |
T2 |
scripts/listener_restart.sh / .ps1 (restart|reload|start|stop) |
yes — start already-up -> noop; restart converges to "up"; stop already-down -> noop |
| Listener status |
L1 |
T1 |
scripts/listener_restart.sh status / .ps1 status |
yes — read-only (lsnrctl/srvctl status) |
| tnsping / connectivity test |
L1 |
T1 |
scripts/tnsping_test.sh / .ps1 (--alias, --tcp, --connect) |
yes — read-only layered probe (tnsping + optional TCP + DB connect via dba_ai_conn) |
| Listener creation & configuration (incl. STATIC SID_LIST) |
L2 |
T2 |
scripts/listener_create_config.sh / .ps1 (backup + reload) |
yes — listener.ora already matching host/port (+SID) -> noop |
| tnsnames.ora maintenance (add/update/remove/list) |
L2 |
T2 |
scripts/tnsnames_maintenance.sh / .ps1 (add|update|remove|list) |
yes — identical alias -> noop; missing-on-remove -> noop; list is T1 read-only |
| Static vs dynamic service registration — status |
L2 |
T1 |
scripts/service_registration.sh status / .ps1 status + sql/service_registration_status.sql |
yes — read-only |
Static vs dynamic service registration — force dynamic (ALTER SYSTEM REGISTER) |
L2 |
T2 |
scripts/service_registration.sh force / .ps1 force + sql/force_service_registration.sql |
yes — benign re-publish; persists nothing; no-op effect on re-run |
| Connection error diagnosis (ORA-12xxx) — host triage |
L2 |
T1 |
scripts/connection_diagnose.sh / .ps1 (tnsping -> lsnrctl -> TCP -> in-DB) |
yes — read-only report (findings never mutate) |
| Connection error diagnosis (ORA-12xxx) — in-DB facts |
L2 |
T1 |
sql/connection_diagnostics.sql (via dba_ai_conn) |
yes — read-only |
| Connection Manager (CMAN) setup |
L3 |
T3 |
references/runbooks.md#cman-setup |
partial — cman.ora edits reversible; conceptual setup is one-shot/design |
| Network performance / SDU / buffer tuning |
L3 |
T3 |
references/runbooks.md#network-tuning |
partial — each *.ora change reversible from backup; tuning is iterative/judgement |
Preconditions
- SQLcl MCP connection
dba_ai_conn is reachable and wallet-backed. All in-DB
work (sql/service_registration_status.sql, sql/force_service_registration.sql,
sql/connection_diagnostics.sql, and the --connect smoke test) runs through it
via connect_db / Connect-Db. Never SYS/SYSTEM — except inside a T3 runbook that
explicitly states AS SYSDBA, supplied interactively by the operator. force
needs the ALTER SYSTEM privilege on the connected account.
- Secrets resolve from the Oracle Wallet / external password store. No plaintext
anywhere. Host tools (
lsnrctl, srvctl, tnsping) use OS authentication and
need no credentials. listener.ora / tnsnames.ora hold connect descriptors, never
passwords; an argument that looks like user/pass@db or password= is rejected
with ERR_SECRET (8).
- Helpers are sourced from
_common (scripts/lib.sh / lib.ps1): connect_db,
log_event, emit_metric, require_dry_run, guard_blocked_dry_run,
require_approval_token, precheck, postcheck, print_banner. Not reinvented.
TNS_ADMIN must resolve (env TNS_ADMIN, else $ORACLE_HOME/network/admin via
--oracle-home / -OracleHome / ORACLE_HOME). On Oracle Restart / Grid
Infrastructure-managed listeners, set ODB_USE_SRVCTL=1 (--srvctl / -Srvctl) so
CRS does not auto-restart the listener underneath you.
- Logging: structured
key=value lines to the canonical paths
/var/log/oracle-dba/networking/networking.log (Linux) /
C:/ProgramData/oracle-dba/logs/networking/networking.log (Windows); skill segment
networking.
- T2 dry-run default: every T2 script previews and changes nothing unless given
--execute. Every config-file edit takes a timestamped .bak first.
Procedures
Scripts ship as behaviour-equivalent .sh (Linux) / .ps1 (Windows) pairs. T2
scripts default to --dry-run; pass --execute to act. See each script's --help.
Listener restart / reload / start / stop / status
- Trigger: apply a
listener.ora change (reload), recover a down listener
(start), bounce after a hang (restart), or audit (status).
- Precheck: control tool present (
lsnrctl, or srvctl if ODB_USE_SRVCTL=1);
valid listener name; current up/down state probed.
- Action:
scripts/listener_restart.sh {status|reload|start|stop|restart} --listener LSNR [--execute] / .ps1. reload is the least-disruptive way to apply config (re-reads listener.ora without dropping endpoints).
- Postcheck: end-state verified —
up for reload/start/restart, down for stop.
- Rollback note: a listener is restartable — re-run
start/restart. Established sessions survive a restart; only new inbound connects pause briefly.
tnsping / connectivity test
- Trigger: first responder for "cannot connect" / ORA-12541 / ORA-12514 / ORA-12170; pre-change smoke test.
- Precheck: valid
--alias (or --connect for a DB-only test).
- Action:
scripts/tnsping_test.sh --alias ALIAS [--tcp] [--connect] / .ps1. Layer 1 tnsping, optional Layer 2 raw TCP to the resolved host:port, optional Layer 3 DB login via dba_ai_conn.
- Postcheck: n/a — emits
tnsping_ok / db_connect_ok metrics; non-zero exit only if a requested probe failed.
- Rollback note: none — read-only.
Listener creation & configuration
- Trigger: stand up a new named listener, change its host/port, or add a STATIC
SID_LIST (e.g. to expose a service before the instance is OPEN, for tools that need static SID).
- Precheck: validated inputs (no
.ora injection); TNS_ADMIN writable; idempotency probe of existing block.
- Action:
scripts/listener_create_config.sh --listener LSNR --host H --port P [--static-sid SID --static-service SVC --oracle-home OH] [--execute] / .ps1 (-DbHost, -StaticSid, ...). Backs up listener.ora, rewrites the block atomically, lsnrctl reload.
- Postcheck:
lsnrctl status answers and (if static) advertises the SID/service.
- Rollback note: restore the printed
listener.ora.<ts>.bak and lsnrctl reload.
tnsnames.ora maintenance
- Trigger: add/update a client alias to a (host, port, service), remove a stale alias, or list current aliases.
- Precheck: validated alias/host/service/port;
TNS_ADMIN writable; idempotency probe.
- Action:
scripts/tnsnames_maintenance.sh {add|update|remove|list} --alias A [--host H --port P --service S] [--execute] / .ps1 (-DbHost, ...). Backs up tnsnames.ora, rewrites the alias block atomically.
- Postcheck: add/update validated with
tnsping <alias> returning OK.
- Rollback note: restore the printed
tnsnames.ora.<ts>.bak. (No service restart needed — clients re-read the file on next connect.)
Static vs dynamic service registration
- Trigger: confirm how a service is registered (status), or force an immediate dynamic re-registration after a listener restart /
local_listener change instead of waiting ~60s (force).
- Precheck:
dba_ai_conn reachable; for force, instance is OPEN and account has ALTER SYSTEM.
- Action:
scripts/service_registration.sh status (T1) or force --execute (T2) / .ps1. force runs ALTER SYSTEM REGISTER via sql/force_service_registration.sql.
- Postcheck: instance still
OPEN; verify on host with lsnrctl status <listener> — dynamic services show READY/BLOCKED, static show UNKNOWN.
- Rollback note: none needed —
REGISTER persists nothing and only re-publishes configured services.
Connection error diagnosis (ORA-12xxx)
- Trigger: a client reports ORA-12541/12514/12505/12516/12519/12520/12170/12560 or TNS-03505 and you must localise the failing layer.
- Precheck: none (read-only); valid
--alias / --listener if supplied.
- Action:
scripts/connection_diagnose.sh --alias A [--listener L] [--tcp] [--no-indb] / .ps1. Probes tnsping -> lsnrctl status -> raw TCP -> in-DB facts (sql/connection_diagnostics.sql) and prints per-layer findings + interpretation hints.
- Postcheck: n/a — surfaces
finding=... log lines; the run itself exits 0 (it is a report).
- Rollback note: none — read-only. Remediate with the listener / registration / tnsnames tasks above, or escalate deep cases to the T3 runbooks.
Tier-3 runbooks
Connection Manager (CMAN) setup and network performance / SDU / buffer tuning
are Tier 3 and live in references/runbooks.md: #cman-setup, #network-tuning.
These runbooks PRINT exact cman.ora / sqlnet.ora / listener.ora / tnsnames.ora
edits and cmctl / lsnrctl commands for a human operator and NEVER self-execute.
They are gated by require_approval_token / Require-ApprovalToken: an automated
agent's only sanctioned action is to print the relevant section and stop with
ERR_APPROVAL (6) until a human supplies a real change ticket/token (--token <TICKET>
or ODB_APPROVAL_TOKEN; placeholders are rejected). SYSDBA is a T3-only,
interactively-supplied exception. When in doubt, runbook.
See references/version-notes.md for 19c-vs-23ai behavioural deltas.
1---2name: oracle-dba-networking-connectivity3description: USE THIS SKILL WHENEVER the user mentions the Oracle listener (lsnrctl, listener.ora, listener restart/reload/start/stop, static vs dynamic registration), tnsnames.ora / sqlnet.ora / EZConnect, tnsping, service registration (ALTER SYSTEM REGISTER, service_names, local_listener/remote_listener, PMON/LREG), connectivity testing or "cannot connect to the database", Connection Manager (CMAN), SDU / SEND_BUF / RECV_BUF / network throughput tuning, or ANY of the connection errors ORA-12541 (no listener), ORA-12514 (unknown service), ORA-12505 (unknown SID), ORA-12516/12519/12520 (no handler), ORA-12170 (TNS timeout), ORA-12537/12547 (lost contact), ORA-12560 (protocol adapter), or TNS-03505 (cannot resolve name) — EVEN IF they do not name the specific task. Covers listener lifecycle, listener.ora + tnsnames.ora maintenance, static/dynamic service registration, layered ORA-12xxx diagnosis, and the plan-only Tier-3 runbooks for CMAN setup and network performance/SDU/buffer tuning. Follows the oracle-dba-common contra4---5# Oracle DBA - Networking & Connectivity67Oracle Net stack management for Oracle 19c and 23ai (EE; single_instance and Data8Guard; on-prem): the listener lifecycle, `listener.ora` / `tnsnames.ora`9maintenance, static and dynamic service registration, connectivity testing, and10layered ORA-12xxx connection-error diagnosis. Everything self-executing is11**T1 (observe)** or **T2 (reversible, dry-run-default)**. **Connection Manager12(CMAN) setup** and **deep network / SDU / buffer tuning** are **T3** and live only13in `references/runbooks.md` — they print commands for a human and never self-execute.1415In-DB SQL (service registration, connection diagnostics) runs through the SQLcl MCP16saved connection **`dba_ai_conn`** ("sqlcl-mcp"). Host operations (`lsnrctl`,17`srvctl`, `tnsping`, editing `*.ora`) cannot go through SQLcl MCP (restrict level 4 =18no host commands) and ship as behaviour-equivalent `.sh` / `.ps1` **scripts** (to19later front a guarded `oracle-dba-ops` MCP).2021## Scope & risk map2223| Task | Level | Tier | Mechanism (script / sql / runbook path) | Idempotent? |24|------|-------|------|------------------------------------------|-------------|25| Listener restart / reload / start / stop | L1 | T2 | `scripts/listener_restart.sh` / `.ps1` (`restart\|reload\|start\|stop`) | yes — `start` already-up -> noop; `restart` converges to "up"; `stop` already-down -> noop |26| Listener status | L1 | T1 | `scripts/listener_restart.sh status` / `.ps1 status` | yes — read-only (`lsnrctl`/`srvctl status`) |27| tnsping / connectivity test | L1 | T1 | `scripts/tnsping_test.sh` / `.ps1` (`--alias`, `--tcp`, `--connect`) | yes — read-only layered probe (tnsping + optional TCP + DB connect via dba_ai_conn) |28| Listener creation & configuration (incl. STATIC SID_LIST) | L2 | T2 | `scripts/listener_create_config.sh` / `.ps1` (backup + reload) | yes — listener.ora already matching host/port (+SID) -> noop |29| tnsnames.ora maintenance (add/update/remove/list) | L2 | T2 | `scripts/tnsnames_maintenance.sh` / `.ps1` (`add\|update\|remove\|list`) | yes — identical alias -> noop; missing-on-remove -> noop; `list` is T1 read-only |30| Static vs dynamic service registration — status | L2 | T1 | `scripts/service_registration.sh status` / `.ps1 status` + `sql/service_registration_status.sql` | yes — read-only |31| Static vs dynamic service registration — force dynamic (`ALTER SYSTEM REGISTER`) | L2 | T2 | `scripts/service_registration.sh force` / `.ps1 force` + `sql/force_service_registration.sql` | yes — benign re-publish; persists nothing; no-op effect on re-run |32| Connection error diagnosis (ORA-12xxx) — host triage | L2 | T1 | `scripts/connection_diagnose.sh` / `.ps1` (tnsping -> lsnrctl -> TCP -> in-DB) | yes — read-only report (findings never mutate) |33| Connection error diagnosis (ORA-12xxx) — in-DB facts | L2 | T1 | `sql/connection_diagnostics.sql` (via dba_ai_conn) | yes — read-only |34| Connection Manager (CMAN) setup | L3 | **T3** | `references/runbooks.md#cman-setup` | partial — `cman.ora` edits reversible; conceptual setup is one-shot/design |35| Network performance / SDU / buffer tuning | L3 | **T3** | `references/runbooks.md#network-tuning` | partial — each `*.ora` change reversible from backup; tuning is iterative/judgement |3637## Preconditions3839- **SQLcl MCP connection `dba_ai_conn`** is reachable and wallet-backed. All in-DB40 work (`sql/service_registration_status.sql`, `sql/force_service_registration.sql`,41 `sql/connection_diagnostics.sql`, and the `--connect` smoke test) runs through it42 via `connect_db` / `Connect-Db`. Never SYS/SYSTEM — except inside a T3 runbook that43 explicitly states `AS SYSDBA`, supplied interactively by the operator. `force`44 needs the `ALTER SYSTEM` privilege on the connected account.45- **Secrets resolve from the Oracle Wallet / external password store. No plaintext46 anywhere.** Host tools (`lsnrctl`, `srvctl`, `tnsping`) use OS authentication and47 need no credentials. `listener.ora` / `tnsnames.ora` hold connect descriptors, never48 passwords; an argument that looks like `user/pass@db` or `password=` is rejected49 with `ERR_SECRET` (8).50- **Helpers are sourced from `_common`** (`scripts/lib.sh` / `lib.ps1`): `connect_db`,51 `log_event`, `emit_metric`, `require_dry_run`, `guard_blocked_dry_run`,52 `require_approval_token`, `precheck`, `postcheck`, `print_banner`. Not reinvented.53- **`TNS_ADMIN`** must resolve (env `TNS_ADMIN`, else `$ORACLE_HOME/network/admin` via54 `--oracle-home` / `-OracleHome` / `ORACLE_HOME`). On Oracle Restart / Grid55 Infrastructure-managed listeners, set `ODB_USE_SRVCTL=1` (`--srvctl` / `-Srvctl`) so56 CRS does not auto-restart the listener underneath you.57- **Logging**: structured `key=value` lines to the canonical paths58 `/var/log/oracle-dba/networking/networking.log` (Linux) /59 `C:/ProgramData/oracle-dba/logs/networking/networking.log` (Windows); skill segment60 `networking`.61- **T2 dry-run default**: every T2 script previews and changes nothing unless given62 `--execute`. Every config-file edit takes a timestamped `.bak` first.6364## Procedures6566Scripts ship as behaviour-equivalent `.sh` (Linux) / `.ps1` (Windows) pairs. T267scripts default to `--dry-run`; pass `--execute` to act. See each script's `--help`.6869### Listener restart / reload / start / stop / status70- **Trigger**: apply a `listener.ora` change (`reload`), recover a down listener71 (`start`), bounce after a hang (`restart`), or audit (`status`).72- **Precheck**: control tool present (`lsnrctl`, or `srvctl` if `ODB_USE_SRVCTL=1`);73 valid listener name; current up/down state probed.74- **Action**: `scripts/listener_restart.sh {status|reload|start|stop|restart} --listener LSNR [--execute]` / `.ps1`. `reload` is the least-disruptive way to apply config (re-reads `listener.ora` without dropping endpoints).75- **Postcheck**: end-state verified — `up` for reload/start/restart, `down` for stop.76- **Rollback note**: a listener is restartable — re-run `start`/`restart`. Established sessions survive a restart; only new inbound connects pause briefly.7778### tnsping / connectivity test79- **Trigger**: first responder for "cannot connect" / ORA-12541 / ORA-12514 / ORA-12170; pre-change smoke test.80- **Precheck**: valid `--alias` (or `--connect` for a DB-only test).81- **Action**: `scripts/tnsping_test.sh --alias ALIAS [--tcp] [--connect]` / `.ps1`. Layer 1 tnsping, optional Layer 2 raw TCP to the resolved host:port, optional Layer 3 DB login via `dba_ai_conn`.82- **Postcheck**: n/a — emits `tnsping_ok` / `db_connect_ok` metrics; non-zero exit only if a requested probe failed.83- **Rollback note**: none — read-only.8485### Listener creation & configuration86- **Trigger**: stand up a new named listener, change its host/port, or add a STATIC `SID_LIST` (e.g. to expose a service before the instance is OPEN, for tools that need static SID).87- **Precheck**: validated inputs (no `.ora` injection); `TNS_ADMIN` writable; idempotency probe of existing block.88- **Action**: `scripts/listener_create_config.sh --listener LSNR --host H --port P [--static-sid SID --static-service SVC --oracle-home OH] [--execute]` / `.ps1` (`-DbHost`, `-StaticSid`, ...). Backs up `listener.ora`, rewrites the block atomically, `lsnrctl reload`.89- **Postcheck**: `lsnrctl status` answers and (if static) advertises the SID/service.90- **Rollback note**: restore the printed `listener.ora.<ts>.bak` and `lsnrctl reload`.9192### tnsnames.ora maintenance93- **Trigger**: add/update a client alias to a (host, port, service), remove a stale alias, or list current aliases.94- **Precheck**: validated alias/host/service/port; `TNS_ADMIN` writable; idempotency probe.95- **Action**: `scripts/tnsnames_maintenance.sh {add|update|remove|list} --alias A [--host H --port P --service S] [--execute]` / `.ps1` (`-DbHost`, ...). Backs up `tnsnames.ora`, rewrites the alias block atomically.96- **Postcheck**: add/update validated with `tnsping <alias>` returning OK.97- **Rollback note**: restore the printed `tnsnames.ora.<ts>.bak`. (No service restart needed — clients re-read the file on next connect.)9899### Static vs dynamic service registration100- **Trigger**: confirm how a service is registered (status), or force an immediate dynamic re-registration after a listener restart / `local_listener` change instead of waiting ~60s (force).101- **Precheck**: `dba_ai_conn` reachable; for `force`, instance is `OPEN` and account has `ALTER SYSTEM`.102- **Action**: `scripts/service_registration.sh status` (T1) or `force --execute` (T2) / `.ps1`. `force` runs `ALTER SYSTEM REGISTER` via `sql/force_service_registration.sql`.103- **Postcheck**: instance still `OPEN`; verify on host with `lsnrctl status <listener>` — dynamic services show `READY`/`BLOCKED`, static show `UNKNOWN`.104- **Rollback note**: none needed — `REGISTER` persists nothing and only re-publishes configured services.105106### Connection error diagnosis (ORA-12xxx)107- **Trigger**: a client reports ORA-12541/12514/12505/12516/12519/12520/12170/12560 or TNS-03505 and you must localise the failing layer.108- **Precheck**: none (read-only); valid `--alias` / `--listener` if supplied.109- **Action**: `scripts/connection_diagnose.sh --alias A [--listener L] [--tcp] [--no-indb]` / `.ps1`. Probes tnsping -> `lsnrctl status` -> raw TCP -> in-DB facts (`sql/connection_diagnostics.sql`) and prints per-layer findings + interpretation hints.110- **Postcheck**: n/a — surfaces `finding=...` log lines; the run itself exits 0 (it is a report).111- **Rollback note**: none — read-only. Remediate with the listener / registration / tnsnames tasks above, or escalate deep cases to the T3 runbooks.112113## Tier-3 runbooks114115**Connection Manager (CMAN) setup** and **network performance / SDU / buffer tuning**116are Tier 3 and live in **`references/runbooks.md`**: `#cman-setup`, `#network-tuning`.117These runbooks **PRINT exact `cman.ora` / `sqlnet.ora` / `listener.ora` / `tnsnames.ora`118edits and `cmctl` / `lsnrctl` commands for a human operator and NEVER self-execute.**119They are gated by `require_approval_token` / `Require-ApprovalToken`: an automated120agent's only sanctioned action is to print the relevant section and stop with121`ERR_APPROVAL` (6) until a human supplies a real change ticket/token (`--token <TICKET>`122or `ODB_APPROVAL_TOKEN`; placeholders are rejected). SYSDBA is a T3-only,123interactively-supplied exception. When in doubt, runbook.124125See `references/version-notes.md` for 19c-vs-23ai behavioural deltas.