Managing Users  «Prev  Next»

Lesson 10 The default domain
Objective Check your default domain.

Oracle Net default domain

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

The default domain for an Oracle Database Server is a vital component of the Oracle Network Service name resolution. If you're using a multi-level naming convention, this becomes especially crucial, as the domain is automatically appended to any unqualified service name.
To check the default domain in an Oracle 11g database, follow the below steps:
  1. Locate the sqlnet.ora File: The sqlnet.ora file contains your network configuration parameters. By default, it's located in the $ORACLE_HOME/network/admin directory. Note that this location can be modified if the TNS_ADMIN environment variable is set to a different directory.
  2. Open the sqlnet.ora File: Use a text editor to open the sqlnet.ora file. Ensure you have the appropriate permissions to read the file.
  3. Find the NAMES.DEFAULT_DOMAIN Parameter: Search for the NAMES.DEFAULT_DOMAIN parameter within the sqlnet.ora file. This parameter specifies the default domain for the Oracle database.
    The format in the sqlnet.ora file should be as follows:

In this example, is the default domain. This parameter can be set to any valid domain name as per your organizational needs.
If you do not find the NAMES.DEFAULT_DOMAIN parameter in the sqlnet.ora file, it means that a default domain is not set.
Remember, modifying the sqlnet.ora file should be done with care. Any incorrect configurations can lead to connectivity issues with your Oracle database. Always make sure to backup the original configuration file before making any changes. And if changes are made, thoroughly test the network connectivity to ensure the database operates correctly.
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:

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 "" 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 "". 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 - Production on 16-MAY-99
(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:

TNS Ping Utility for 32-bit Windows:
Version - Production on 16-MAY-99
(c) Copyright 1997 Oracle Corporation.
All rights reserved.
Attempting to contact (ADDRESS=(PROTOCOL=TCP)
OK (170 msec)
If you can tnsping successfully using a fully qualified service name (e.g. ""), 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.