Sub topic 1
What an Oracle connection is made of
An Oracle connection is a session between a client tool and an Oracle Database service. The client might be SQL Developer, SQLcl, an application, or another database tool. To create the session, the client needs a network destination, a database service, and valid credentials.
Prerequisites
This chapter assumes that you know basic relational database and SQL terms, can use a terminal, and have access to a reachable Oracle Database account. You should also know the database host and the service name supplied by your database administrator.
The four main connection details
An Oracle connection normally contains these parts:
| Part | Meaning | Example |
|---|---|---|
| Host | The DNS name or IP address of the database server | `dbhost.example.com` |
| Port | The TCP port where the Oracle listener accepts connections | `1521` |
| Service name | The database service that should handle the session | `orclpdb1.example.com` |
| Credentials | The username and password used to authenticate | `hr` and its password |
The host identifies the machine. The port identifies the network endpoint on that machine. Oracle commonly uses port 1521, but installations can use another port.
The service name identifies the logical database service. A single Oracle server can offer several services, such as a production service, a reporting service, and different pluggable databases. Selecting the wrong service can connect successfully but place you in the wrong database environment.
Credentials prove who you are. A username determines the database account and its privileges. The password verifies that you may use that account. Authentication can also use other methods, such as an external identity provider or a wallet, but the connection still needs an authentication method.
How the listener fits in
The Oracle listener is a server process that receives connection requests. The client first contacts the listener at the specified host and port. The listener then finds the requested service and passes the session to the database process that serves it.
The client does not normally connect to a database file directly. It connects through the listener and names a service.
client tool -> host:port -> Oracle listener -> service -> database sessionA listener can be running while the requested service is unavailable. This distinction explains why different connection errors point to different problems.
ORA-12541usually means that no listener accepted the request at the specified host and port.ORA-12514usually means that the listener is reachable but does not know the requested service.ORA-01017means that the destination was reached, but the username or password was rejected.
Service names and SIDs
A service name describes a service that accepts client connections. A SID, or system identifier, traditionally identifies a particular Oracle database instance. Modern client connections usually use service names because services can support routing, high availability, and pluggable databases.
Some tools or older connection strings ask for a SID instead of a service name. Do not substitute one for the other without confirming the database configuration. The same text may not be valid in both fields.
A complete connection description
These details together describe one possible destination:
User: hr
Host: dbhost.example.com
Port: 1521
Service name: orclpdb1.example.comTools package these values in different formats. Easy Connect writes them in one line:
hr@//dbhost.example.com:1521/orclpdb1.example.comA TNS alias stores the host, port, and service name in a configuration file and replaces them with a short name. A JDBC URL expresses the same destination for Java-based tools and applications. The format changes, but the connection model stays the same.
Exercise
A connection reaches dbhost.example.com:1521, but Oracle reports ORA-12514. Which connection part should you check first?
Show answer
Check the service name. The listener is reachable, but it does not recognize the requested service.