Createlistener

361 views

Published on

oracle foreign key primary key constraints performance tuning MTS IOT 9i block size backup rman corrupted column drop rename recovery controlfile backup clone architecture database archives export dump dmp duplicate rows extents segments fragmentation hot cold blobs migration tablespace locally managed redo undo new features rollback ora-1555 shrink free space user password link TNS tnsnames.ora listener java shutdown sequence

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
361
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
10
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Createlistener

  1. 1. How to create a Listener Networking TipsHow to create a Listener?The process of creating a Listener is really nothing more than knocking together a passablelistener.ora file, and then using the LSNRCTL utility to start the thing. In Windows, thislast step will cause a new service to be created (which is then visible in the Control PanelServices applet). On Unix, all that happens is that a new process is spawned, which thencarries out the functions of the Listener.So we start with the need for a listener.ora file. What’s the best way of creating that?Well, it’s just a text file, so you could open vi or notepad and start typing. But there’s alot of significant formatting and some crazy syntax involved, so it’s better to use theOracle-supplied Net8 Configuration Assistant to do the job (for Oracle 9i, that utility gotrenamed as simply the “Net Assistant”, but it’s essentially the same tool).To launch that tool on Windows, you click [Start][Programs][Oracle - <Oracle Home>][Network Administration][Net8 Configuration Assistant]. (Note that for 9i, the locationchanged: [Start][Programs][Oracle - <Oracle Home>][Configuration and MigrationTools][Net Configuration Assistant].For Unix, you just type nwca at the command prompt, though frequently many people usethe Configuration Assistant on Windows, and then ftp the resulting configuration across tothe Unix server.When you start the Assistant, you’ll see this screen:Copyright © Howard Rogers 2002 3/24/2002 Page 1 of 14
  2. 2. How to create a Listener Networking TipsObviously, the option we need is the top one, which is already selected. So just click[Next]. That will bring up a screen like this:There are four options available here, but only the “Add” one will be available if this is thefirst Listener to be created on the Server. If there’s an existing Listener, the other threeoptions will be available, giving you the ability to change its properties, its name, or to getrid of it altogether. Since we’re creating a new Listener, make sure “Add” is selected, andclick [Next]. The screen changes to this:Copyright © Howard Rogers 2002 3/24/2002 Page 2 of 14
  3. 3. How to create a Listener Networking TipsThe first thing you have to do is give your Listener a name. The default name, and the oneoffered as a default, is the strikingly unoriginal “Listener”. A Server can have severalListeners running on it simultaneously, but each must be uniquely named. So if there’salready one with this default name, you’ll have to change it here (simply highlight thesuggested name, and over-type it). However, if there is no chance of the default nameconflicting with an existing Listener, I’d recommend you accept the default, howeverunoriginal it is. The reason for that is simple: being the default, Oracle relies on itsexistamce for such important things as automatic Instance registration (the ability of anInstance to automatically tell the Listener that it exists). Use a non-default Listener name,and you’ll be signing up to having to perform additional configuration of the init.ora for allInstances that this Listener is going to service.Having chosen a name (or if you like the suggested one), click [Next]. The next screen willthen appear:Here, you have to state which networking protocols the new Listener will be listening on.A single Listener can listen on many protocols, so you don’t need one Listener per protocol.The available protocols are shown in the left-hand pane. The selected ones are on theright. TCP/IP is the default protocol, and so it should already be in the right-hand pane.To add others, click on an entry on the left, and then use the top “>” button to transfer itacross to the right. Reverse the process to de-select a protocol. You can then use the upand down buttons on the right to prioritise the selected protocols if there are more thanone of them. Prioritising protocols like this only makes a difference to the formatting ofthe listener.ora text file, and has no effect on the subsequent performance of the Listener.Copyright © Howard Rogers 2002 3/24/2002 Page 3 of 14
  4. 4. How to create a Listener Networking TipsIncidentally, the list of available protocols will vary from machine to machine, dependingon what Oracle networking protocol adapters you selected to install when installing Oraclein the first place.When the correct protocols are displayed in the right-hand pane, click [Next]. The nextscreen will then appear:Here, you select the port that the Listener will monitor to detect connection requests to adatabase. A single Listener can only listen on one port, however many databases it’sservicing connection requests for. The default port for standard TCP/IP connections is1521 (it used to be 1526 in Oracle 7). This is a good one to accept because, again, if youelect to listen on a non-default port, Automatic Instance Registration won’t work withoutsome extra configuration of each database’s init.ora.This happens to be the screen to configure standard TCP/IP connections. If you’veconfigured other protocols on the previous screen, you’ll need to supply the appropriateinformation those other protocols need (for example, Named Pipes requires you to supply apipe name; IPC requires a Key Value).If you selected the TCPS protocol on the previous screen, which is a secured TCP/IPprotocol, the default port number suggested will be 2484. That can again be accepted orchanged by supplying your own port number.Finally, if you’ve selected multiple protocols on the previous screen, the relevantconfiguration screens (such as this one for TCP) will display one after the other, in theorder in which you prioritised the protocols when selecting them.Copyright © Howard Rogers 2002 3/24/2002 Page 4 of 14
  5. 5. How to create a Listener Networking TipsSo, having configured how the Listener should interact with your networking protocol(s),click [Next], and the following screen should appear:Assuming you only want to configure one Listener at the present time, you’d accept thealready-highlighted ‘No’ option, and just press [Next]. If you choose [Yes], you’ll go backto the beginning.If you answered ‘No’, clicking [Next] will bring up a confirmation message that ListenerConfiguration is complete. One more click of the [Next] option takes you back to the firstscreen we saw, where you can click [Finish], at which point the wizard will close.On Windows, by the time you get the ‘configuration complete’ confirmation message,Oracle will have created and started the relevant service for you. On Unix, theListener process will be started automatically, but obviously no service will havebeen created, since no such concept exists on Unix.The fact that the Listener is created and started automatically for you on completion ofthe Assistant wizard can be a problem, particularly if you’ve used the Windows versionintending to ftp the resulting listener.ora to your Unix server, or if you’ve used the wizardon a Windows client intending to transfer it later to a Windows server.Expect dire errors to be raised when a listener.ora referencing hostname “Britten”, forexample, is transferred to an Oracle server actually called “Mozart” unchanged. Also, beprepared to invest in a tool that can remove services created ‘inadvertently’ like this on aWindows machine. Personally, I use Service+ (downloadable at www.activeplus.com), butthe Windows Resource Kit provides a command-line utility that does the same thing forfree.Copyright © Howard Rogers 2002 3/24/2002 Page 5 of 14
  6. 6. How to create a Listener Networking TipsHowever, this raises an important point: if you are going to make further configurationchanges to the listener.ora, you need to stop the Listener process or service which hasbeen automatically created for you. On Windows, this is most easily accomplished byfinding the Control Panel Services applet (often found in Administrative Tools), highlightingthe relevant service, and then using the menu options to stop it. On Unix, you need tofind a command line prompt and type: lsnrctl stop listener_name. If you earlieropted to use the default listener name, LISTENER, then you can leave off the ‘listenername’ part of that syntax.Further ConfigurationYou will probably want to check what the Wizard has created for you, and maybe makesome alterations to it. In fact, the Wizard creates a text file called listener.ora in theORACLE_HOME/network/admin directory (it’s the same directory for Windows, forversions 8i and 9i, except that the slashes go the other way around!). Bear in mind thatany alterations you make to this file have not the slightest effect on a Listener that isalready running. You’ll need to stop and start the Listener before it becomes aware ofconfiguration changes in the listener.ora file.You should open that file, and see what it looks like. In my case, I get this:LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = britten)(PORT = 1521)) ) (ADDRESS_LIST = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0)) ) ) )SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (SID_NAME = PLSExtProc) (ORACLE_HOME = F:oracleora90) (PROGRAM = extproc) ) )Now, although I only selected for TCP protocol, the Wizard has arranged things so that Iautomatically get an IPC protocol to handle calls to external procedures (which is what thebit under the SID_LIST_LISTENER heading is all about). Whether you get the same result,or something else, depends very much on the specific configuration of Oracle that you’veinstalled.Copyright © Howard Rogers 2002 3/24/2002 Page 6 of 14
  7. 7. How to create a Listener Networking TipsYou may find, for example, that if a database has already been created on the machinethat you ran the networking wizard on, it will have automatically discovered the existenceof that database, and added a reference to that in the SID_LIST_LISTENER bit of the file,too.Feel free to edit this text file if it’s not what you want: but bear in mind that theindentation and formatting created by the wizard is not irrelevant, or there just to makethings look good. Go overboard in your re-formatting and you might have trouble actuallystarting the Listener.In my case, I don’t want external procedures to be called. So whilst I don’t strictly needto remove references to it, there’s no harm in doing so either. With a bit of judiciousediting, I’m left with a listener.ora that looks like this:LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = britten)(PORT = 1521)) ) ) )You will notice that nowhere in this newly-revised file does it state precisely on behalf ofwhich databases the Listener should be listening. That’s significant, and it’s an entirely 8iand above feature. Databases of those versions are able to register themselves with theListener, so the Listener doesn’t need to be explicitly told about them ahead of time inthe listener.ora. But databases earlier than 8i cannot register themselves automatically,and the listener.ora needs to reference those databases explicitly.Let’s assume I wanted my new Listener to listen out for connection requests to an Oracle8.0.6 database called HR. How would I add that requirement to the listener.ora? Well,again, you could just edit the file, but it’s easier if you use the Net8 Assistant (renamedthe Net Manager in 9i). Don’t confuse that with the Net8 Configuration Assistant, by theway. The latter is a wizard-based way of creating the relevant networking configurationfiles. The former is a tool to manage things in a way that assumes you know what it is thatyou are doing.Let’s fire up the Net8 Assistant, then, to add in this reference to an Oracle 8 database. InWindows, click [Start][Programs][Oracle – <Oracle Home>][Network Administration][Net8Assistant]. (In 9i, it’s [Start][Programs][Oracle – <Oracle Home>][Configuration andMigration Tools][Net Manager]). Here’s the first screen:Copyright © Howard Rogers 2002 3/24/2002 Page 7 of 14
  8. 8. How to create a Listener Networking TipsOpen the “Local” branch of the tree structure in the left-hand pane, and then the“Listeners” branch within that, and you’ll see this:The Listener you configured using the Wizard will be displayed in the tree structure. Clickon that entry, and the right-hand pane will display this:Copyright © Howard Rogers 2002 3/24/2002 Page 8 of 14
  9. 9. How to create a Listener Networking TipsThis is the “Listening Locations” page. It just describes what machine the Listener is goingto run on, what port it will use, and what protocol is going to be used to contact it. If youlook carefully, you’ll see that it corresponds precisely with the edited listener.ora shownabove.But remember what we wanted to do: add in a reference to an 8.0 database called “HR”,so that this Listener, when finally its gets to run, will handle the connection requests forthat database. Here’s what we do. Go to the “Listening Locations” label, and click thelittle down-arrow symbol on its right. From the menu that is then displayed, select the“Database Services” option. The left-hand pane will then change to display… pretty wellnothing.That’s the point, of course. At the moment, we haven’t configured any databases to belistened for, so there are no “database services” to display. But that’s all about to change.Click the “Add Database” button at the bottom of the pane. The screen will change toshow the following:Copyright © Howard Rogers 2002 3/24/2002 Page 9 of 14
  10. 10. How to create a Listener Networking TipsYou need to supply just three pieces of information here: the global database name, thatdatabase’s Oracle Home, and the SID by which it is identified. I’ve filled in this screenshot using the example of a database called “HR”. However, you will probably find thatthe screen is initially filled in with a whole bunch of stuff referring to a database called“ORCL” (which is the default name of the starter database you tend to get when youinstall Oracle in the first place). Just overtype that information with your own details, asI’ve done here.If you need to specify another non-8i or non-9i database, click [Add Database] again, andkeep going. If you make a mistake, select the appropriate tab containing the erroneousdatabase details, and click [Remove Database].When everything is completed to your satisfaction, you need to make sure that thechanges you’ve made in this tool are actually written to the listener.ora configuration file.So click [File] [Save Network Configuration].Then click [File][Exit]. For some utterly bizarre reason, you’ll be asked to save yourconfiguration changes one more time, just in case. Click the [Save] option when prompted,and the tool will finally close.If you now open up the listener.ora text file, you’ll see something like this:LISTENER = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = britten)(PORT = 1521)) )Copyright © Howard Rogers 2002 3/24/2002 Page 10 of 14
  11. 11. How to create a Listener Networking TipsSID_LIST_LISTENER = (SID_LIST = (SID_DESC = (GLOBAL_DBNAME = HR.aldeburgh.local) (ORACLE_HOME = d:oracleora806) (SID_NAME = HR) ) )So, the configuration of a non-8i or non-9i version of the database results in the appendingof a SID_LIST_LISTENER section to the file (which it had originally, of course, with the bitsabout allowing external procedure calls).This is an important point. Anything that is listed within a SID_LIST_LISTENER part of alistener.ora is said to be statically configured. The configuration information, as you cansee, is fairly minimal (we need to know the ORACLE_HOME to make sure that the rightversion of the executables are called, if needed. The SID is needed so we know what toconnect to in the first place). But it must be explicitly configured, like this, for anyversion of the database prior to 8i.Databases of versions 8i or higher can perform dynamic configuration –that is, they caninform the Listener, on startup, of their own existence, and they do not therefore need tobe specified in the listener.ora at all.Even in 8i or higher databases, however, certain non-core-database services have to bestatically configured. Calls to external procedures have to be, for example, which is whythe configuration wizard automatically put those lines into the original version of my file.Heterogeneous Services (basically, gateways to non-Oracle databases) must also bestatically configured, even with 8i or 9i databases.Starting the ListenerWith the listener.ora configured one way or another, it’s time to actually start the Listener.If you ran the configuration wizard described earlier on the Server itself, then the servicehas probably already been started for you, as I mentioned on page 5. Quite often,however, you may run the configuration wizard on your local PC, and then transport theresulting listener.ora over to the server for later running.If that’s what you’ve done, you’ll have to start the Listener yourself, using good oldmanual methods.To do this, get yourself to a command line prompt on the server that hosts the database,and typelsnrctl start listener_nameCopyright © Howard Rogers 2002 3/24/2002 Page 11 of 14
  12. 12. How to create a Listener Networking TipsIf you accepted the default name earlier (“LISTENER”), then you don’t need to specify thelistener name part of this command. If you chose to name your Listener something exotic,such as FredandGinger, then you must explicitly name it here, otherwise it won’t work.You’ll see something like the following appear on your screen:C:Documents and SettingsAdministrator>LSNRCTL start listenerabcLSNRCTL for 32-bit Windows: Version 9.0.1.1.1 - Production on 24-MAR-2002 15:54:37Copyright (c) 1991, 2001, Oracle Corporation. All rights reserved.Starting tnslsnr: please wait...Failed to open service <OracleOraHome91TNSListenerlistenerabc>, error 1060.TNSLSNR for 32-bit Windows: Version 9.0.1.1.1 - ProductionSystem parameter file is d:oracleora91networkadminlistener.oraLog messages written to d:oracleora91networkloglistenerabc.logListening on:(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=mozart.aldeburgh.local)(PORT=1521)))Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=mozart)(PORT=1521)))STATUS of the LISTENER------------------------Alias listenerabcVersion TNSLSNR for 32-bit Windows: Version 9.0.1.1.1 -ProductionStart Date 24-MAR-2002 15:54:41Uptime 0 days 0 hr. 0 min. 2 secTrace Level offSecurity OFFSNMP OFFListener Parameter File d:oracleora91networkadminlistener.oraListener Log File d:oracleora91networkloglistenerabc.logListening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=mozart.aldeburgh.local)(PORT=1521)))The listener supports no servicesThe command completed successfullyIn this example, I had to specify a Listener name on the command line, because it wascalled ‘listenerabc’, and not the plain old default ‘listener’. The operating system reactedto the request to start my Listener with a quite nasty-looking error:Failed to open service <OracleOraHome91TNSListenerlistenerabc>, error 1060.TNSLSNR for 32-bit Windows: Version 9.0.1.1.1 - ProductionSystem parameter file is d:oracleora91networkadminlistener.oraLog messages written to d:oracleora91networkloglistenerabc.logThat’s actually perfectly normal (for Windows, the first time). It just means that the O/Shas discovered that the service for the Listener doesn’t exist –which prompts it to createthe service for you. On Unix, there should be no such messages.To be absolutely sure the thing is working correctly, try to stop the Listener and thenimmediately re-start it (I’ve highlighted the relevant commands):Copyright © Howard Rogers 2002 3/24/2002 Page 12 of 14
  13. 13. How to create a Listener Networking TipsC:Documents and SettingsAdministrator>lsnrctl stop listenerabcLSNRCTL for 32-bit Windows: Version 9.0.1.1.1 - Production on 24-MAR-2002 16:02:51Copyright (c) 1991, 2001, Oracle Corporation. All rights reserved.Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=mozart)(PORT=1521)))The command completed successfullyC:Documents and SettingsAdministrator>LSNRCTL start listenerabcLSNRCTL for 32-bit Windows: Version 9.0.1.1.1 - Production on 24-MAR-2002 16:02:56Copyright (c) 1991, 2001, Oracle Corporation. All rights reserved.Starting tnslsnr: please wait...TNSLSNR for 32-bit Windows: Version 9.0.1.1.1 - ProductionSystem parameter file is d:oracleora91networkadminlistener.oraLog messages written to d:oracleora91networkloglistenerabc.logListening on:(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=mozart.aldeburgh.local)(PORT=1521)))Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=mozart)(PORT=1521)))STATUS of the LISTENER------------------------Alias listenerabcVersion TNSLSNR for 32-bit Windows: Version 9.0.1.1.1 -ProductionStart Date 24-MAR-2002 16:02:59Uptime 0 days 0 hr. 0 min. 2 secTrace Level offSecurity OFFSNMP OFFListener Parameter File d:oracleora91networkadminlistener.oraListener Log File d:oracleora91networkloglistenerabc.logListening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=mozart.aldeburgh.local)(PORT=1521)))The listener supports no servicesThe command completed successfullyThis time, you’ll notice no unpleasant messages at all. And so now you know the Listenercan stop and start at will, you’ve successfully created and configured a Listener.Other IssuesIf you use the Configuration wizard on one machine intending to transfer the resultinglistener.ora to another one later on, you must edit the listener.ora by hand beforeattempting to start the Listener. For example, my earlier example of using the wizard wasdone on my client PC, called ‘Britten’, That’s why the listener.ora contained these lines: (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = britten)(PORT = 1521)) )Copyright © Howard Rogers 2002 3/24/2002 Page 13 of 14
  14. 14. How to create a Listener Networking TipsUnfortunately, my server hosting Oracle is actually called “Mozart”. Here’s what you canexpect if you ship the listener.ora over to the real server without further modification, andtry and start the Listener:C:Documents and SettingsAdministrator>LSNRCTL start listenerabcLSNRCTL for 32-bit Windows: Version 9.0.1.1.1 - Production on 24-MAR-2002 16:51:55Copyright (c) 1991, 2001, Oracle Corporation. All rights reserved.Starting tnslsnr: please wait...Failed to open service <OracleOraHome91TNSListenerlistenerabc>, error 1060.TNSLSNR for 32-bit Windows: Version 9.0.1.1.1 - ProductionSystem parameter file is d:oracleora91networkadminlistener.oraLog messages written to d:oracleora91networkloglistenerabc.logError listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=britten)(PORT=1521)))TNS-12545: Connect failed because target host or object does not exist TNS-12560: TNS:protocol adapter error TNS-00515: Connect failed because target host or object does not exist 32-bit Windows Error: 49: Unknown errorListener failed to start. See the error message(s) above...I’ve highlighted the crucial error message, which is easy to miss because of theoverwhelming nature of the complete error stack. Incidentally, on a Windows machine,even though the Listener couldn’t actually start because of the hostname issue,nevertheless, the Service is created for you.Here’s another error situation: if you create a Listener (called in this example ‘listenerabc’)whose name matches one that has already been created and started, expect somethinglike this:C:Documents and SettingsAdministrator>LSNRCTL start listenerabcLSNRCTL for 32-bit Windows: Version 9.0.1.1.1 - Production on 24-MAR-2002 16:58:35Copyright (c) 1991, 2001, Oracle Corporation. All rights reserved.Starting tnslsnr: please wait...Service OracleOraHome91TNSListenerlistenerabc already running.TNS-12536: TNS:operation would block TNS-12560: TNS:protocol adapter error TNS-00506: Operation would block 32-bit Windows Error: 997: Unknown errorIn short, pay attention to the host’s name as recorded in the listener.ora, as well as theListener Name itself. The former must be accurate, the latter must be unique.Copyright © Howard Rogers 2002 3/24/2002 Page 14 of 14

×