Oracle 11g Database + SQL Developer, connection to database

1

I've successfully set-up my databse, and I can do some queries through my webiste wxplorer

http://localhost:8080/apex/f?p=4500:1003:1042268341573744::NO:::

But, when I downloaded 4.1.5 Sql Developer with jdk package, when I click to New Connection, and I typed: Connection Name: MYONLINEEDU_XE Username: MYONLINEEDU Password:admin123

And when I click Connect I get an 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

on my path C:\app\Stefan\product\11.2.0\dbhome_1\NETWORK\ADMIN here is my tnsnames (I've added orcl settings):

 # tnsnames.ora Network Configuration File:       C:\app\Stefan\product\11.2.0\dbhome_1\network\admin\tnsnames.ora
 # Generated by Oracle configuration tools.

ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
  (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
(CONNECT_DATA =
  (SID = CLRExtProc)
  (PRESENTATION = RO)
)
)

ORCL = 
(DESCRIPTION = 
  (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521)
(CONNECT_DATA = 
(SERVER = DEDICATED)
(SERVICE NAME = orcl)
)
)

I even tried to start LSNRCTL service, but it has been already started.

LSNRCTL> services
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
Services Summary...
Service "CLRExtProc" has 1 instance(s).
Instance "CLRExtProc", status UNKNOWN, has 1 handler(s) for this service...
Handler(s):
  "DEDICATED" established:0 refused:0
     LOCAL SERVER
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Handler(s):
  "DEDICATED" established:0 refused:0
     LOCAL SERVER
Service "XEXDB" has 1 instance(s).
Instance "xe", status READY, has 1 handler(s) for this service...
Handler(s):
  "D000" established:16 refused:0 current:0 max:1022 state:ready
     DISPATCHER <machine: STEFAN-PC, pid: 2664>
     (ADDRESS=(PROTOCOL=tcp)(HOST=STEFAN-PC)(PORT=18879))
Service "orcl" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
Handler(s):
  "DEDICATED" established:71 refused:0 state:ready
     LOCAL SERVER
Service "orclXDB" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
Handler(s):
  "D000" established:0 refused:0 current:0 max:1022 state:ready
     DISPATCHER <machine: STEFAN-PC, pid: 5228>
     (ADDRESS=(PROTOCOL=tcp)(HOST=STEFAN-PC)(PORT=1547))
Service "xe" has 1 instance(s).
Instance "xe", status READY, has 1 handler(s) for this service...
Handler(s):
  "DEDICATED" established:0 refused:0 state:ready
     LOCAL SERVER
The command completed successfully

Also in my system32/hosts I added 127.0.0.1 localhost

How to remove this error, and to connect to my database?

Thanks!

Stefan89BEG

Posted 2016-09-22T12:08:30.667

Reputation: 11

By the looks of it, it is your SID that is wrong. Can you log in as the oracle user into the box and issue: echo $ORACLE_SID and then use that system ID during the login? – Lefty G Balogh – 2017-05-22T07:42:46.007

Answers

0

Errors you may get when connecting Oracle SQL Developer to a DB:

  • Invalid username/password - Make sure you use the uname/pwd that you use to access the DB with slqplus.

  • String index out of range - Are you trying to connect on a wrong port? Maybe 22? Check the listening port / forwarding port

  • Listener refused the connection. Unknown SID. - Make sure you are using the right system ID.

SSH into the remote DB and switch to the DB user. Check the Oracle SID:

echo $ORACLE_SID

Fire up Oracle SQL Developer

Click the green + sign - up pops the new connection menu.

Connection Name:    XYZ_Oracle
Username:           Oracle_db_username
Password:           pwd_for_db_username

Connection type:    Basic
Role:               Default
Hostname:           XXX.XX.XX.XX (Remote IP)
Port:               1521 (the forwarded port)
SID:                the Odarcle SID of the particular DB you want to access aka db name

Press Test

Press Connect

Lefty G Balogh

Posted 2016-09-22T12:08:30.667

Reputation: 180