Change oracle port from 1523 to 1521 when something else is on 1521 I'd like to have oracle running on the default port of 1521 so I don't need to change connection strings in 100 places. My newly installed database is listening on 1523 though:

$tnsping $ORACLE_SID
.... (PORT = 1523)


I want that to be 1521. I confirmed that I can connect to 1523 but not on 1521. However, it appears that oracle is actually listening on port 1521,1522 and 1523:

$netstat -tulpn
...
tcp        0      0 0.0.0.0:1521                0.0.0.0:*                   LISTEN      119935/tnslsnr
tcp        0      0 0.0.0.0:1522                0.0.0.0:*                   LISTEN      17766/tnslsnr
tcp        0      0 0.0.0.0:1523                0.0.0.0:*                   LISTEN      185301/tnslsnr


Why would it be listening on 3 ports, but not working on 1521? Is it normal for oracle to be listening on 3 ports with 3 instances of tnslsnr?
Before even posting I found the answer to my question.

As it turns out there should only be one of those processes running.

The first thing I did was try to find out more about this process on port 1521. I took the PID and searched for it.

ps -ef | grep 119935
oracle   119935      1  0 May11 ?        00:00:04 {Old install path}/bin/tnslsnr LISTENER -inherit


I noticed that the path shown here is to a directory that doesn't exist. I had previously installed oracle to this location and then uninstalled and reinstalled (I had to do this twice...). I had even "rm -rf"ed the whole directory. So this process must be from the old install, still running in memory. There's probably a bunch of stuff running that shouldn't be from my hacking so I rebooted the machine.

Now processes are gone:

$netstat -tulpn | grep tnslsnr
nothing here


With port 1521 free I can change the listeners port