Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

Let's say I have a Oracle database. I have a username = x, password = y, database = z. Also I know the port = a, SID = b, Hostname = c.

So how do I need to connect correctly? I used many options like:

sqlplus x/y@'(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=c)(PORT=a))(CONNECT_DATA=(SID=z)(SERVER=DEDICATED)))'

sqlplus (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=c)(PORT=a))(CONNECT_DATA=(SID=b)))

Submitting these command lines usually gives me back error messages like:

ORA-12560: TNS:protocol adapter error
ORA-12514: TNS:listener does not currently know of service

Many thanks in advance!!

share|improve this question
2  
Assuming you have the right host/port, it sounds to me like the instance isn't running or not registered with the listener. –  Colin 't Hart May 13 at 11:44
    
using ezconnect: sqlplus x/y@c:a/b –  Dieter DHoker May 14 at 15:45

4 Answers 4

The most simple is to use tnsnames.ora file to connect to the database. For that edit it and add a new entry: This file normally resides in the $ORACLE HOME\NETWORK\ADMIN directory.

myDb  =
 (DESCRIPTION =
   (ADDRESS_LIST =
     (ADDRESS = (PROTOCOL = TCP)(Host = c)(Port =a))
   )
 (CONNECT_DATA =
   (SERVICE_NAME =b)
 )
)

and then you could connect to the db:

sqlplus x/y@myDb

share|improve this answer

did you try

sqlplus username/password@host:port/service
sqlplus x/y@c:a/b

modern sqlplus (version 11 or newer) understands this syntax and you don't need a tnsnames.ora file.

share|improve this answer

Seems database is not up. It might be due to restarting machine and the instance is not set to autostart and it so not started manually after starting from services Screen.

Just goto Command prompt

Set Oracle SID C:>set oracle_sid=ORCL

Now run Net start command. C:>net start oracleserviceORCL

Please try this once..

share|improve this answer

Your sqlplus line looks correct, verify the following:

  1. You can connect as sysdba on the database server itself.
  2. You can connect as the user you are trying to on the database server itself.
  3. You can ping the database server from the computer you are trying to connect from.
  4. You can tnsping the listener from the computer you are trying to connect from.

If all these check out you may want to create a fresh connection line to make sure you don't have a typo.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.