| Lesson 11 | Two Ways to Connect to Remote Databases |
| Objective | Describe the Two Ways to connect to Remote Databases using Oracle Network Services |
Oracle Network Services — also known as Oracle Net, and formerly known as SQL*Net — provides two primary methods for connecting client applications to remote Oracle databases. Both methods have existed since Oracle 9i and remain the standard connection approaches through Oracle 23ai. The choice between them determines how much client-side configuration is required, how complex the connection descriptor can be, and how well the connection supports enterprise features such as load balancing, failover, and multi-address configurations.
The original SQL*Net version 1 connection model required clients to embed the full protocol,
hostname, and database name in every connection request — for example,
sqlplus /@t:host:database where t indicated TCP/IP, host
was the remote server name, and database was the Oracle SID. This approach was
functional but inflexible — changing a server hostname required updating every application
that embedded the connection string. SQL*Net version 2 introduced the tnsnames.ora alias
lookup that separated the connection identifier from the connection details. Oracle 9i and later
formalized and extended both approaches into the two methods that Oracle Net uses today.
The Easy Connect Naming Method is the simplest approach to Oracle database connectivity. It requires no client-side configuration files, no tnsnames.ora entry, and no additional naming resolution setup. Oracle Net directly interprets the connection string provided in the connect identifier and resolves the connection without any lookup step.
Easy Connect is enabled by default in modern Oracle clients and is the recommended method for simple TCP/IP connections, development environments, ad-hoc administrative connections, and any scenario where minimizing client configuration overhead is a priority.
The basic Easy Connect syntax is:
username/password@host[:port][/service_name]
The host is the hostname or IP address of the remote database server. The port defaults to
1521 if omitted. The service_name is the Oracle database service name — equivalent to the
SERVICE_NAME parameter in a tnsnames.ora CONNECT_DATA block.
Practical examples:
-- Basic Easy Connect with explicit port and service name
sqlplus hr/password@dbhost.example.com:1521/orclpdb
-- Port defaults to 1521 when omitted
sqlplus hr/password@192.168.1.100/orclpdb
-- Oracle 23ai TCPS connection with SSL
sqlplus hr/password@'tcps://dbhost.example.com:2484/orclpdb'
-- Oracle 23ai example from production
sqlplus system/PassFun23ai@'mmfalcon:1521/mmdb23ai'
Oracle 19c introduced Easy Connect Plus, which extends the basic Easy Connect syntax to support additional connection parameters directly in the connection string without requiring a tnsnames.ora entry. Easy Connect Plus supports:
DEDICATED or SHARED
server mode inline in the connect stringssl_server_dn_match,
ssl_server_cert_dn for TCPS connectionsconnect_timeout and
retry_count parameters-- Easy Connect Plus with TCPS and SSL verification in Oracle 23ai
sqlplus hr/password@'tcps://sales-server:2484/sales_pdb?ssl_server_dn_match=yes'
-- Easy Connect Plus with connection timeout
sqlplus hr/password@'dbhost:1521/orclpdb?connect_timeout=10&retry_count=3'
In Oracle 23ai, Easy Connect Plus also supports LDAP/LDAPS parameters and can reference Centralized Configuration Providers in OCI Object Storage — making it practical for cloud and hybrid environments without any local configuration file dependency.
Easy Connect is ideal for: development and testing environments where configuration simplicity is valued over enterprise features; ad-hoc DBA connections to remote databases; simple application deployments with a single database endpoint; and container-based Oracle deployments where client configuration file management is undesirable.
Easy Connect is less suitable for: Oracle RAC environments requiring client load balancing across multiple instances; configurations requiring connect-time failover across multiple listener addresses; and legacy application drivers that do not support the Easy Connect Plus extended syntax introduced in Oracle 19c.
The Local Naming Method uses a network service name alias defined in the client's tnsnames.ora configuration file. The alias maps to a full connection descriptor containing the protocol, host address, port, and database service name. The client application connects using only the short alias — Oracle Net resolves the alias to the full connection descriptor transparently.
The tnsnames.ora file is located in $ORACLE_HOME/network/admin/ on the client
machine, or in the directory specified by the TNS_ADMIN environment variable.
In Oracle 23ai, the TNS_ADMIN variable can point to an OCI Object Storage
location through Centralized Configuration Providers, eliminating the need for a local file.
A tnsnames.ora entry for a remote database:
MY_REMOTE_DB =
(DESCRIPTION =
(ADDRESS =
(PROTOCOL = TCP)
(HOST = sales-server)
(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = sales.us.example.com)))
Once the alias is defined in tnsnames.ora, connecting to the remote database requires only the alias name:
-- Local naming connection using tnsnames.ora alias
sqlplus hr/password@MY_REMOTE_DB
-- Oracle 23ai example
sqlplus system/PassFun23ai@mmdb23ai
The SERVICE_NAME parameter in the CONNECT_DATA block is the modern
standard — it replaced the legacy SID parameter introduced in Oracle 8.1 and
earlier. Use SERVICE_NAME for all Oracle 9i and later connections.
The Local Naming Method's primary advantage over Easy Connect is its support for complex multi-address configurations — particularly Oracle RAC load balancing and connect-time failover. A single tnsnames.ora alias can specify multiple listener addresses:
SALES_RAC =
(DESCRIPTION =
(ADDRESS_LIST =
(LOAD_BALANCE = ON)
(FAILOVER = ON)
(ADDRESS = (PROTOCOL = TCP)(HOST = rac-node1)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = rac-node2)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = rac-node3)(PORT = 1521)))
(CONNECT_DATA =
(SERVICE_NAME = sales.us.example.com)
(SERVER = DEDICATED)))
With LOAD_BALANCE = ON, Oracle Net randomly selects from the available
addresses at connect time, distributing new connections across all three RAC nodes.
With FAILOVER = ON, if one address is unavailable, Oracle Net automatically
tries the next address in the list — providing connect-time failover without application
code changes.
Local Naming is preferred for: Oracle RAC environments requiring client-side load balancing;
configurations requiring connect-time failover across multiple listeners; enterprise
deployments where centralized tnsnames.ora distribution provides consistent connection
management; and database links where the USING clause references a TNS alias.
Local Naming requires maintaining tnsnames.ora files on client machines — historically one of the most significant Oracle DBA operational burdens in large deployments. Oracle 23ai addresses this through Centralized Configuration Providers, which store tnsnames.ora content as JSON in OCI Object Storage, making it available to all clients without local file distribution.
The sqlnet.ora file controls which naming methods Oracle Net tries and in which order when
resolving a connect identifier. The NAMES.DIRECTORY_PATH parameter specifies
the resolution sequence:
-- sqlnet.ora — naming method resolution order
NAMES.DIRECTORY_PATH = (TNSNAMES, EZCONNECT)
With this configuration, Oracle Net first checks tnsnames.ora for the connect identifier. If not found, it attempts Easy Connect interpretation. The order can be reversed or extended to include LDAP directory naming:
-- sqlnet.ora — include LDAP directory naming
NAMES.DIRECTORY_PATH = (LDAP, TNSNAMES, EZCONNECT)
In Oracle 23ai, Centralized Configuration Providers are added to the resolution path
through the CONFIG_FILE parameter, allowing the client to retrieve connection
descriptors from OCI Object Storage as a fourth resolution method alongside the three
traditional options.
| Aspect | Easy Connect (EZCONNECT) | Local Naming (tnsnames.ora) |
| Client configuration file required | No | Yes — tnsnames.ora |
| Connect string format | host:port/service_name inline | Short alias resolved by Oracle Net |
| RAC load balancing | Limited (Easy Connect Plus only) | Full support via ADDRESS_LIST |
| Connect-time failover | Limited (Easy Connect Plus only) | Full support via FAILOVER=ON |
| Setup overhead | Minimal | Moderate — file distribution required |
| Best for | Development, ad-hoc, simple single-instance | Production, RAC, failover, enterprise |
| Oracle 23ai cloud option | Easy Connect Plus with TCPS/TLS 1.3 | Centralized Config Provider (OCI Object Storage) |
Oracle Network Services provides two primary methods for connecting to remote databases.
Easy Connect (EZCONNECT) requires no client-side configuration — the host, port, and
service name are embedded directly in the connect string, making it ideal for simple
environments and development work. Easy Connect Plus in Oracle 19c and 23ai extends this
with TCPS/TLS parameters, connection timeouts, and retry configuration inline. The Local
Naming Method uses a tnsnames.ora alias that Oracle Net resolves to a full connection
descriptor, supporting complex RAC, failover, and multi-address configurations that Easy
Connect cannot handle without extensions. Both methods connect through the Oracle Net
Foundation Layer to the Oracle Net Listener and ultimately to the Oracle Database. The
sqlnet.ora NAMES.DIRECTORY_PATH parameter controls which method Oracle Net
tries first when a connect identifier is submitted. The next lesson examines the features
of Oracle Net Services and the UPI/OPI programmatic interface architecture.