Managing Users  «Prev  Next»

Lesson 10 The default domain
Objective Check your default domain.

Check the default domain using a multi-level naming convention for an Oracle Database Server

Here are the main ways to check the default domain used in a multi-level naming convention for an Oracle Database Server:
  1. Examining the sqlnet.ora File
    • Location: The `sqlnet.ora` file is usually found in the
      1. $ORACLE_HOME/network/admin directory (Linux/Unix) or
      2. %ORACLE_HOME%\network\admin (Windows).
    • Search for the Parameter: Look for the following parameter:
         NAMES.DEFAULT_DOMAIN = <domain name>
         
    • Interpretation: The value specified after `NAMES.DEFAULT_DOMAIN =` is your default domain.
  2. Using the SQL*Plus Tool:
    1. Connect to the Database: Connect to your Oracle database instance using SQL*Plus.
    2. Query the Global Name: Execute the following query:
         SELECT * FROM GLOBAL_NAME;
         
      • Locate the Domain: The "GLOBAL_NAME" value will be composed of the database name followed by your default domain
        (for example, MYDATABASE.MYDOMAIN.COM).
Important Notes
  • Directory Naming: If you're using directory naming (e.g., LDAP), the concepts of default domains can be more complex. You might have multiple default contexts defined, and the specific one used depends on the client's configuration.
  • Precedence: If your client configuration has a specific domain specified explicitly, it will usually override the default domain setting.

Oracle Net can use a multi-level naming convention for database servers that is not unlike that used on the internet. Your entry for COIN in the tnsnames.ora file probably starts out like this:
COIN.WORLD =

The ".WORLD" is significant. It represents the Oracle Net domain of the entry. When you connect to the COIN service, you can specify this domain explicitly by using "coin.world" as your service name, or you can rely on the Oracle Net default domain and just use "COIN." The default domain is defined in a file named sqlnet.ora, which is found in the same directory as the tnsnames.ora file. The line in the sqlnet.ora file that defines the default domain looks like this:
names.default_domain = world
In the example above, the default domain of "world" matches the domain of "world" in "coin.world". Consequently, you may simply refer to the service as "coin". However, let's consider what would happen if your default domain entry looked like this (someone would have to have changed it for it to look like this):
names.default_domain = notworld

Now the domains do not match. The default domain is "notworld", and if you tried to connect to a service named "coin", Oracle Net would append ".notworld" onto the end and try to connect you to "coin.notworld". Since "coin.notworld" does not exist in your tnsnames.ora file, you would get an error like that shown in this example:
C:\>tnsping coin
TNS Ping Utility for 32-bit Windows:
Version 8.1.5.0.0 - Production on 16-MAY-99
 14:08:08
(c) Copyright 1997 Oracle Corporation.
All rights reserved.
TNS-03505: Failed to resolve name

Diagnosing Domain Mismatches

Default domain mismatches like this are very easy to diagnose. All you have to do is to tnsping the server and specify the fully qualified service name when you do. For example:

C:\>tnsping coin.world
TNS Ping Utility for 32-bit Windows:
Version 8.1.5.0.0 - Production on 16-MAY-99
 14:08:15
(c) Copyright 1997 Oracle Corporation.
All rights reserved.
Attempting to contact (ADDRESS=(PROTOCOL=TCP)
(Host=10.11.49.239)(Port=1521))
OK (170 msec)

If you can tnsping successfully using a fully qualified service name (e.g. "coin.world"), but not when you depend on the default domain (e.g. "coin"), then you have an issue with the default domain. You can change the default domain if you like, by editing the sqlnet.ora file, or you can decide to always use the fully qualified service name.

SEMrush Software