2 Day DBA > Managing Network Connections > Changing Listener Port Numbers > Changing the Listener Port ...
Changing the Listener Port Number for Database Connection Requests |
Previous |
Next |
If you change the listener port number for database connection requests, you must ensure that all future database connection requests use the new port number. This means that connection requests such as those discussed in "Connecting Remotely with SQL Command Line" must explicitly include the port number.
For example, if you change the port number for database connection requests to 1522, subsequent SQL Command Line (SQL*Plus) connect
statements must be similar to the following (assuming a connection from Oracle Database Express Edition Client):
connect system/mypassword@myhost.mydomain.com:1522
Assume that your Oracle Database XE host computer is named myhost.mydomain.com
and that you want to install a new software package on this computer that requires TCP port number 1521. Assume also that the port number for that software package cannot be configured, and that you must therefore resolve the port number conflict by reconfiguring Oracle Database XE. You decide to change the listener port number for database connection requests to 1522.
To change the listener port number for database connection requests to 1522:
Stop the listener.
See "Stopping and Starting the Listener" for instructions.
Open the file listener.ora
with a text editor.
Table: Location of the listener.ora File shows the location of this file on each platform.
Locate the following section of the file:
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
(ADDRESS = (PROTOCOL = TCP)(HOST = myhost)(PORT = 1521))
)
)
Note that the line indicated in bold may or may not be present in the file.
Change the text (PORT
=
1521)
to (PORT
=
1522)
.
Save the modified listener.ora
file.
Start the listener.
See "Stopping and Starting the Listener" for instructions.
Start SQL Command Line and connect to the database as user SYSTEM
.
See "Connecting Locally with SQL Command Line" for instructions. You must supply the SYSTEM
password. You set this password upon installation (Windows) or configuration (Linux) of Oracle Database XE.
Enter the following two commands:
ALTER SYSTEM SET LOCAL_LISTENER = "(ADDRESS=(PROTOCOL=TCP)(HOST=myhost.mydomain.com)(PORT=1522))"; ALTER SYSTEM REGISTER;
Exit SQL Command Line and run the lsnrctl
status
command to verify the port number change.
The new port number should be displayed in the Listening Endpoints Summary section of the status report, and the report should include the following lines:
Service "XE" has 1 instance(s). Instance "XE", status READY, has 1 handler(s) for this service...