Database Reference
In-Depth Information
CHAPTER 32
■ ■ ■
Default Host Name in
Oracle Net Configurations
I
t is undocumented that the host name may be left unspecified in the configuration files
listener.ora
and
tnsnames.ora
. Hence, the configuration file
listener.ora
does not need to
be modified in case the host name is changed. Custom scripts that might generate a TNS Listener
configuration do not have to consider varying host names as long as the TNS Listener may use
the default host name (i.e., the local system's host name, which uniquely identifies it).
Default Host Name
In a Net service name description, the host name may be omitted. The syntax for omitting the
host name (or IP address) is simply
(HOST=)
. If the host name or IP address is an empty string,
it defaults to the host name of the local system, which may be obtained with the command
hostname
(UNIX and Windows) or the C library routine
gethostname
. Since the latter is not a
UNIX system call, it cannot be observed with system call trace utilities such as
truss
. Following
is an example that passes a Net service name description to
tnsping
on the command line:
$ tnsping "(ADDRESS=(PROTOCOL=TCP)(Host=)(Port=1521))"
TNS Ping Utility for Linux: Version 10.2.0.3.0 - Production on 22-JUL-2007 22:13:07
Attempting to contact (ADDRESS=(PROTOCOL= TCP)(Host=)(Port=1521))
OK (0 msec)
The same syntax may also be used in
listener.ora
, such as in the following example:
LISTENER_DBSERVER1 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS=(PROTOCOL=TCP)(HOST=)(PORT=1521)(IP=FIRST))
)
)
423