+ All Categories
Home > Documents > ORACLE NETWORKING: CONFIGURING BASIC NET8/SQL*NET …One of the important components of Oracle...

ORACLE NETWORKING: CONFIGURING BASIC NET8/SQL*NET …One of the important components of Oracle...

Date post: 25-Jun-2020
Category:
Upload: others
View: 7 times
Download: 0 times
Share this document with a friend
26
57 CHAPTER OBJECTIVES In this chapter, you will learn about: Setting Up Networking Configuration Files Page 58 Managing the Oracle Listener Page 67 Configuring the Multi-Threaded Server Page 76 CHAPTER 3 ORACLE NETWORKING: CONFIGURING BASIC NET8/SQL*NET COMPONENTS N ow that your database is running, the next step involves setting up the basic Oracle networking components. This additional step makes the database available to userssuch as those you will create in Chapter 10, “Privileges and Resource Groups” over a network. The topic of Oracle networking involves many different components and many different implementations. This chapter focuses on basic networking components, including the dedicated server configuration and multi-threaded server configuration using the TCP/IP protocol. ch03.qxd 10/30/2000 2:49 PM Page 57
Transcript
Page 1: ORACLE NETWORKING: CONFIGURING BASIC NET8/SQL*NET …One of the important components of Oracle networking is the Oracle listener. The listener is the process responsible for receiving

57

CHAPTER OBJECTIVES

In this chapter, you will learn about:

✔ Setting Up Networking Configuration Files Page 58✔ Managing the Oracle Listener Page 67✔ Configuring the Multi-Threaded Server Page 76

C H A P T E R 3

ORACLE NETWORKING:CONFIGURING BASIC

NET8/SQL*NET COMPONENTS

Now that your database is running, the next step involves setting up the basicOracle networking components. This additional step makes the database

available to users—such as those you will create in Chapter 10, “Privileges andResource Groups” over a network. The topic of Oracle networking involves manydifferent components and many different implementations. This chapter focuseson basic networking components, including the dedicated server configurationand multi-threaded server configuration using the TCP/IP protocol.

ch03.qxd 10/30/2000 2:49 PM Page 57

Page 2: ORACLE NETWORKING: CONFIGURING BASIC NET8/SQL*NET …One of the important components of Oracle networking is the Oracle listener. The listener is the process responsible for receiving

58 Chapter 3: Oracle Networking: Configuring Basic Net8/SQL*Net

LAB3.1

L A B 3 . 1

SETTING UP NETWORKCONFIGURATION FILES

LAB OBJECTIVES

In this lab, you will:

✔ Manually Configure the tnsnames.ora File✔ Manually Configure the listener.ora File

LAB 3.1 EXERCISES

3.1.1 MANUALLY CONFIGURE

THE TNSNAMES.ORA FILE

Chapter 3 is concerned with setting up basic Oracle networkingconfiguration. It is included at the beginning of the Oracle DBAInteractive Workbook to emulate the flow of tasks involved in thepreparation of a new database.This chapter is different from theothers in the book in that it is not required to be completed beforestarting work in subsequent chapters.There are many general net-working issues that fall outside the scope of this book, but canaffect the way that SQL*Net/Net8 work. Because of this, you maywish to complete Chapter 3 after you have completed the otherchapters in this book.

ch03.qxd 10/30/2000 2:49 PM Page 58

Page 3: ORACLE NETWORKING: CONFIGURING BASIC NET8/SQL*NET …One of the important components of Oracle networking is the Oracle listener. The listener is the process responsible for receiving

The steps involved in making an Oracle database available through a network arerelatively simple. Database communication is made possible by Net8 (a set of net-working components). These components can support connections from thesame machine that the database is on, or from remote machines.

LAB3.1

Lab 3.1: Setting Up Network Configuration Files 59

You Say Potato, I Say Net8

Prior to Oracle8.x, there was a set of networking components calledSQL*Net. SQL*Net is not available with Oracle8.x and Net8 is notavailable with Oracle7.x. So, although these two sets should be con-sidered separate entities, they perform the same base level functional-ity for the different Oracle Server versions and will both be referred toas Net8 in this book.

One of the important components of Oracle networking is the Oracle listener.The listener is the process responsible for receiving database connection requestsand redirecting them to another process, which in turn becomes the main pointof contact between the client and the database. The process that ultimately ser-vices user requests is called a server process. It is the responsibility of the serverprocess to perform such tasks as reading data from disk into the Database BufferCache and sorting query results.

There are two possible configurations for the server process. In the dedicated serverconfiguration, one server process is started for each client connection to the data-base. This server process is then dedicated to serving only that connection’srequest. In the multi-threaded server configuration, shared servers perform most ofthe same tasks as the dedicated server. The main difference is that, where a dedi-cated server only supports one client, a shared server supports one or moreclients. The ability to support multiple client connections can be useful if thenumber of requests made by each client connection is low. Therefore, a dedicatedserver configuration would be useful for operations such as a batch load of datainto the database, whereas a multi-threaded server configuration would be moreappropriate for supporting many clients, each of which periodically performstransactions on the database that affect small amounts of data.

The information needed to establish database connections is stored in severalconfiguration files. The following two configuration files will be discussed in thischapter:

• tnsnames.ora

• listener.ora

ch03.qxd 10/30/2000 2:49 PM Page 59

Page 4: ORACLE NETWORKING: CONFIGURING BASIC NET8/SQL*NET …One of the important components of Oracle networking is the Oracle listener. The listener is the process responsible for receiving

Note that there are several other configuration files that are used, depending onyour Oracle networking needs. For example, the sqlnet.ora file is used for config-uring logging and tracing for database connection problems, and setting OracleAdvanced Security parameters, among others. For the simple network configura-tion in theses exercises, you will work with only the tnsnames.ora and listener.oraconfiguration files.

These files can be found in a location known as the TNS_ADMIN directory. Thelocation of this directory depends on the version of the Oracle Server that isinstalled. For versions 7.x and 8.1.x, the TNS_ADMIN directory is usually at ORACLE_HOME\network\admin; for version 8.0.x, it is usually at ORACLE_HOME\net80\admin. Occasionally, you will find an installation that uses anenvironment variable named TNS_ADMIN to point to the location of the networkconfiguration files. If a TNS_ADMIN environment variable is used, the DBA mustmake sure that the configuration files are moved to the new TNS_ADMINlocation.

a) What is the location of your TNS_ADMIN directory?

The listener.ora file simply contains configuration information for the Oracle lis-tener. The tnsnames.ora file is used in defining TNS service names. “TNS,” whichstands for Transparent Network Substrate, serves as a single, common interface tomost industry-standard networking protocols. TNS service names are resolved inthe tnsnames.ora file, which contains information on where to locate particulardatabases. For example, you might define a TNS service name called DEV. Intnsnames.ora, the configuration information for DEV may indicate that the lis-tener for this database is located at Port 1521 on IP address 111.222.333.444 (orthe name of the machine at that address) and listens for connection requests to adatabase called “dev”. Note that in these exercises, the tnsnames.ora file is con-figured on the database server. For many client or front-end environments, thereis usually a tnsnames.ora file to support connections to the database. Oracle isslowly moving away from using these files that support TNS service names, andmoving towards the use of the Oracle Names Server. For more information on theOracle Names Server, see the Oracle document “Net8 Administrator’s Guide.”

In these exercises, you will set up two TNS service names. The first will allow youto connect to your own database through Net8. The second is optional, and willallow you to connect to a second, remote database.

LAB3.1

60 Chapter 3: Oracle Networking: Configuring Basic Net8/SQL*Net

ch03.qxd 10/30/2000 2:49 PM Page 60

Page 5: ORACLE NETWORKING: CONFIGURING BASIC NET8/SQL*NET …One of the important components of Oracle networking is the Oracle listener. The listener is the process responsible for receiving

A template for two TNS service name definitions is shown below:

##################################### FILENAME: tnsnames.ora # # LAST MODIFIED: March 24, 2000 #####################################example00 =

(DESCRIPTION =(ADDRESS_LIST =

(ADDRESS =(PROTOCOL = TCP)(HOST = development)(PORT = 1521)

))(CONNECT_DATA =

(SID = db00))

)example01 =

(DESCRIPTION =(ADDRESS_LIST =

(ADDRESS =(PROTOCOL = TCP)(HOST = production)(PORT = 1521)

))(CONNECT_DATA =

(SID = db01))

)

If you have access to a database other than your own, you can configure connec-tivity to it by performing the following steps on the “example01” TNS servicename in the above template:

• If there is an existing tnsnames.ora file in your TNS_ADMINdirectory, back it up. (If you have problems with thetnsnames.ora file after making the edits in this chapter, you canrestore the original from the backup.) In keeping with the back-up file naming standard used in this book, you should name ittnsnames.ora.01.

• If you do not already have a file called tnsnames.ora in yourTNS_ADMIN directory, then create a new one with a text editor.Create it as shown in the above template. If you already have atnsnames.ora file, then append it with the text from the templateabove.

LAB3.1

Lab 3.1: Setting Up Network Configuration Files 61

ch03.qxd 10/30/2000 2:49 PM Page 61

Page 6: ORACLE NETWORKING: CONFIGURING BASIC NET8/SQL*NET …One of the important components of Oracle networking is the Oracle listener. The listener is the process responsible for receiving

• Change “example01” to “<SID>”, where <SID> is the SID of theInstance on the remote machine. Note that, since this is a logicalname, you can call it anything that you want; it does not have tobe the same as the name of the database (however, for purposesof simplification, it is often the same as the database name). Youcould, for example, leave the name as “example01” and still useit to locate a database called “db01”.

• Change “Host = Production” to “Host = <name of the machine ornetwork name for the machine where the database is located>”. Youcan either use the name or the IP address. It is recommendedthat you use the name if you know what it is.

• Change “Port = 1521” to “Port = <the port number of the listener>”.Note that 1521 is the default port for an Oracle listener andshould not be changed unless another service is already using thatport or you are instructed to do so in the Oracle documentation.

• Change “db01” to “<SID>”. This is the name of the Instance thatyou will be connecting to.

• Save the file and close your text editor.

Once you have entered configuration information for this optional TNS servicename into tnsnames.ora, you can open SQL*Plus and attempt to connect to thedatabase it represents using the following syntax:

CONNECT <username>/<password>@<TNSservicename>

In the next exercise, you will configure and start the Oracle listener for your owndatabase. You will configure a TNS service name for the database that you createdin Chapter 2.

b) Using the steps outlined above for configuring the “example01”TNS service name, configure the “example00” TNS servicename to locate the database you created in Chapter 2. Showthe final version of the tnsnames.ora file.

3.1.2 MANUALLY CONFIGURE

THE LISTENER.ORA FILE

In these exercises, you will configure the listener for your own database. Thelistener.ora file, which is the configuration file for the listener, is kept in theTNS_ADMIN directory. It contains information such as the name of the listener,

LAB3.1

62 Chapter 3: Oracle Networking: Configuring Basic Net8/SQL*Net

ch03.qxd 10/30/2000 2:49 PM Page 62

Page 7: ORACLE NETWORKING: CONFIGURING BASIC NET8/SQL*NET …One of the important components of Oracle networking is the Oracle listener. The listener is the process responsible for receiving

the name of the databases for which it accepts connection requests, and the loca-tion of log files produced by the listener.

• Locate your listener.ora file and make a backup copy of it.

• Delete the original copy of the listener.ora file, then create a newone and open it for editing.

• Add the following template information to the new file:

####################################

# FILENAME: listener.ora #

# LAST MODIFIED: March 24, 2000 #

####################################

LISTENER =

(ADDRESS =

(PROTOCOL = TCP)

(HOST = production)

(PORT = 1521)

)

)

STARTUP_WAIT_TIME_LISTENER = 0

CONNECT_TIMEOUT_LISTENER = 10

LOG_DIRECTORY_LISTENER = e:\Oracle\Ora81\network\log

LOG_FILE_LISTENER = listener

SID_LIST_LISTENER =

(SID_LIST =

(SID_DESC =

(SID_NAME = db00)

(ORACLE_HOME = e:\Oracle\Ora81)

)

)

• Now review and edit this template where applicable:

• The “LISTENER =” states the name of your listener. This isalso known as the listener alias.

LAB3.1

Lab 3.1: Setting Up Network Configuration Files 63

ch03.qxd 10/30/2000 2:49 PM Page 63

Page 8: ORACLE NETWORKING: CONFIGURING BASIC NET8/SQL*NET …One of the important components of Oracle networking is the Oracle listener. The listener is the process responsible for receiving

• Replace all occurrences of “db00” with the name of yourInstance (SID)

• Change “HOST = production” to “HOST = <network name ormachine name where the listener is running>”

• Change “ORACLE_HOME = e:\Oracle\Ora81” to“ORACLE_HOME = <your ORACLE_HOME directory>”

• Change “LOG_DIRECTORY_LISTENER =e:\Oracle\Ora81\network\log” to “LOG_DIRECTORY_LIS-TENER = <your ORACLE_HOME location>\network\log” (or“LOG_DIRECTORY_LISTENER = <your ORACLE_HOME loca-tion>\net80\log” if you are running Oracle8.0.x).

• Save the listener.ora file and close the text editor.

LAB 3.1 EXERCISE ANSWERS

3.1.1 ANSWERS

a) What is the location of your TNS_ADMIN directory?

Answer:Your TNS_ADMIN directory will usually be located in eitherORACLE_HOME\network\admin or ORACLE_HOME\net80\admin. It’s a good idea tocheck your environment for a TNS_ADMIN variable. In UNIX with the korn shell, youcan use following command: echo $TNS_ADMIN. It is rare to find the variable setfor an NT environment, but if it is set, you will find it in the Windows NT Registrywithin the HKEY_LOCAL_MACHINE-> SOFTWARE->ORACLE node.

b) Using the steps outlined above for configuring the “example01” TNS servicename, configure the “example00” TNS service name to locate the database youcreated in Chapter 2. Show the final version of the tnsnames.ora file.

Answer:The final version of your tnsnames.ora file will look similar to the following:

LAB3.1

64 Chapter 3: Oracle Networking: Configuring Basic Net8/SQL*Net

ch03.qxd 10/30/2000 2:49 PM Page 64

Page 9: ORACLE NETWORKING: CONFIGURING BASIC NET8/SQL*NET …One of the important components of Oracle networking is the Oracle listener. The listener is the process responsible for receiving

####################################

# FILENAME: tnsnames.ora #

# LAST MODIFIED: March 24, 2000 #

####################################

db00 =

(DESCRIPTION =

(ADDRESS_LIST =

(ADDRESS =

(PROTOCOL = TCP)

(HOST = production)

(PORT = 1521)

)

)

(CONNECT_DATA =

(SID = db00)

)

)

dev =

(DESCRIPTION =

(ADDRESS_LIST =

(ADDRESS =

(PROTOCOL = TCP)

(HOST = development)

(PORT = 1521)

)

)

(CONNECT_DATA =

(SID = dev)

)

)

LAB3.1

Lab 3.1: Setting Up Network Configuration Files 65

ch03.qxd 10/30/2000 2:49 PM Page 65

Page 10: ORACLE NETWORKING: CONFIGURING BASIC NET8/SQL*NET …One of the important components of Oracle networking is the Oracle listener. The listener is the process responsible for receiving

LAB 3.1 SELF-REVIEW QUESTIONS

To test your progress, you should be able to answer the following questions.

1) Net8 is an application development environment similar to Oracle Forms orOracle JDeveloper.

a) _____ Trueb) _____ False

2) Which of the following is the responsibility of the listener?

a) _____ It manages the datafilesb) _____ It provides TNS service name resolution informationc) _____ It waits for and manages database connection requestsd) _____ It reads data from the Database files and puts the information in

memory

3) What is the tnsnames.ora file used for?

a) _____ It manages the datafilesb) _____ It provides TNS service name resolution informationc) _____ It waits for and manages database connection requestsa) _____ It reads data from the Database files and puts the information in memory

4) The tnsnames.ora file is the Instance configuration file read by the OracleInstance upon startup to help it decide, for example, how much memory toallocate to the Shared Pool.

a) _____ Trueb) _____ False

5) Which of the following are some of the responsibilities of dedicated serverprocesses? (check all that apply)

a) _____ Reading data stored on disk into the Database Buffer Cacheb) _____ Routing connection requests to the database c) _____ Sorting query resultsd) _____ Resolving TNS service names

6) The TNS_ADMIN location is where configuration files for Net8 componentsare typically held.

a) _____ Trueb) _____ False

Quiz answers appear in Appendix A, Lab 3.1.

LAB3.1

66 Chapter 3: Oracle Networking: Configuring Basic Net8/SQL*Net

ch03.qxd 10/30/2000 2:49 PM Page 66

Page 11: ORACLE NETWORKING: CONFIGURING BASIC NET8/SQL*NET …One of the important components of Oracle networking is the Oracle listener. The listener is the process responsible for receiving

L A B 3 . 2

MANAGING THE ORACLELISTENER

LAB 3.2 EXERCISES

Now that you have created or edited the listener.ora file, you are ready to start thelistener. Administrative communication to the listener is accomplished via a util-ity called “Listener Control.” In UNIX, this utility is called from the commandline by the name lsnrctl. For Oracle8.0.x on Windows NT, the command islsnrctl80; if you are running this type of environment, substitute lsnrctl80wherever lsnrctl appears in the exercises below.

To indicate to Listener Control what you want to do, provide an argument to thelsnrctl command. At the command line in your operating system (in NT this willbe in an MS-DOS window), issue the following command:

lsnrctl help

You will receive a response similar to the following:

C:\>lsnrctl help

LSNRCTL for 32-bit Windows: Version 8.1.6.0.0 - Production on24-MAR-00 17:42:28

LAB OBJECTIVES

After this lab, you will be able to:

✔ Start and Stop the Listener✔ Issue Other Listener Commands✔ Perform a Loopback Test

LAB3.2

Lab 3.2: Managing the Oracle Listener 67

ch03.qxd 10/30/2000 2:49 PM Page 67

Page 12: ORACLE NETWORKING: CONFIGURING BASIC NET8/SQL*NET …One of the important components of Oracle networking is the Oracle listener. The listener is the process responsible for receiving

(c) Copyright 1998 Oracle Corporation. All rights reserved.

The following operations are availableAn asterisk (*) denotes a modifier or extended command:

start stop statusservices version reloadsave_config trace dbsnmp_startdbsnmp_stop dbsnmp_status change_passworddebug test quitexit set* show*

“lsnrctl help” produces a list of all arguments that can be used with the ListenerControl utility. The exercises throughout the remainder of this chapter will referback to this list of arguments.

3.2.1 START AND STOP THE LISTENER

For remote users to be able to connect to your database, the listener for your data-base needs to be running. The listener listens on a specific port—by default, Port1521—for database connection requests. When it receives a request, it either redi-rects it to a dispatcher process or to a new dedicated server process. Note that it ispossible to have a free dedicated server process waiting for a new request. You maywish to read more about these “pre-spawned dedicated server processes” in theOracle documentation.

Start the listener by issuing the following command at the operating system com-mand line:

lsnrctl start

Status information similar to the following should appear on the screen:

C:\>lsnrctl start

LSNRCTL for 32-bit Windows: Version 8.1.6.0.0 - Production on24-JUN-2000 12:04:39

(c) Copyright 1998, 1999, Oracle Corporation. All rightsreserved.

Starting tnslsnr: please wait...

TNSLSNR for 32-bit Windows: Version 8.1.6.0.0 - Production

System parameter file is C:\ORACLE\ORA81\network\admin\listener.ora

LAB3.2

68 Chapter 3: Oracle Networking: Configuring Basic Net8/SQL*Net

ch03.qxd 10/30/2000 2:49 PM Page 68

Page 13: ORACLE NETWORKING: CONFIGURING BASIC NET8/SQL*NET …One of the important components of Oracle networking is the Oracle listener. The listener is the process responsible for receiving

Log messages written toC:\ORACLE\ORA81\network\log\listener.log

Listening on:(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=rocky)(PORT=1521)))

Connecting to (ADDRESS=(PROTOCOL=TCP)(HOST=rocky)(PORT=1521))STATUS of the LISTENER---------------------------Alias LISTENERVersion TNSLSNR for 32-bit Windows:Version 8.1.6.0.0 - ProductionStart Date 24-JUN-2000 12:04:44Uptime 0 days 0 hr. 0 min. 2 secTrace Level offSecurity OFFSNMP OFFListener Parameter File E:\ORACLE\ORA81\network\admin\listener.oraListener Log File E:\ORACLE\ORA81\network\log\listener.logServices Summary...

db00 has 1 service handler(s)The command completed successfully

You should see the phrase “The command completed successfully” as one of thelast lines. If you do not, make sure you’ve edited the listener.ora file correctly andhave entered the lsnrctl command correctly. Don’t go on to the other exercises inthis chapter until this is working properly.

a) Based on the information in your listener.ora file, find the loca-tion of your listener log file.

To stop the listener, issue the following command:

lsnrctl stop

b) What is the response you get after issuing this command? Didyour listener stop properly? How can you tell?

LAB3.2

Lab 3.2: Managing the Oracle Listener 69

ch03.qxd 10/30/2000 2:49 PM Page 69

Page 14: ORACLE NETWORKING: CONFIGURING BASIC NET8/SQL*NET …One of the important components of Oracle networking is the Oracle listener. The listener is the process responsible for receiving

3.2.2 ISSUE OTHER LISTENER COMMANDS

As you saw when you issued the command “lsnrctl help,” there are many otherarguments that can be used with lsnrctl. You will try some of these in the follow-ing exercises.

First, verify that the listener is running. To check this, issue the following com-mand:

lsnrctl status

If you received a response similar to “The command completed successfully”,then the listener is running properly. Otherwise, you should start the listenernow.

Next, consider the “show” argument. This argument displays additional informa-tion about the configuration of the listener; it requires a parameter to specifywhich element of the configuration you want to see. For example, to see infor-mation about the log status (which shows whether the listener will log informa-tion about its activities to the listener log file), you issue the command: lsnrctlshow log_status. To view the list of all the lsnrctl show parameters, issuethe following command:

lsnrctl show

You should receive a response similar to the following:

C:\>lsnrctl show

LSNRCTL for 32-bit Windows: Version 8.1.6.0.0 - Production on 25-MAR-00 10:18:53

(c) Copyright 1998 Oracle Corporation. All rights reserved.

The following operations are available after showAn asterisk (*) denotes a modifier or extended command:

rawmode displaymode trc_filetrc_directory trc_level log_filelog_directory log_status current_listenerconnect_timeout startup_waittime snmp_visibleuse_plugandplay direct_handoff save_config_on_stop

LAB3.2

70 Chapter 3: Oracle Networking: Configuring Basic Net8/SQL*Net

ch03.qxd 10/30/2000 2:49 PM Page 70

Page 15: ORACLE NETWORKING: CONFIGURING BASIC NET8/SQL*NET …One of the important components of Oracle networking is the Oracle listener. The listener is the process responsible for receiving

a) What is the full command for finding the name of the listener’slog file?

b) Retrieve information about the listener with the lsnrctl statuscommand.What does the “Alias” line signify?

3.2.3 PERFORM A LOOPBACK TEST

Now that your listener is running, you can perform a loopback test to make surethat it can indeed service connection requests to your database. A loopback test isperformed by starting SQL*Plus and connecting to the database, via the listener,using the TNS service name you configured for the “example00” entry in thetnsnames.ora file template (Exercise 3.1). In that exercise, the service name wasconfigured as “db00”.

Before performing the loopback test, verify that the listener is running. Next, startSQL*Plus and connect to your database as the user SYSTEM using the TNS servicename you configured for example00 in the tnsnames.ora template. If your testwas unsuccessful, review the previous exercises to make sure that yourtnsnames.ora and listener.ora file are configured correctly and that your listenerstarted without error.

a) Why is it useful to perform a loopback test?

b) How will you test to see if the listener is started?

LAB3.2

Lab 3.2: Managing the Oracle Listener 71

ch03.qxd 10/30/2000 2:49 PM Page 71

Page 16: ORACLE NETWORKING: CONFIGURING BASIC NET8/SQL*NET …One of the important components of Oracle networking is the Oracle listener. The listener is the process responsible for receiving

TNSPING

For some Oracle installations, there is a command called “tnsping”.This command can be used to perform a test that is somewhat differ-ent than the loopback test performed in this exercise. Tnsping doesnot attempt to connect to the database, but rather simply ensures thatthe listener is present (i.e., started) on the machine. If you have thisutility, it will be located in the ORACLE_HOME\bin directory. Its syn-tax is: tnsping <address> [<count>]. The <address> is the TNSservice name, and [<count>] is an optional parameter representing thenumber of times you want tnsping to test connectivity. The followingexample shows the results of using tnsping to connect to the “db00”database five successive times:

C:\>tnsping db00 5

TNS Ping Utility for 32-bit Windows: Version

2.3.4.0.0 - Production on 25-MAR-00

10:51:05

Copyright (c) Oracle Corporation 1995. All rights

reserved.

Attempting to contact

(ADDRESS=(PROTOCOL=TCP)(Host=127.0.0.1)(Port=1521))

OK (20 msec)

OK (20 msec)

OK (40 msec)

OK (20 msec)

OK (30 msec)

LAB3.2

72 Chapter 3: Oracle Networking: Configuring Basic Net8/SQL*Net

LAB 3.2 EXERCISE ANSWERS

3.2.1 ANSWERS

a) Based on the information in your listener.ora file, find the location of your lis-tener log file.

ch03.qxd 10/30/2000 2:49 PM Page 72

Page 17: ORACLE NETWORKING: CONFIGURING BASIC NET8/SQL*NET …One of the important components of Oracle networking is the Oracle listener. The listener is the process responsible for receiving

Answer:The listener log file is in the location specified by the “LOG_DIRECTORY_LIS-TENER” line in the listener.ora file. In the template listener.ora file provided above, thedirectory is: e:\Oracle\Ora81\network\log.The name of the listener log file is specifiedin the “LOG_FILE_LISTENER” line. In the above template, the name of the file is speci-fied as: listener.The log file for this listener then is: e:\Oracle\Ora81\network\log\listener.log.

b) What is the response you get from the system after issuing this command? Didyour listener stop properly? How can you tell?

Answer: After issuing the lsnrctl stop command, you should receive a responsesimilar to the following:

C:\>lsnrctl stop

LSNRCTL for 32-bit Windows: Version 8.1.6.0.0 - Production

on 24-JUN-2000 12:07:56

(c) Copyright 1998, 1999, Oracle Corporation. All rights

reserved.

Connecting to

(ADDRESS=(PROTOCOL=TCP)(HOST=rocky)(PORT=1521))

The command completed successfully

You can tell that there were no problems in shutting down the listener because themessage “The command completed successfully” appeared in thefinal message line.

3.2.2 ANSWERS

a) What is the full command for finding the name of the listener’s log file?

Answer:The command for finding the name of the listener’s log file is:

lsnrctl show log_file

b) Retrieve information about the listener with the lsnrctl status command.Whatdoes the “Alias” line signify?

Answer:The “Alias” line represents the name of the listener. Remember that you can setup more than one listener on a machine. If there are multiple listeners, they must benamed differently. Note that if a listener has a name other than the default

LAB3.2

Lab 3.2: Managing the Oracle Listeners 73

ch03.qxd 10/30/2000 2:49 PM Page 73

Page 18: ORACLE NETWORKING: CONFIGURING BASIC NET8/SQL*NET …One of the important components of Oracle networking is the Oracle listener. The listener is the process responsible for receiving

(LISTENER), then you must include the name of the listener when you issue lsnrctl com-mands. For example, if you configure your listener to have the name LSNR_DB00, thenyou would issue the following command to start the listener: lsnrctl startlsnr_db00. It is rare to find more than one listener running on a machine, but asenior level DBA may use this configuration for load balancing or to ensure connectivity.

3.2.3 ANSWERS

a) Why is it useful to perform a loopback test?

Answer: It is useful to perform a loopback test to get an initial indication as towhether or not the listener is configured properly.

b) How will you test to see if the listener is started?

Answer:You can test to see if the listener is started by issuing the lsnrctl status command.

LAB 3.2 SELF-REVIEW QUESTIONS

To test your progress, you should be able to answer the following questions.

1) What is the command for starting the listener?

a) _____ start listenerb) _____ svrmgrl startc) _____ listener control startupd) _____ lsnrctl start

2) To get help for the Listener Control utility, you simply issue the command:lsnrctl

a) _____ Trueb) _____ False

3) Issuing the lsnrctl show command will display the values of all the listenerconfiguration parameters.

a) _____ Trueb) _____ False

4) There is no difference between performing a loopback test with the SQL*Plusmethod versus using the tnsping command.

a) _____ Trueb) _____ False

LAB3.2

74 Chapter 3: Oracle Networking: Configuring Basic Net8/SQL*Net

ch03.qxd 10/30/2000 2:49 PM Page 74

Page 19: ORACLE NETWORKING: CONFIGURING BASIC NET8/SQL*NET …One of the important components of Oracle networking is the Oracle listener. The listener is the process responsible for receiving

5) Which of the following are lsnrctl options? (check all that apply)

a) _____ servicesb) _____ reloadc) _____ log_filed) _____ trc_levele) _____ dbsnmp_status

6) Which of the following are lsnrctl show parameters? (check all that apply)

a) _____ servicesb) _____ reloadc) _____ log_filed) _____ trc_levele) _____ dbsnmp_status

Quiz answers appear in Appendix A, Lab 3.2.

LAB3.2

Lab 3.2: Managing the Oracle Listeners 75

ch03.qxd 10/30/2000 2:49 PM Page 75

Page 20: ORACLE NETWORKING: CONFIGURING BASIC NET8/SQL*NET …One of the important components of Oracle networking is the Oracle listener. The listener is the process responsible for receiving

L A B 3 . 3

CONFIGURING THE MULTI-THREADED SERVER

LAB 3.3 EXERCISES

A multi-threaded server can be configured to support an environment where userinteractions with the database are small. For example, a telemarketer may call upa customer record (usually containing a relatively small amount of information)and not perform another transaction until the customer agrees to purchase anitem. It is helpful in this case to use the multi-threaded server configuration, sincefewer system resources are required when connections share servers than whenthey each use their own dedicated server. Note that Instances in MTS configura-tion connections can still be made via dedicated servers if needed.

3.3.1 CONFIGURE AND VIEW INFORMATION

ABOUT THE MTS ENVIRONMENT

To configure the database to allow multi-threaded server connections, you simplyneed to add or edit some parameters of your init.ora file. As always, make abackup copy of your init.ora file before making any changes.

When the database is configured to allow connections via shared servers, there areat least two additional background processes that start with the Instance. The firstis the shared server itself, which is named Snnn. Since more than one shared

LAB3.3

76 Chapter 3: Oracle Networking: Configuring Basic Net8/SQL*Net

LAB OBJECTIVES

After this lab, you will be able to:

✔ Configure and View Information about the MTS Environment

ch03.qxd 10/30/2000 2:49 PM Page 76

Page 21: ORACLE NETWORKING: CONFIGURING BASIC NET8/SQL*NET …One of the important components of Oracle networking is the Oracle listener. The listener is the process responsible for receiving

server can be started, the name of the background process reflects the number ofshared servers started. So, an Instance with two shared servers will have two back-ground processes: S000 and S001.

Shared servers work in conjunction with another background process, called thedispatcher, which gets started with the Instance in this configuration. The dis-patcher process issues requests and receives responses on behalf of the sharedserver processes, and is named Dnnn. An Instance running with two dispatcherswill have two additional background processes called D000 and D001.

These two components—shared servers and dispatchers—pass information viaresponse and request queues, which are located in the SGA. When an applicationattempts to connect to the database, the listener receives the request and redirectsit to one of the dispatchers. From that time on, the client application communi-cates with the database via the dispatcher. When the client makes a request of thedatabase, the dispatcher places the request in the request queue. The shared serverprocess performs the requested action (such as selecting a row in a table) andplaces the result in the response queue. The dispatcher routes the response backto the client application, after retrieving it from the response queue.

To allow multi-threaded server connections, the init.ora file must contain the fol-lowing parameters:

• mts_dispatchers—This specifies the number of dispatcherprocesses that will be started at Instance startup, as well as theprotocol that they will be receiving requests on.

• mts_max_dispatchers—This specifies the maximum number ofdispatchers that the Instance can run simultaneously. The num-ber of dispatchers can be increased beyond the value of themts_dispatchers parameter by issuing an ALTER SYSTEM state-ment, but cannot be increased beyond the number specified inthis (mts_max_dispatchers) parameter.

• mts_servers—This specifies the number of shared servers that willbe started at Instance startup.

• mts_max_servers—This specifies the maximum number of sharedservers that the Instance can run simultaneously. If needed, theOracle Server will add servers dynamically up to the numberspecified in this parameter.

Perform a shutdown immediate on your database. If your init.ora file already con-tains these parameters, then you will edit them as described next. If it does notcontain these parameters, then you will need to add them. Set the values of theseparameters to the following:

LAB3.3

Lab 3.3: Configuring the Multi-Threaded Server 77

ch03.qxd 10/30/2000 2:49 PM Page 77

Page 22: ORACLE NETWORKING: CONFIGURING BASIC NET8/SQL*NET …One of the important components of Oracle networking is the Oracle listener. The listener is the process responsible for receiving

mts_dispatchers=”tcp,2”

mts_max_dispatchers=10

mts_servers=2

mts_max_servers=10

Restart your database.

You will now be able to see information about the shared servers and dispatchers.Remember that these two components are background processes to the Instance.In most environments, you can issue a command to see the processes running inthe operating system. For example, in some types of UNIX, the dispatcherprocesses can be seen with the following command:

ps –ef | grep ora_d0

The result will be similar to the following:

root 5261 1 0 19:21:57 ? 0:00 ora_d000_db00

root 2049 1 0 Mar 21 ? 0:00 ora_d001_db00

In any environment, additional information about the dispatchers and sharedservers is available in two views:

• V$DISPATCHER—This view contains general information aboutthe dispatchers. There is one row in the table for each dispatcherprocess.

• V$SHARED_SERVER—This view contains general informationabout shared server processes.

a) Connect to the database as the user SYSTEM and describe theV$DISPATCHER view.Write a query to find the name of thedispatchers.

You can stop dispatcher processes using the following command:

ALTER SYSTEM SHUTDOWN IMMEDIATE '<dispatcher_name>';

LAB3.3

78 Chapter 3: Oracle Networking: Configuring Basic Net8/SQL*Net

ch03.qxd 10/30/2000 2:49 PM Page 78

Page 23: ORACLE NETWORKING: CONFIGURING BASIC NET8/SQL*NET …One of the important components of Oracle networking is the Oracle listener. The listener is the process responsible for receiving

b) Choose one of the running dispatchers from the result of thequery in Question a).Write the SQL statement to shut itdown, then execute the statement.

Issue the query from Question a) and confirm that the dispatcher has been shutdown.

c) As the user SYSTEM, write a query against theV$SHARED_SERVER view to determine the names of theshared servers.

3.3.1 ANSWERS

a) Connect to the database as the user SYSTEM and describe the V$DISPATCHERview.Write a query to find the name of the dispatchers.

Answer: To “find the name of the running dispatchers” issue the query shown below.You’ll see here that there are two dispatcher processes: D000 and D001.These corre-late to the two dispatchers that were specified to start with the Instance per the linein the init.ora file: mts_dispatchers=”tcp,2”.

SQL> SELECT name

2 FROM v$dispatcher;

NAME

----

D000

D001

b) Choose one of the running dispatchers from the result of the query in Questiona).Write the SQL statement to shut it down, then execute the statement.

Answer: Your statement should look similar to this.

ALTER SYSTEM SHUTDOWN IMMEDIATE 'D001';

LAB3.3

Lab 3.3: Configuring the Multi-Threaded Server 79

ch03.qxd 10/30/2000 2:49 PM Page 79

Page 24: ORACLE NETWORKING: CONFIGURING BASIC NET8/SQL*NET …One of the important components of Oracle networking is the Oracle listener. The listener is the process responsible for receiving

c) As the user SYSTEM, write a query against the V$SHARED_SERVER view todetermine the names of the shared servers.

Answer: Your query and results should look similar to those shown below.These resultsindicate that there are two shared server processes: S000 and S001.These correlate tothe two shared servers that were specified to start with the Instance per the line inthe init.ora file: mts_servers=2.

SQL> SELECT name

2 FROM v$shared_server;

NAME

----

S000

S001

LAB 3.3 SELF-REVIEW QUESTIONS

To test your progress, you should be able to answer the following questions.

1) What are the two additional background processes that get started in a multi-threaded server configuration?

a) _____ Listener and dispatcherb) _____ Dispatcher and tnsnames.orac) _____ Shared server and dispatcherd) _____ Shared sever and listener

2) When the Oracle server is running with a multi-threaded server configuration,connections cannot be serviced by dedicated servers.

a) _____ Trueb) _____ False

3) Issuing the command lsnrctl show will display the values of all the listenerconfiguration parameters.

a) _____ Trueb) _____ False

Quiz answers appear in Appendix A, Lab 3.3.

LAB3.3

80 Chapter 3: Oracle Networking: Configuring Basic Net8/SQL*Net

ch03.qxd 10/30/2000 2:49 PM Page 80

Page 25: ORACLE NETWORKING: CONFIGURING BASIC NET8/SQL*NET …One of the important components of Oracle networking is the Oracle listener. The listener is the process responsible for receiving

C H A P T E R 3

TEST YOUR THINKING

1) Suppose you perform a loopback test using SQL*Plus and you receive the mes-sage “ERROR:ORA-01017: invalid username/password; logondenied.” Based solely on this error message, would you say that the loopbacktest was successful? Explain your answer.

2) Suppose you perform a loopback test using SQL*Plus and you receive the mes-sage “ERROR: ORA-12154: TNS:could not resolve service name.”Based solely on this error message, would you say that the loopback test wassuccessful? Explain your answer.

3) Considering the kind of work that is done in your workplace, describe one sce-nario that would benefit from the use of dedicated servers, and one that wouldbenefit from using shared servers.

Chapter 3: Oracle Networking: Configuring Basic Net8/SQL*Net 81

ch03.qxd 10/30/2000 2:49 PM Page 81

Page 26: ORACLE NETWORKING: CONFIGURING BASIC NET8/SQL*NET …One of the important components of Oracle networking is the Oracle listener. The listener is the process responsible for receiving

ch03.qxd 10/30/2000 2:49 PM Page 82


Recommended