Sie sind auf Seite 1von 38

Unauthorized reproduction or distribution prohibitedฺ Copyright© 2015, Oracle and/or its affiliatesฺ

C fi
Configuring
i the
th Oracle
O l Network
N t k Environment
E i t

s a
) h a
c o m d e ฺ

ail t Gu i
m
g den
ed Stu@
m
ha e this
o
c l eฺm to us
( o ra se
a b © 2014, c n and/or its affiliates. All rights reserved.
eOracle
z
Copyright l i
e d a able
r
o hamansfe
m -tr
non
Objectives

After completing this lesson, you should be able to:


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2015, Oracle and/or its affiliatesฺ

• Use Enterprise Manager Cloud Control and Oracle Net


Manager to:
– Create additional listeners
– Create Oracle Net Service aliases
– Control Oracle Net Listener
• Use the Listener Control Utility to manage Oracle Net
Listener s a
h a
• Use tnsping to test Oracle Net connectivity om) eฺ
a to u ilฺc id
• Identify when to use shared servers andmwhen
g den t G
use
dedicated servers ed @ tu
h a m his S
ฺ m o se t
r a cle to u
b (o ense
a za le
Copyright licOracle and/or its affiliates. All rights reserved.
© 2014,

m ed rab
o ha ansfe
m -tr
non

Oracle Database 12c: Administration Workshop 5 - 2


Oracle Net Services: Overview
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2015, Oracle and/or its affiliatesฺ

Application RDBMS

Oracle Net TCP/IP Oracle Net


Client or network
Listener Database server a
middle tier s
a
)h ฺ
o m e
a ilฺc Guid
g m ent
e d@ Stud
Oracle Net
o h am this Oracle Net
configuration files configuration files
l e ฺm use
o r ac se to
b ( en
a a
z le
Copyright licOracle and/or its affiliates. All rights reserved.
© 2014,

m ed rab
o
Oracle Net hServices fe network connections from a client or middle-tier application to
a nsenables
m server.
the Oracle n - tra After a network session is established, Oracle Net acts as the data courier
o client application and the database server. It is responsible for establishing and
for bothnthe
maintaining the connection between the client application and database server, as well as
exchanging messages between them. Oracle Net (or something that simulates Oracle Net,
such as Java Database Connectivity) is located on each computer that needs to talk to the
database server.
On the client computer, Oracle Net is a background component for application connections to
the database.
O the
On th database
d t b server, OOracle
l NNett iincludes
l d an active
ti process called
ll d Oracle
O l N Nett Li
Listener,
t
which is responsible for coordinating connections between the database and external
applications.
The most common use of Oracle Net Services is to allow incoming database connections.
You can configure additional net services to allow access to external code libraries
(EXTPROC) and to connect the Oracle instance to non-Oracle data sources (such as Sybase,
Informix, DB2, and SQL Server)) through
g Oracle Heterogeneous
g Services.

Oracle Database 12c: Administration Workshop 5 - 3


Oracle Net Listener: Overview
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2015, Oracle and/or its affiliatesฺ

Enterprise Manager Listener


Cloud Control or
Oracle Net Manager
Oracle databases
s a
a
)h ฺ
o m e
a ilฺc Guid
Oracle Net g m ent
configuration files ed@ tud
h a m his S
ฺ m o se t
<ORACLE_HOME>/network/admin/listener.ora
./sqlnet.ora
c l e to u
( o ra se
a b © 2014, c n and/or its affiliates. All rights reserved.
eOracle
z
Copyright l i
e d a able
r
am ns(orfesimply
o hListener
Oracle Net a the listener) is the gateway to the Oracle instance for all
m t r
- connections. A single listener can service multiple database instances and
nonlocal user
nonof client connections.
thousands
You can use Enterprise Manager Cloud Control or Oracle Net Manager to configure the
listener and specify log file locations.
Advanced administrators can also configure Oracle Net Services by manually editing the
configuration files, if necessary, with a standard operating system (OS) text editor such as vi
or gedit.

Oracle Database 12c: Administration Workshop 5 - 4


Establishing Oracle Network Connections

To make a client or middle-tier connection, Oracle Net requires


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2015, Oracle and/or its affiliatesฺ

the client to know the:


• Host where the listener is running
• Port that the listener is monitoring
• Protocol that the listener is using
• Name of the service that the listener is handling

s a
a
)h ฺ
o m e
a ilฺc Guid
g m ent
e d@ Stud
o h am this
Names resolution
l e ฺm use
o r ac se to
b ( en
a a
z le
Copyright licOracle and/or its affiliates. All rights reserved.
© 2014,

m ed rab
o
For an application
fe to a service through Oracle Net Listener, the application must
ha antosconnect
m -tr about that service, including the address or host where the listener resides,
have information
nonthat the listener accepts, and the port that the listener monitors. After the listener
the protocol
is located, the final piece of information that the application needs is the name of the service
to which it wants to connect.
Oracle Net names resolution is the process of determining this connection information.

Oracle Database 12c: Administration Workshop 5 - 5


Connecting to an Oracle Database
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2015, Oracle and/or its affiliatesฺ

finance.us.flowers.com

a
as
Database server
)h ฺ
o m e
a ilฺc Guid
g m ent
e d@ Stud
o hame this
c l eฺm to us
( o ra se
a b © 2014, c n and/or its affiliates. All rights reserved.
eOracle
z
Copyright l i
e d a able
r
am nsisferepresented
o
An Oracle hdatabasea to a client as a service. A database can have one or more
m - t r
services associated with it. Databases are identified by a service name that is specified by the
non
SERVICE_NAMES parameter in the initialization parameter file. The service name defaults to
the global database name, which is a name that comprises the database name (DB_NAME
parameter value) and the domain name (DB_DOMAIN parameter value).
To connect to a database service, clients use a connect descriptor that provides the location
of the database and the name of the database service. Clients can use the connect descriptor
or a name that resolves to the connect descriptor (as discussed later in this lesson).
The following example shows a connect descriptor that enables clients to connect to a
database service called finance.us.flowers.com.
fi fl

(DESCRIPTION=
(ADDRESS=(PROTOCOL=tcp)(HOST=flowers-server)(PORT=1521))
(CONNECT_DATA=
(SERVICE_NAME=finance.us.flowers.com)))

Oracle Database 12c: Administration Workshop 5 - 6


Name Resolution
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2015, Oracle and/or its affiliatesฺ

CONNECT jsmith/jspass@finflowers

Name resolution

finflowers =(DESCRIPTION=
(ADDRESS=(PROTOCOL=tcp)(HOST=flowers-server)(PORT=1521))
(CONNECT_DATA=
(SERVICE_NAME=finance.us.flowers.com)))
s a
a
)h ฺ
o m e
LISTENER a ilฺc Guid
port 1521 g m ent
finance
e d@ Stud
o hame this
l eฺm to us
flowers-server
c
( o ra se
a b © 2014, c n and/or its affiliates. All rights reserved.
eOracle
z
Copyright l i
e d a able
ham s f er
m o
Users initiate
r a n
a connection request to the Oracle database by sending a connect string. A
t
n- includes a username and password, along with a connect identifier. A connect
connect string
nocan
identifier be the connect descriptor itself or a name that resolves to a connect descriptor.
One of the most common connect identifiers is a net service name, which is a simple name
for a service.
When a net service name is used, connection processing takes place by mapping the net
service name to a connect descriptor. The mapping information can be stored in one or more
repositories of information and is resolved using a naming method.

Oracle Database 12c: Administration Workshop 5 - 7


Establishing a Connection
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2015, Oracle and/or its affiliatesฺ

s a
)h ฺa
Incoming connection
m
request Listener ailฺc
o
u ide
g m ent G
e d@ Stud
o hame this
c l eฺm to us
( o ra se
a b © 2014, c n and/or its affiliates. All rights reserved.
eOracle
z
Copyright l i
e d a able
m sfer
haNet
m o
After Oracle
r a n resolution is complete, a connection request is passed from the user
names
t
on-application
or middle-tier
listenernreceives
(hereafter referred to as the user process) to the listener. The
a CONNECT packet and checks whether that CONNECT packet is requesting a
valid Oracle Net service name.
If the service name is not requested (as in the case of a tnsping request), the listener
acknowledges the connect request and does nothing else. If an invalid service name is
requested, the listener transmits an error code to the user process.

Oracle Database 12c: Administration Workshop 5 - 8


User Sessions
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2015, Oracle and/or its affiliatesฺ

Server
process

User session PGA

s a
a
)h ฺ
U
User process o m e
a ilฺc Guid
g m ent
e d@ Stud
o hame this
c l eฺm to usListener
( o ra se
a b © 2014, c n and/or its affiliates. All rights reserved.
eOracle
z
Copyright l i
e d a able
r
o hampacket
If the CONNECT
a n s f erequests a valid service name, the listener spawns a new process to
m
deal with the t r
-connection. This new process is known as the server process. The listener
connectsnotonthe process and passes the initialization information, including the address
information for the user process. At this point, the listener no longer deals with the connection
and all work is passed to the server process.
The server process checks the user’s authentication credentials (usually a password), and if
the credentials are valid, a user session is created.
Dedicated server process: With the session established, the server process now acts as the
user’s agent on the server. The server process is responsible for:
• Parsing and running any SQL statements issued through the application
• Checking the database buffer cache for data blocks required to perform SQL statements
• Reading necessary data blocks from data files on the disk into the database buffer
cache portion of the System Global Area (SGA), if the blocks are not already present in
the SGA
• Managing all sorting activity. The Sort Area is a memory area that is used to work with
sorting it is contained in a portion of memory
sorting; memor that is associated with
ith the Program Global
Area (PGA).

Oracle Database 12c: Administration Workshop 5 - 9


• Returning results to the user process in such a way that the application can process the
information
• Reading auditing options and reporting user processes to the audit destination
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2015, Oracle and/or its affiliatesฺ

s a
) h a
c o m d e ฺ

ail t Gu i
m
g den
@
ed Stu
m
ha e this
o
c l eฺm to us
( o ra se
z a b licen
e d a able
r
o hamansfe
m -tr
non

Oracle Database 12c: Administration Workshop 5 - 10


Naming Methods

Oracle Net supports several methods of resolving connection


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2015, Oracle and/or its affiliatesฺ

information:
• Easy connect naming: Uses a TCP/IP connect string
• Local naming: Uses a local configuration file
• Directory naming: Uses a centralized
LDAP-compliant directory server
• External naming: Uses a supported non-Oracle naming
service s a
h a )
c o m d e ฺ
il ฺ u i
Client/application server ma t G
Oracle Net @ g den
m ed Stu
o ha e this
Oracle Net configuration files
c l eฺm to us
( o ra se
a b © 2014, c n and/or its affiliates. All rights reserved.
eOracle
z
Copyright l i
e d a able
o hprovides
Oracle Net
fer for the following naming methods:
am nssupport
m -tra
• Easy
an
a
onac
connect naming: The easy connect naming method enables clients to connect to
nOOracle
e Database
atabase server
se e by using us g a TCP/IP
C / connect co ect string st g consisting
co s st g o of a host
ost name
a e
and optional port and service name as follows:
CONNECT username/password@host[:port][/service_name]
The easy connect naming method requires no configuration.
• Local naming: The local naming method stores connect descriptors (identified by their
net service name) in a local configuration file named tnsnames.ora on the client.
• Directoryy naming:g To access a database service,, the directoryy naming g method stores
connect identifiers in a centralized directory server that is compliant with the Lightweight
Directory Access Protocol (LDAP).
• External naming: The external naming method stores net service names in a supported
non-Oracle naming service. Supported third-party services include:
- Network Information Service (NIS) External Naming
- Distributed Computing Environment (DCE) Cell Directory Services (CDS)

Oracle Database 12c: Administration Workshop 5 - 11


Easy Connect

• Is enabled by default
• Requires no client-side configuration
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2015, Oracle and/or its affiliatesฺ

• Supports only TCP/IP (no SSL)


• Offers no support for advanced connection options such
as:
– Connect-time failover
– Source routing
– Load balancing a
a s
SQL> CONNECT hr/hr@db.us.oracle.com:1521/dba11g g )h
c o m deฺ
a il ฺ
G ui
g m ent
e d@ Stud
o hame this
No Oracle Net configuration l ฺm us
efiles
r c
a se to
b o
( en
a a
z le
Copyright licOracle and/or its affiliates. All rights reserved.
© 2014,

m ed rab
o
With Easy
a nsyou
hConnect, fe supply all information that is required for the Oracle Net connection
as part of the
n ra string. Easy Connect connection strings take the following form:
m -tconnect
o
n<username>/<password>@<hostname>:<listener
/ p port>/<service
p / name>
The listener port and service name are optional. If the listener port is not provided, Oracle Net
assumes that the default port of 1521 is being used. If the service name is not provided,
Oracle Net assumes that the database service name and host name provided in the connect
string are identical.
Assuming that the listener uses TCP to listen on port 1521 and the SERVICE_NAMES=db and
DB_DOMAIN=us.oracle.com instance parameters, the connect string shown in the slide
can be shortened:
SQL> connect hr/hr@db.us.oracle.com
Note: The SERVICE_NAMES initialization parameter can accept multiple comma-separated
values. Only one of those values must be db for this scenario to work.

Oracle Database 12c: Administration Workshop 5 - 12


Local Naming

• Requires a client-side names-resolution file


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2015, Oracle and/or its affiliatesฺ

• Supports all Oracle Net protocols


• Supports advanced connection options such as:
– Connect-time
Connect time failover
– Source routing
– Load balancing

s a
a
)h ฺ
SQL> CONNECT hr/hr@orcl h /h l o m e
a ilฺc Guid
g m ent
e d@ Stud
Oracle Net
o h am this
configuration files
l e ฺm use
o r ac se to
b ( en
a a
z le
Copyright licOracle and/or its affiliates. All rights reserved.
© 2014,

m ed rab
o
With local
a nthe
hnaming, s feuser supplies an alias for the Oracle Net service. Oracle Net checks
m -traa local list of known services and, if it finds a match, converts the alias into
the alias against
non port, and service name.
host, protocol,
One advantage of local naming is that the database users need to remember only a short
alias rather than the long connect string required by Easy Connect.
The local list of known services is stored in the following text configuration file:
<oracle_home>/network/admin/tnsnames.ora
This is the default location of the tnsnames.ora file, but the file can be located elsewhere
g the TNS_ADMIN environment variable.
using
Local naming is appropriate for organizations in which Oracle Net service configurations do
not change often.

Oracle Database 12c: Administration Workshop 5 - 13


Directory Naming

• Requires LDAP with Oracle Net names resolution


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2015, Oracle and/or its affiliatesฺ

information loaded:
– Oracle Internet Directory
– Microsoft Active Directory
y Services
• Supports all Oracle Net protocols
• Supports advanced connection options

s a
a
)h ฺ
o m e
LDAP directory
a ilฺc Guid
g m ent
d@ Stud
SQL> CONNECT hr/hr@orcl
e
Oracle Net
o hame this
configuration files
c l eฺm to us
( o ra se
a b © 2014, c n and/or its affiliates. All rights reserved.
eOracle
z
Copyright l i
e d a able
ham s f er
m o
With directory n the user supplies an alias for the Oracle Net service. Oracle Net
naming,
r a
checks then t
- against an external list of known services and, if it finds a match, converts the
alias
nohost, protocol, port, and service name. Like local naming, database users need to
alias into
remember only a short alias.
One advantage of directory naming is that the service name is available for users to connect
with as soon as a new service name is added to the LDAP directory. With local naming, the
database administrator (DBA) must first distribute updated tnsnames.ora files containing
the changed service name information before users can connect to new or modified services.
Directory naming is appropriate for organizations in which Oracle Net service configurations
change
h ffrequently.
tl

Oracle Database 12c: Administration Workshop 5 - 14


External Naming Method

• Uses a supported non-Oracle naming service


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2015, Oracle and/or its affiliatesฺ

• Includes:
– Network Information Service (NIS) External Naming
– Distributed Computing Environment (DCE) Cell Directory
Services (CDS)

Non-Oracle
naming s a
service
a
)h ฺ
o m e
a ilฺc Guid
Oracle Net g m ent
e d@ Stud
o hame this
c l eฺm to us
( o ra se
a b © 2014, c n and/or its affiliates. All rights reserved.
eOracle
z
Copyright l i
e d a able
m sfer
hanaming
m o
The external
r a n method stores Net Service names in a supported non-Oracle naming
n- t
service. Supported third-party services include:
n o
et o Information
• Network o at o Service
Se ce (NIS) ( S) External
te a Naming a g
• Distributed Computing Environment (DCE) Cell Directory Services (CDS)
Conceptually, external naming is similar to directory naming.

Oracle Database 12c: Administration Workshop 5 - 15


Tools for Configuring and Managing
Oracle Net Services
• Enterprise Manager Net Services Administration page
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2015, Oracle and/or its affiliatesฺ

• Oracle Net Manager


• Oracle Net Configuration Assistant
• Listener Control Utility

s a
a
)h ฺ
o m e
a ilฺc Guid
g m ent
e d@ Stud
o hame this
c l eฺm to us
( o ra se
a b © 2014, c n and/or its affiliates. All rights reserved.
eOracle
z
Copyright l i
e d a able
r
Use theo hamantools
following sfeand applications to manage your Oracle Network configuration:
m -tr
n Manager Cloud Control: Provides an integrated environment for
• Enterprise
nogu
configuring
co gaand
d managing
a ag g O Oracle
ac e Net et Se
Services.
ces Use Enterprise te p se Manager
a age to co
configure
gu e
Oracle Net Services for any Oracle home across multiple file systems and to administer
listeners.
• Oracle Net Manager: Provides a graphical user interface (GUI) through which you can
configure Oracle Net Services for an Oracle home on a local client or a server host.
• Oracle Net Configuration Assistant: Launched by Oracle Universal Installer when you
install the Oracle software. During a typical database installation, Oracle Net
C fi
Configuration
ti AAssistant
i t t automatically
t ti ll configures
fi a listener
li t called
ll d LISTENER ththatt h
has a
TCP/IP listening protocol address for the database. If you perform a custom installation,
Oracle Net Configuration Assistant prompts you to configure a listener name and
protocol address of your choice.
• Listener Control Utility: Used to start, stop, and view the status of the listener process

Oracle Database 12c: Administration Workshop 5 - 16


Defining Oracle Net Services Components

Component Description File


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2015, Oracle and/or its affiliatesฺ

Listeners A process that resides on the server whose listener.ora


responsibility is to listen for incoming client
connection requests and manage the traffic
to the server.

Naming A resolution method used by a client


methods application to resolve a connect identifier to
a connect descriptor when attempting to
connect to a database service.
s a
Naming (net A simple name (connect identifier) for a tnsnames.ora a
)h ฺ
service name) service that resolves to a connect (local
o m e
descriptor to identify the network location ilฺc Guid
configuration)
a
and identification of a service.
g m ent
Profiles A collection of parameters thatespecifies d@ Studsqlnet.ora
preferences for enabling haand mconfiguringhis
o e t
Oracle Net features
c l eฺmontotheuclient
s or server.
( o ra se
a b © 2014, c n and/or its affiliates. All rights reserved.
eOracle
z
Copyright l i
e d a able
ham s f er
m o
The following Oracle
r a n Net Services components can be configured by using Enterprise
t
n- Control and Oracle Net Manager:
Manager Cloud
n o
ste e Configuration
• Listener: Co gu at o o of tthee listener
ste e includes
c udes spec specifyingy g tthe e listener
ste e name,
a e, p
protocol
otoco
addresses it is accepting connection requests on, and services (database or non-
database service) it is listening for.
• Naming (net service name)
• Naming methods
• Profiles
The Oracle Net Configuration Assistant configures the listener, naming methods, directory
server usage, and a local tnsnames.ora file during installation of Oracle Database software.

Oracle Database 12c: Administration Workshop 5 - 17


Using Enterprise Manager Cloud Control
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2015, Oracle and/or its affiliatesฺ

s a
a
)h ฺ
o m e
a ilฺc Guid
g m ent
e d@ Stud
o hame this
c l eฺm to us
( o ra se
a b © 2014, c n and/or its affiliates. All rights reserved.
eOracle
z
Copyright l i
e d a able
ham s f er
m o
To administer
r a n
Oracle Net Services in Enterprise Manager Cloud Control, select Net Services
t
n- in the Host menu for your target host.
Administration
n o
The Net Services Administration page enables you to configure Oracle Net Services for any
Oracle home across multiple file systems.
It also provides common administration functions for listeners such as starting and stopping a
listener, and changing its tracing and logging characteristics. You can also look at a listener’s
control status report.
You can also specify the ORACLE_HOME location where the Oracle Net Services configuration
files are stored by selecting “File Location.”

Oracle Database 12c: Administration Workshop 5 - 18


Using Oracle Net Manager
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2015, Oracle and/or its affiliatesฺ

s a
a
)h ฺ
o m e
a ilฺc Guid
g m ent
e d@ Stud
o hame this
c l eฺm to us
( o ra se
a b © 2014, c n and/or its affiliates. All rights reserved.
eOracle
z
Copyright l i
e d a able
m sfer
haNet
m o
Use Oracle
r a n
Manager to configure Oracle Net Services for an Oracle home on a local
t
n- host.
client or server
n o
You can invoke Oracle Net Manager in the following ways:
• On Linux, enter netmgr at the operating system prompt.
• On Microsoft Windows select:
- Programs from the Start menu
- Oracle - HOME_NAME
- Configuration and Migration Tools
- Net
N t Manager
M

Oracle Database 12c: Administration Workshop 5 - 19


Using Oracle Net Configuration Assistant
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2015, Oracle and/or its affiliatesฺ

s a
a
)h ฺ
o m e
a ilฺc Guid
g m ent
e d@ Stud
o hame this
c l eฺm to us
( o ra se
a b © 2014, c n and/or its affiliates. All rights reserved.
eOracle
z
Copyright l i
e d a able
o
Oracle Net
am nsfer Assistant is executed by the Oracle Universal Installer during
hConfiguration
ra Database software. It configures the following basic network
m of-tOracle
installationn
no
components:
• Listener names and protocol addresses
• Naming methods
• Net service names
• Directory server usage: Configures a directory server for directory-enabled features

Oracle Database 12c: Administration Workshop 5 - 20


Using the Listener Control Utility
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2015, Oracle and/or its affiliatesฺ

$ lsnrctl
LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 08-OCT-2014 10:07:23

Copyright (c) 1991, 2014, Oracle. All rights reserved.

Welcome to LSNRCTL, type "help" for information.

LSNRCTL> help
s a
The following operations are available a
)h ฺ
o m e
ilฺc Guid
An asterisk (*) denotes a modifier or extended command:
a
m ent
start stop status g
services
save_config d@ tracetud
version reload
e
m hiset* S
spawn quit exit
h a s
show*
ฺ m o se t
r a cle to u
b (o ense
a za le
Copyright licOracle and/or its affiliates. All rights reserved.
© 2014,

m ed rab
o haControl
The Listener n s fe
Utility enables you to control the listener. With lsnrctl, you can:
m -tra
• Start
n onthe listener
• Stop the listener
• Check the status of the listener
• Reinitialize the listener from the configuration file parameters
• Dynamically configure many listeners
• Change the listener password
The basic command syntax for this utility is:
LSNRCTL> command [listener_name]
When the lsnrctl command is issued, the command acts on the default listener (named
LISTENER) unless a different listener name is specified or the SET CURRENT_LISTENER
command is executed. If the listener name is LISTENER, the listener_name argument can
be omitted. The valid commands for lsnrctl are shown in the slide.
Note: The lsnrctl utility is located in both the Grid Infrastructure home and the Oracle
Database home
home. It is important to set the environment variables to the appropriate home
before using it.

Oracle Database 12c: Administration Workshop 5 - 21


Listener Control Utility Syntax

Commands for the Listener Control Utility can be issued from


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2015, Oracle and/or its affiliatesฺ

the command line or from the lsnrctl prompt.


• Command-line syntax:

$ lsnrctl <command name>


$ lsnrctl start
$ lsnrctl status

s a
• Prompt syntax: a
)h ฺ
o m e
LSNRCTL> <command name>
a ilฺc Guid
LSNRCTL> start g m ent
e d@ Stud
hame this
LSNRCTL> status
o
c l eฺm to us
( o ra se
a b © 2014, c n and/or its affiliates. All rights reserved.
eOracle
z
Copyright l i
e d a able
hamcommands
s f er can be issued from within the utility (prompt syntax) or from the
o
The lsnrctl
m -trThe an following two commands have the same effect but use command-line
command line.
syntax n onprompt syntax, respectively:
and
Command-line syntax:
$ lsnrctl start
Prompt syntax:
$ lsnrctl
LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 08-OCT-2014
10:07:23
Copyright (c) 1991, 2014, Oracle. All rights reserved.
Welcome to LSNRCTL, type "help" for information.
LSNRCTL> start
The command-line syntax is typically used to execute an individual command or scripted
commands. If you plan to execute several consecutive lsnrctl commands, the prompt
syntax is more efficient. Note that the listener_name argument is omitted, and the
command d would
ld th
thus affect
ff t the
th listener
li t named
d LISTENER.

Oracle Database 12c: Administration Workshop 5 - 22


Remember that if your listener is named something other than LISTENER, you must either
include the listener name with the command or use the SET CURRENT_LISTENER command.
Suppose that your listener is named custom_lis. Here are two examples of stopping a
listener named custom_lis by using prompt syntax:
LSNRCTL> stop custom_lis
Connecting to
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2015, Oracle and/or its affiliatesฺ

(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=host01)(PORT=5521)))
The command completed successfully
This produces the same results as the following:
LSNRCTL> set cur custom_lis
Current Listener is custom_lis
LSNRCTL> stop
Connecting to
(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=host01)(PORT=5521)))
The command completed successfully s a
a
)tohcur.
Note: In the preceding syntax,
syntax current_listener
current listener has been abbreviated
m cur ฺ
o e
Using command-line syntax produces the same results: a ilฺc Guid
$ lsnrctl stop custom_lis g m ent
LSNRCTL for Linux: Version 12.1.0.2.0 e d@ S-tuProduction
d on 08-OCT-
2014 10:07:23 m
ha e this
o
Copyright (c) 1991, 2014,
c l eฺm toOracle.
u s All rights reserved.
Connecting to
( o ra se
z a b licen
(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=host01)(PORT=5521)))

d a abcompleted
The command
e le successfully
r
o hamansfe
m -tr
non

Oracle Database 12c: Administration Workshop 5 - 23


Advanced Connection Options

Oracle Net supports the following advanced connection options


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2015, Oracle and/or its affiliatesฺ

with local and directory naming:


• Connect-time failover
• Load balancing
• Source routing

s a
a
)h ฺ
o m e
a ilฺc Guid
g m ent
e d@ Stud
o hame this
c l eฺm to us
( o ra se
a b © 2014, c n and/or its affiliates. All rights reserved.
eOracle
z
Copyright l i
e d a able
r
When ao hamanservice
database sfe is accessible by multiple listener protocol addresses, you can
m order
specify then - tr in which the addresses are to be used. The addresses can be chosen
noor tried sequentially. In cases in which more than one listener is available, such as
randomly
Oracle Real Application Clusters (RAC) configurations, Oracle Net can take advantage of
listener failover and load balancing as well as Oracle Connection Manager source routing.
With connect-time failover enabled, the alias has two or more listener addresses listed. If the
first address is not available, the second is tried. Oracle Net keeps trying addresses in the
listed order until it reaches a listener that is functioning or until all addresses have been tried
and failed. Transparent Application Failover (TAF) is a client-side feature that allows clients to
reconnect to surviving databases in the event of a database instance failure failure. Notifications are
used by the server to trigger TAF callbacks on the client side.
With load balancing enabled, Oracle Net picks an address at random from the list of
addresses. The runtime connection load-balancing feature improves connection performance
by balancing the number of active connections among multiple dispatchers. In a RAC
environment, connection pool load balancing also has the capability to balance the number of
active connections among multiple instances.

Oracle Database 12c: Administration Workshop 5 - 24


Source routing is used with Oracle Connection Manager, which serves as a proxy server for
Oracle Net traffic, enabling Oracle Net traffic to be routed securely through a firewall. Oracle Net
treats the addresses as a list of relays, connecting to the first address and then requesting to be
passed from the first to the second until the destination is reached. It differs from failover or load
balancing in that all addresses are used each time a connection is made.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2015, Oracle and/or its affiliatesฺ

s a
) h a
c o m d e ฺ

ail t Gu i
m
g den
@
ed Stu
m
ha e this
o
c l eฺm to us
( o ra se
z a b licen
e d a able
r
o hamansfe
m -tr
non

Oracle Database 12c: Administration Workshop 5 - 25


Testing Oracle Net Connectivity

The tnsping utility that tests Oracle Net service aliases:


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2015, Oracle and/or its affiliatesฺ

• Ensures connectivity between the client and the Oracle


Net Listener
• Does not verify that the requested service is available
• Supports Easy Connect Names Resolution:
tnsping host01.example.com:1521/orcl

• Supports local and directory naming: s a


a
)h ฺ
tnsping orcl
o m e
a ilฺc Guid
g m ent
e d@ Stud
o hame this
c l eฺm to us
( o ra se
a b © 2014, c n and/or its affiliates. All rights reserved.
eOracle
z
Copyright l i
e d a able
m sfer
hisathe
tnsping
m o r a n Net equivalent of the TCP/IP ping utility. It offers a quick test to verify
Oracle
t
- path to a destination is good. For example, enter tnsping orcl in a
that the network
non window.
command-line
The utility validates that the host name, port, and protocol reach a listener. It does not actually
check whether the listener handles the service name. The tnsping utility also reveals the
location of the configuration files. In a system with multiple ORACLE_HOME locations, this can
be helpful.

Oracle Database 12c: Administration Workshop 5 - 26


Comparing Dedicated Server and
Shared Server Configurations
• Dedicated server configuration: One server process for
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2015, Oracle and/or its affiliatesฺ

each client
• Shared server configuration: A small pool of server
processes can serve a large
p g number of clients

s a
a
)h ฺ
o m e
a ilฺc Guid
g m ent
e d@ Stud
o hame this
c l eฺm to us
( o ra se
a b © 2014, c n and/or its affiliates. All rights reserved.
eOracle
z
Copyright l i
e d a able
hamserver s f er
m o
In a dedicated
r a n configuration a server process handles requests for a single client
process. An t
- server configuration enables multiple client processes to share a small
shared
numbernofo server processes. Detailed information on each configuration follows in this lesson.

Oracle Database 12c: Administration Workshop 5 - 27


User Sessions: Dedicated Server Process

User sessions
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2015, Oracle and/or its affiliatesฺ

Server process

Server process

s a
a
)h ฺ
m
a i lฺco Guide
Server process m
g e n t
e d@ Stud
o hame this
c l eฺm to us Listener
r a
b (o ense
a za le
Copyright licOracle and/or its affiliates. All rights reserved.
© 2014,

m ed rab
o ha server
With dedicated n s feprocesses, there is a one-to-one ratio of server processes to user
m -traserver process uses system resources, including CPU cycles and memory.
processes.nEach
no loaded system, the memory and CPU resources that are used by dedicated
In a heavily
server processes can be prohibitive and can negatively affect the system’s scalability. If your
system is being negatively affected by the resource demands of the dedicated server
architecture, you have the following options:
• Increasing system resources by adding more memory and additional CPU capability
• Using the Oracle Shared Server Process architecture

Oracle Database 12c: Administration Workshop 5 - 28


User Sessions: Shared Server Processes

Server process
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2015, Oracle and/or its affiliatesฺ

Server process
Server process

s a
a
)h ฺ
o m e
User sessions Dispatchers a ilฺc Guid
g m ent
e d@ Stud
o h am this
Listener
l e ฺm use
o r ac se to
b ( en
a a
z le
Copyright licOracle and/or its affiliates. All rights reserved.
© 2014,

m ed rab
o
Each service sfe
hathatanparticipates in the shared server process architecture has at least one
m
dispatcher n - t r
process (and usually more). When a connection request arrives, the listener does
no a dedicated server process. Instead, the listener maintains a list of dispatchers that
not spawn
are available for each service name, along with the connection load (number of concurrent
connections) for each dispatcher.
Connection requests are routed to the lightest loaded dispatcher that is servicing a given
service name. Users remain connected to the same dispatcher for the duration of a session.
Unlike dedicated server processes, a single dispatcher can manage hundreds of user
sessions.
Dispatchers do not actually handle the work of user requests. Instead, they pass user
requests to a common queue located in the shared pool portion of the SGA.
Shared server processes take over most of the work of dedicated server processes, pulling
requests from the queue and processing them until they are complete.
Because a user session may have requests processed by multiple shared server processes,
most of the memory structures that are usually stored in the PGA must be in a shared
memor location (b
memory (by defa
default,
lt in the shared pool)
pool). Ho
However,
e er if the large pool is config
configured
red or if
SGA_TARGET is set for automatic memory management, these memory structures are stored
in the large pool portion of the SGA.

Oracle Database 12c: Administration Workshop 5 - 29


SGA and PGA Usage

Oracle Shared Server: User session data is held


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2015, Oracle and/or its affiliatesฺ

in the SGA.
System Global Area (SGA)
PGA
Cursor Sort Hash
Area Area
State Stack
Create Bitmap Area space
User Session
Data Bitmap Merge Area
s a
)h ฺ a
UGA m
o e
a ilฺc Guid
Remember to consider shared server memory g e t
m requirements
n
when sizing the SGA. e d@ Stud
o hame this
c l eฺm to us
( o ra se
a b © 2014, c n and/or its affiliates. All rights reserved.
eOracle
z
Copyright l i
e d a able
ham s f er
o
m -tr n
The contents of a
the SGA and PGA differ when dedicated servers or shared servers are used:
• Text
n n parsed forms of all SQL statements are stored in the SGA.
oand
• The cursor state contains runtime memory values for the SQL statement statement, such as rows
retrieved.
• User-session data includes security and resource usage information.
• The stack space contains local variables for the process.
Technical Note
The change in the SGA and PGA is transparent to the user; however, if you are supporting
multiple users,
users you need to increase the LARGE_POOL_SIZE
LARGE POOL SIZE initialization parameter.
parameter Each
shared server process must access the data spaces of all sessions so that any server can
handle requests from any session. Space is allocated in the SGA for each session’s data
space. You limit the amount of space that a session can allocate by setting the PRIVATE_SGA
resource.

Oracle Database 12c: Administration Workshop 5 - 30


Shared Server Configuration Considerations

Certain types of database work must not be performed using


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2015, Oracle and/or its affiliatesฺ

shared servers:
• Database administration
• Backup and recovery operations
• Batch processing and bulk load operations
• Data warehouse operations

s a
a
)h ฺ
o m e
a ilฺc Guid
g m ent
e d@ Stud
Dispatcher
o hameDedicated t his server
c l eฺm to us process

( o ra se
a b © 2014, c n and/or its affiliates. All rights reserved.
eOracle
z
Copyright l i
e d a able
m sfer
haShared
m o
The Oracle
r a nServer architecture is an efficient process and memory use model, but it is
t
- for all connections. Because of the common request queue and the fact that
not appropriate
nonmay share a dispatcher response queue, shared servers do not perform well with
many users
operations that must deal with large sets of data, such as warehouse queries or batch
processing.
Backup and recovery sessions that use Oracle Recovery Manager (discussed in later
lessons) also deal with very large data sets and must use dedicated connections.
Many administration tasks must not (and cannot) be performed by using shared server
connections. These include starting up and shutting down the instance, creating tablespaces
and
dddata
t fil
files, maintaining
i t i i iindexes
d and
d ttables,
bl analyzing
l i statistics,
t ti ti and
d many other
th ttasks
k th
thatt
are commonly performed by the DBA. All DBA sessions must choose dedicated servers.

Oracle Database 12c: Administration Workshop 5 - 31


Configuring Communication
Between Databases
• Sending data or messages between sites requires network
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2015, Oracle and/or its affiliatesฺ

configuration on both sites.


• You must configure the following:
– Network connectivity (for example, tnsnames.ora)
– Database links

CREATE DATABASE LINK <remote_global_name> a


CONNECT TO <user> IDENTIFIED BY <pwd>
) has
USING '<connect_string_for_remote_db>';
i f db om d eฺ
u i a ilฺc G
g m ent
e d@ Stud
o hame this
c l eฺm to us
( o ra se
a b © 2014, c n and/or its affiliates. All rights reserved.
eOracle
z
Copyright l i
e d a able
m sfer
halink
m o
A database
r isn
a a schema object in one database that enables you to access objects on
t
- The other database need not be an Oracle database system. However, to
another database.
non
access non-Oracle systems, you must use Oracle Heterogeneous Services.
To create a private database link, you must have the CREATE DATABASE LINK system
privilege. To create a public database link, you must have the CREATE PUBLIC DATABASE
LINK system privilege.
When an application uses a database link to access a remote database, Oracle Database
establishes a database session in the remote database on behalf of the local request. The
CONNECT TO clause that is used in creating a database link determines how the connection
i established
is t bli h d on th
the remote
t ddatabase.
t b Y
You can create
t fifixed
d user, currentt user, and
d
connected user database links. Current user links are available only through the Oracle
Advanced Security option. The example in the slide shows the syntax to create a fixed user
database link.
After you create a database link, you can use it to refer to tables and views on the other
database. In SQL statements, you can refer to a table or view on the other database by
appending @dblink to the table or view name. You can query a table or view on the other
database or use any INSERT, UPDATE, DELETE, or LOCK TABLE statement for the table.

Oracle Database 12c: Administration Workshop 5 - 32


Connecting to Another Database
REMOTE_ORCL = tnsnames.ora
(DESCRIPTION =
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2015, Oracle and/or its affiliatesฺ

(ADDRESS = (PROTOCOL = TCP)


(HOST = host02.example.com)
(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl2.example.com)
)
)
s a
CONNECT hr/hr@orcl1; SQL*Plus a
)h ฺ
o m e
CREATE DATABASE LINK remote a ilฺc Guid
CONNECT TO HR IDENTIFIED BY HR @gm ent
USING 'REMOTE_ORCL'; e d Stud
o hame this
SELECT * FROM employees@remote c l eฺm to us
( o ra se
a b © 2014, c n and/or its affiliates. All rights reserved.
eOracle
z
Copyright l i
e d a able
am the
hshows s f er
m o
The slide
r a n tnsnames.ora entry that is needed before creating a database link.
The example t
-shows a fixed user database link called REMOTE that is connecting to the user
nonthe connect string REMOTE_ORCL. After you create a database link, you can use
HR by using
it to refer to tables and views on the other database.
The description of the view is as follows:
SQL> DESC DBA_DB_LINKS
Name Null? Type
-------------------- -------- ----------------------------
OWNER NOT NULL VARCHAR2(30)
DB_LINK NOT NULL VARCHAR2(128)
USERNAME VARCHAR2(30)
HOST VARCHAR2(2000)
CREATED NOT NULL DATE

SQL> select owner, db_link, username from dba_db_links;


OWNER DB_LINK USERNAME
----------- ------------------- ---------
HR REMOTE.EXAMPLE.COM HR

Oracle Database 12c: Administration Workshop 5 - 33


Quiz

Which configuration files are used to configure the listener?


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2015, Oracle and/or its affiliatesฺ

a. listener.ora
b. listener.conf
c tnsnames.ora
c. tnsnames ora
d. tnsnames.conf
e. sqlnet.ora
f. sqlnet.conf
s a
) h a
c o m d e ฺ

ail t Gu i
m
g den
ed Stu@
m
ha e this
o
c l eฺm to us
( o ra se
a b © 2014, c n and/or its affiliates. All rights reserved.
eOracle
z
Copyright l i
e d a able
o h am nsfer
Answer:
m a, e-tra
non

Oracle Database 12c: Administration Workshop 5 - 34


Quiz

When using the shared server process architecture, the UGA


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2015, Oracle and/or its affiliatesฺ

portion of the PGA is relocated into the SGA.


a. True
b False
b.

s a
) h a
c o m d e ฺ

ail t Gu i
m
g den
ed Stu@
m
ha e this
o
c l eฺm to us
( o ra se
a b © 2014, c n and/or its affiliates. All rights reserved.
eOracle
z
Copyright l i
e d a able
o h am nsfer
Answer:
m a -tra
non

Oracle Database 12c: Administration Workshop 5 - 35


Summary

In this lesson, you should have learned how to:


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2015, Oracle and/or its affiliatesฺ

• Use Enterprise Manager to:


– Create additional listeners
– Create Oracle Net Service aliases
– Control the Oracle Net Listener
• Use tnsping to test Oracle Net connectivity
• Identify when to use shared servers and when to use
a
dedicated servers has )
c o m d e ฺ

ail t Gu i
m
g den
ed Stu@
m
ha e this
o
c l eฺm to us
( o ra se
a b © 2014, c n and/or its affiliates. All rights reserved.
eOracle
z
Copyright l i
e d a able
r
o hamansfe
m -tr
non

Oracle Database 12c: Administration Workshop 5 - 36


Practice: Overview

This practice covers the following topics:


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2015, Oracle and/or its affiliatesฺ

• Configuring local names resolution to connect to another


database
• Creating a second listener

s a
) h a
c o m d e ฺ

ail t Gu i
m
g den
ed Stu@
m
ha e this
o
c l eฺm to us
( o ra se
a b © 2014, c n and/or its affiliates. All rights reserved.
eOracle
z
Copyright l i
e d a able
r
o hamansfe
m -tr
non

Oracle Database 12c: Administration Workshop 5 - 37


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2015, Oracle and/or its affiliatesฺ

o
non
m -tr
e
hamansfe
z
r
a
(
d a able
o
c l
b licen
ra se
o
eฺm to us
m
@
ha e this
m
ed Stu
ฺ c
g den
o m )
ail t Gu i
h
d
a s
e ฺ
a

Das könnte Ihnen auch gefallen