Avatar of Arrismog
 asked on

Linux - Oracle : how to change port 1522 to 1521 listener-db-em

Hello experts!

I currently have Oracle 11gR2 running on a SuSE 10 SP3.

Checking the listener.ora and tnsnames, as well as with the lsnrctl status command, it seems that the listening port is 1522. I would like to change it to the default (1521), so I don't need to add the port parameter in my php programs via the oci_connect function.

I've been searching on oracle's docs, and found this:

I followed all steps under the "Changing the Listener Port Number for Database Connection Requests" section, but now, the em console wouldn't even connect to the database instance nor the listener. The problem seems that em still waits to the 1522 port. From what I understand, listener and instance are now communicating between each other because the lsnrctl status now shows a ready connection at 1521, but em's still trying on 1522

Is there any additional config that is needed to be done at the em console's side? :( I'm kind of new with Oracle Admin.

Oracle DatabaseLinux

Avatar of undefined
Last Comment
slightwv (䄆 Netminder)

8/22/2022 - Mon
slightwv (䄆 Netminder)

Change the listener.ora file on the database server.  That is what sets the port.

It should be in $ORACLE_HOME/network/admin

View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Chakravarthi Ayyala

In addition to comment 1 above, as a matter of best practice, i would recommend save a copy of the previous listener.ora with a cp -p, so that you will preserve the timestamps, if that is needed.
slightwv (䄆 Netminder)

I guess I should also add:  Why set it to the default port?

Typically in production, you don't chose any default values.  You open yourself up to hacking/cracking this way.  If I know you are running Oracle, 1521 is the first port I'll go after.

If I'm looking to see if your running Oracle, same thing.  I'll try 1521 and all default users/passwords.

I pick a port not even close to anything 'default' for my production systems.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck

When issuing the emca -config dbcontrol db, it asks for info like the ORACLE_HOME, SID, hostname, etc, but never asks the listener port and uses the 1522, even in the "confirm" section of this command, it displays 1522, never asking the new one:


You have specified the following settings

Database ORACLE_HOME ................ /opt/oracle/product/11.2.0/dbhome_1

Local hostname ................ server1.mydomain
Listener ORACLE_HOME ................ /opt/oracle/product/11.2.0/dbhome_1
Listener port number ................ 1522
Database SID ................ sid
Email address for notifications ...............
Outgoing Mail (SMTP) server for notifications ...............

Do you wish to continue? [yes(Y)/no(N)]:

Open in new window

@slightwv: Yes, that's an important observation, at this point I'm using this environment for testing purposes, but this procedure will be useful when changing it to another port once I put it on production.

slightwv (䄆 Netminder)

I believe the emca command was for reconfiguring after you change the port in the listener.ora file.

You must still have 1522 in listener.ora
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.

Yes. What steve said.
Chakravarthi Ayyala

If you are comfortable editing listener.ora, please make a copy of it and change the port and restart the listener.
We used this method so many times in the past and never faced any issue with that, if you think this is ok with you.
slightwv (䄆 Netminder)

>>please make a copy of it

didn't you already suggest that?

>>and change the port

Already posted?

>>restart the listener.

Sort of implied...
Your help has saved me hundreds of hours of internet surfing.

Hi everyone!

Instead of running emca -config dbcontrol db , I executed:

emca -deconfig dbcontrol db
emca -config dbcontrol db -repos recreate

as noted in the docs provided by mrjoltcola.

The config dbcontrol took a while, but it, as the docs said, reconfigured the Database Control. Once it finished doing what it had to, I entered the em console again and it now communicates with the newly changed port listener :)!

So, what I've done (don't know if this was correct, but it worked for me):

1. changed listener.ora and tnsnames.ora manually with the new port

2. from sqlplus, ran the following



Open in new window

3. emca -deconfig dbcontrol db

4. emca -config dbcontrol db -repos recreate -- typed the host,sid, oracle_home and listener port

5. restarted em console : emctl start dbconsole

Thanks for all your support!
slightwv (䄆 Netminder)

Why didn't you split the points since part of your answer was to change the listener.ora?

I did change the listener.ora and tnsnames.ora even before asking the question :( as noted in my first comment (followed steps from http://download.oracle.com/docs/cd/B25329_01/doc/admin.102/b25107/network.htm#BHCDDAII), what I was really missing was the reconfig command, but yes, I'm sorry I didn't split part of the points with you, you really helped me a lot. If there's any way to split it now, I will, if not, I'll keep it in mind in the next posts (which I'm sure I'll be having) :)
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
slightwv (䄆 Netminder)

I wasn't aware that you had already changed the listener.ora file.

I misread the question.  That is my mistake.