|Lesson 5||Configuring the listener.ora file |
|Objective|| Add a database to your listener.ora file.|
Add Oracle Database
Configuring listener.ora file
Oracle Net configuration
information is stored in a special text file named listener.ora.
The normal location for this file is in $ORACLE_HOME/network/admin. Under Windows, if you have done a default install of Oracle, you should find listener.ora in the
Under Unix, you should look first in $ORACLE_HOME/network/admin. If you do not find it there, then try looking in the /var/opt/oracle directory. The important part of the listener.ora file, at least for our purposes, is the part under the heading
This is important to us, because that is the section containing the list of databases served by the listener.
The heading could be at any point in the file, because Oracle just looks for it by name.
It will not take you too long to find it, though, because listener.ora files are not usually very big.
The following Slide Show shows what this looks like, and describes the purpose of each of the elements that fall under that heading:
- The SID_LIST_LISTENER entry marks the list of services that the listener is handling.
- Oracle allows you to have multiple listeners running at once.
- Our listener has a SID list or list of services that it is handling.
- The first item that we are listening for is named PLSExtProc. This represents an executable file that is used to interface Oracle to external DLL libraries.
- The second item does refer to a database. You can tell because it refers to a SID name rather than a program.
- The GLOBAL_DBNAME entry allows clients to reference the database by the name and domain specified in the database initialization file
- The SID_NAME entry allows clients to reference the database by the name of the instance.
- The ORACLE_HOME entry tells the listener the location of the Oracle home directory for this database.
Sid List Listener
Once you start working with Oracle Net configuration files, it will not be long before the parentheses start to drive you crazy.
All the information is contained in lists that are enclosed in parentheses, and these lists can sometimes be nested several levels
deep. When editing these files, be very, very careful not to mess up on the parentheses.
Adding an entry for a new database
When you need to add an entry for a new database to a listener.ora file, you should usually follow these steps:
- Open listener.ora using a text editor such as vi or Notepad.
- Find the section in the file that starts with "
SID_LIST_LISTENER = ".
- Duplicate the entry for one SID using cut and paste.
- Edit the new entry so that it reflects the new database.
- Save the file.
Step 3, where you duplicate the entry for a SID, is where you are most likely to make a mistake.
That's because of all the parentheses. It's easy to miss one when copying and pasting.
The entry for one SID looks like this:
(GLOBAL_DBNAME = jonathan.course.DistributedNetworks.com)
(ORACLE_HOME = C:\Oracle\Ora81)
(SID_NAME = JONATHAN)
After carefully determining where the entry starts and ends, you should copy the entry and paste a duplicate of it right below.
From then on, it is a simple matter to edit the
SID_NAME and the
GLOBAL_DBNAME values. The
SID_NAME value can be anything you want, but it's customary to use the database name for this SID name. The database name can be determined by looking at the
db_name parameter in your database parameter file.
GLOBAL_DBNAME parameter should consist of your database name and domain separated by a period. You can find your domain by looking at your database's
db_domain initialization parameter.
Configuring Listener - Exercise