Managing Users  «Prev  Next»

Lesson 10 The Default Domain
Objective Check your default domain.

Checking the Default Domain in Oracle AI Database 26ai

Oracle Net supports a multi-level naming convention for database services, similar in spirit to the way domain names work on the internet. Your entry for COIN in the tnsnames.ora file, covered back in Lesson 7, likely starts out something like this:
COIN.us.example.com =
The domain portion, us.example.com in this case, is significant: it identifies which Oracle Net domain the entry belongs to, and it's what makes the "default domain" concept in this lesson worth understanding.
When you connect to the COIN service, you have two options. You can specify the domain explicitly, using coin.us.example.com as your service name, or you can rely on Oracle Net's default domain setting and simply use COIN. The default domain is defined in sqlnet.ora, a configuration file found in the same directory as tnsnames.ora. The line that sets it looks like this:
NAMES.DEFAULT_DOMAIN = us.example.com
In this example, the default domain matches the domain portion of coin.us.example.com exactly, so you're free to refer to the service simply as coin. Oracle Net appends the default domain automatically, resolves the result against your tnsnames.ora entries, and finds the match.

When the Domains Don't Match

Now consider what happens if someone changes that setting to something that no longer matches:
NAMES.DEFAULT_DOMAIN = notworld
The domains no longer line up. The default domain is now notworld, and if you try to connect to a service named coin, Oracle Net appends .notworld and attempts to resolve coin.notworld instead. Since no entry named coin.notworld exists in your tnsnames.ora file, you get a resolution failure:
C:\>tnsping coin
TNS Ping Utility for Windows: Version 26.0.0.0.0 - Production
Copyright (c) 1997, 2026, Oracle. All rights reserved.
TNS-03505: Failed to resolve name

The Trailing-Period Escape

There's a related situation worth understanding, and it's one this lesson's earlier version didn't cover: what happens when a service name in tnsnames.ora isn't domain-qualified at all, and you don't want the default domain appended to it. Suppose your default domain is set to us.example.com, and your tnsnames.ora file contains an unqualified entry named sales2. If you simply connect using sales2, Oracle Net appends the default domain and tries to resolve sales2.us.example.com, which won't match the unqualified entry you actually have.
The fix is a trailing period at the end of the connect string:
CONNECT scott@sales2.
Enter password: password
That final dot tells Oracle Net not to append the default domain, so the connection resolves to sales2 exactly as entered, matching the unqualified tnsnames.ora entry. It's a small piece of syntax, easy to overlook, but it's the specific fix for a domain mismatch caused by an unqualified name rather than a mismatched domain setting.

Two Ways to Check Your Default Domain

There are two reliable ways to determine what your default domain actually is: checking the client configuration directly, and checking it indirectly through the database's global name.
Examining sqlnet.ora directly. Locate the file, typically in $ORACLE_HOME/network/admin on Linux and Unix, or %ORACLE_HOME%\network\admin on Windows, or wherever the TNS_ADMIN environment variable points if you've set it, as covered in Lesson 7. Look for a line matching:
NAMES.DEFAULT_DOMAIN = <domain name>
Whatever appears after the equals sign is your default domain, plain and simple.
Querying GLOBAL_NAME from SQL*Plus. Connect to your database and run:
SELECT * FROM GLOBAL_NAME;
This returns a single row: the database's global name, formed by combining the database name with its configured domain, something like COIN.us.example.com. This approach checks the server's own configured domain rather than a specific client's sqlnet.ora setting, so it's useful when you want to confirm the database side of the picture rather than any one client's local configuration.
A couple of things worth keeping in mind. If your client configuration specifies a domain explicitly, that explicit value takes precedence over whatever default domain is set, so an explicit setting will always win. And if you're using directory naming through an LDAP directory rather than local naming through tnsnames.ora, the concept of a default domain can get more complex: you may have multiple default contexts defined, with the specific one used depending on the client's own configuration rather than a single global setting.

Diagnosing Domain Mismatches

Domain mismatches like the one above are easy to diagnose once you know what to look for. Simply run tnsping against the fully qualified service name instead of the short form:
C:\>tnsping coin.us.example.com
TNS Ping Utility for Windows: Version 26.0.0.0.0 - Production
Copyright (c) 1997, 2026, Oracle. All rights reserved.
Attempting to contact (ADDRESS=(PROTOCOL=TCP)(Host=10.11.49.239)(Port=1521))
OK (170 msec)
If a fully qualified name like coin.us.example.com connects successfully, but the short form coin fails, the problem is specifically your default domain setting, not the underlying network or listener. From there you have two reasonable options: correct the default domain in sqlnet.ora to match your actual entries, or simply get in the habit of using fully qualified service names and skip the default-domain mechanism entirely. Either approach works; consistency matters more than which one you pick. Whichever you choose, adopting a predictable naming and distribution strategy for tnsnames.ora across your client machines, and testing changes with tnsping before relying on them, will save you from tracking down this exact class of problem repeatedly. See creating and maintaining tnsnames.ora for that broader strategy.
One related setting worth knowing about, even though it's outside this lesson's scope: sqlnet.ora also controls connection timeout behavior, separate from anything related to default domains. Setting sane outbound, inbound, send, and receive timeout values helps avoid a connection attempt hanging indefinitely instead of failing cleanly; see setting TNS timeout values for that topic specifically.

SEMrush Software 10 SEMrush Banner 10