Database Reference
In-Depth Information
This configuration information allows the Oracle client software to map the TNS connection string we used,
ora12cr1 , into something useful—namely, a hostname, a port on that host on which a listener process will accept
connections, the service name of the database on the host to which we wish to connect, and so on. A service name
represents groups of applications with common attributes, service level thresholds, and priorities. The number of
instances offering the service is transparent to the application, and each database instance may register with the
listener as willing to provide many services. So, services are mapped to physical database instances and allow the DBA
to associate certain thresholds and priorities with them.
This string, ora12cr1 , could have been resolved in other ways. For example, it could have been resolved using
a naming service provided by the Lightweight Directory Access Protocol (LDAP) server, similar in purpose to DNS
for hostname resolution. However, use of the tnsnames.ora file is common in most small to medium installations
(as measured by the number of hosts that need to connect to the database) where the number of copies of such a
configuration file is manageable.
eaSY CONNeCt
the easy connect method allows you to connect to a remote database without the need of a tnsnames.ora file
(or other methods of resolving the location of the database). if you know the name of the host, server, port, and
service name, you can directly enter those on the command line. the syntax is as follows:
sqlplus username@[//]host[:port][/service_name][:server][/instance_name]
For example, assuming the host name is hesta , the port is 1521, and the service name is ora12cr1 , then you can
connect as follows:
$ sqlplus user/pass@hesta:1521/ora12cr1
the easy connect method is handy for situations in which you're troubleshooting connectivity issues or when you
don't have a tnsnames.ora file available (or other ways to resolve the remote connection).
Now that the client software knows where to connect to, it will open a TCP/IP socket connection to the server
with the hostname somehost.somewhere.com on port 1521 (this is the default listener port, and can be configured to
run on other ports). If the DBA for our server has installed and configured Oracle Net, and has the listener listening on
port 1521 for connection requests, this connection may be accepted. In a network environment, we will be running
a process called the TNS listener on our server. This listener process is what will get us physically connected to our
database. When it receives the inbound connection request, it inspects the request and, using its own configuration
files, either rejects the request (because there is no such service, for example, or perhaps our IP address has been
disallowed connections to this host) or accepts it and goes about getting us connected.
If we are making a dedicated server connection, the listener process will create a dedicated server for us.
On UNIX/Linux, this is achieved via fork() and exec() system calls (the only way to create a new process after
initialization in UNIX/Linux is via fork() ). The new dedicated server process inherits the connection established
by the listener, and we are now physically connected to the database. On Windows, the listener process requests the
database process to create a new thread for a connection. Once this thread is created, the client is “redirected“ to it,
and we are physically connected. Diagrammatically in UNIX/Linux, it would look as shown in Figure 2-4 .
 
Search WWH ::




Custom Search