12 August 2016

Oracle SQLDeveloper connection fails / TNS listener not starting

I had a problem today connecting to my Oracle express database from SQL Developer on Windows 10 with the error: The network adapter could not establish the connection.
Connection did work from SQL*PLUS (Run SQL Command line).
The OracleXETNSListener service was stopped in my services and restarting it did not work.
Turns out the problem was that I changed my computer name yesterday and the service does not use localhost, but the computername.
To solve this I changed the hostname in these files:
%ORACLE_HOME%\app\oracle\product\11.2.0\server\network\ADMIN\listener.ora
%ORACLE_HOME%\app\oracle\product\11.2.0\server\network\ADMIN\tnsnames.ora
Stopped/started the database and everything's fine.

Saw these alternate solutions (did not test):
solution 1: Add the old hostname to C:\Windows\System32\drivers\etc\hosts
solution 2:

SQL> alter system set LOCAL_LISTENER='(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521))' scope=both;
SQL> alter system register;


No comments:

Post a Comment