Reputation: 1
I've installed Oracle 19c Enterprise on a Windows Server 2019. After installing, I used SQL Plus to connect as "SYS as SYSDBA" account successfully, and made queries etc.
However, when trying to connect via Sql Developer, I get the following error:
Status : Failure -Test failed: Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
In the /network/admin folder, I already had the listener.ora and sqlnet.ora files. I created the tnsnames.ora file with the following config:
TEST_DB =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1522))
)
(CONNECT_DATA =
(SERVICE_NAME = TEST)
)
)
My listener.ora file looks like this:
# listener.ora Network Configuration File: C:\Users\testUser\Downloads\WINDOWS.X64_193000_db_home\NETWORK\ADMIN\listener.ora
# Generated by Oracle configuration tools.
DEFAULT_SERVICE_LISTENER = XE
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = C:\Users\testUser\Downloads\WINDOWS.X64_193000_db_home)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:C:\Users\testUser\Downloads\WINDOWS.X64_193000_db_home\bin\oraclr19.dll")
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1522))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1522))
)
)
Note, the DEFAULT_SERVICE_LISTENER = XE
line I added manually when seeking help online. The rest is as it came I believe.
I had some issues restarting some of the Oracle services after editing the files, but a server restart later, they're all running.
I checked lsnrctl status and start in cmd:
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1522)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for 64-bit Windows: Version 19.0.0.0.0 - Production
Start Date 12-JUL-2024 16:04:43
Uptime 0 days 0 hr. 5 min. 53 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Default Service XE
Listener Parameter File C:\Users\testUser\Downloads\WINDOWS.X64_193000_db_home\network\admin\listener.ora
Listener Log File C:\Oracle19c\diag\tnslsnr\V-LABAPPDB2\listener\alert\log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1522)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1522ipc)))
Services Summary...
Service "CLRExtProc" has 1 instance(s).
Instance "CLRExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
C:\Windows\system32>lsnrctl start
LSNRCTL for 64-bit Windows: Version 19.0.0.0.0 - Production on 12-JUL-2024 16:11:12
Copyright (c) 1991, 2019, Oracle. All rights reserved.
TNS-01106: Listener using listener name LISTENER has already been started
And finally, I've tried a bunch of combinations on Sql Developer connection. The username, I've tried between: "sys as sysdba", "sys" with the Role as SYSDBA. I doubt it's a user/id issue as the Test isn't getting to that point
Hostname: localhost (tried the dedicated IP too) Port: 1522 SID: TEST (though I tried TEST_DB too)
tnsping test_db gives:
Used parameter files:
C:\Users\testUser\Downloads\WINDOWS.X64_193000_db_home\network\admin\sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1522))) (CONNECT_DATA = (SERVICE_NAME = LCM)))
OK (0 msec)
I thought it should be tnsping localhost 1522 but that doesn't work. And on just tnsping localhost it tries default port 1521.
Not sure where to go from here....
Upvotes: 0
Views: 163
Reputation: 9091
This is a kinda advanced topic that you shouldn't normally need to get into on a fresh install... but your lsnrctl
output should show a Service named TEST, and it doesn't - it just shows the CLRExtProc
service. This means that the db instance isn't registered with the Listener, so only local OS authentication will work.
When it's working lsnrctl status
will show a line like:
Services Summary...
Service "TEST" has 1 instance(s).
[...]
Weirdly your TNSPING is connecting to a service named LCM, which I don't see in your Listener output.
There's two ways to solve this - static and dynamic registration.
For static registration, add a SID_DESC entry to your SID_LIST in listener.ora:
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = C:\Users\testUser\Downloads\WINDOWS.X64_193000_db_home)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:C:\Users\testUser\Downloads\WINDOWS.X64_193000_db_home\bin\oraclr19.dll")
)
(SID_DESC =
(SID_NAME = TEST)
(GLOBAL_DBNAME = TEST)
(ORACLE_HOME = C:\Users\testUser\Downloads\WINDOWS.X64_193000_db_home)
)
)
For dynamic registration, this normally happens automatically, but you can connect to your db as sysdba, and run alter system register;
to tell the instance to try registering itself.
Upvotes: 0
Reputation: 4567
This question has already been answered N times here... in short SQL*Plus uses OS authentication not SQLDeveloper: database parameter REMOTE_LOGIN_PASSWORDFILE must be set to exclusive and the password file must exits (in $ORACLE_HOME/dbs/orapw), create one - with orapwd - if not.
Upvotes: 0