Databases Reference
In-Depth Information
The C language routines for these four steps are
socket
,
bind
,
listen
, and
accept
. The use
of
INADDR_ANY
tells the operating system that the creator of the socket is willing to communicate
with any outside system that may contact it. The Solaris documentation describes
INADDR_ANY
as follows ([Sol8 2000]):
By using the special value INADDR_ANY with IP, or the unspecified address (all zeros)
with IPv6, the local IP address can be left unspecified in the bind() call by either active
or passive TCP sockets. This feature is usually used if the local address is either
unknown or irrelevant. If left unspecified, the local IP or IPv6 address will be bound at
connection time to the address of the network interface used to service the connection.
The opposite would be to allow connections from hosts residing in a certain network only.
The value of
INADDR_ANY
is an IP address that consists of all zeros (0.0.0.0). Three tools are suitable
for verifying that the TNS Listener behaves as expected:
telnet
, to establish a connection to the TNS Listener and verify that it is actually listening on
a port
netstat
, to list network connections (generic) as well as related processes (some operating
systems only)
A UNIX system call tracing utility such as
strace
(Linux),
truss
(Solaris, AIX), or
tusc
(HP-UX)
UNIX system calls are the interface to the UNIX operating system kernel. The POSIX
(Portable Operating System Interface) standard is a specification for UNIX system calls. It is
maintained by The Open Group.
4
Of course
tnsping
could also be used, but according to the
documentation (
Oracle Database Net Services Administrator's Guide 10g Release 2
) it requires a
Net service name as an argument. Fortunately, the undocumented feature of supplying an
address specification on the command line as in the following example is a big time saver:
$ tnsping '(ADDRESS=(PROTOCOL=TCP)(Host=172.168.0.1)(Port=1521))'
TNS Ping Utility for Linux: Version 10.2.0.3.0 - Production on 22-JUL-2007 20:13:38
Copyright (c) 1997, 2006, Oracle. All rights reserved.
Attempting to contact (ADDRESS=(PROTOCOL= TCP)(Host=172.168.0.1)(Port=1521))
OK (10 msec)
The address specification follows the same syntax as a full-fledged
DESCRIPTION
in
tnsnames.
ora
, but omits sections such as
CONNECT_DATA
or
FAILOVER_MODE
, which are irrelevant to
tnsping
.
On UNIX systems, quotes around it are necessary since parentheses have special meaning to
shells. From Oracle10
g
onward,
tnsping
also supports the easy connect format
host_name
:
port
/
instance_service_name
, which also does not require Net service name resolution.
C:> tnsping dbserver:1521/ten.oradbpro.com
TNS Ping Utility for 32-bit Windows: Version 10.2.0.1.0 - Production on 14-DEC-2007
18:58:59
Copyright (c) 1997, 2005, Oracle. All rights reserved.
Used parameter files:
4.