ubuntu_user
ubuntu_user

Reputation: 57

Oracle Database 12c Connection

I have already set up an Oracle Database but I am facing a connectivity problem in the below manner:

sqlplus CISADM/CISADM@<IP>:1521/PSRM

sqlplus CISADM@PSRM

With the above two options I successfully connect to the database. Although, when I try to connect as:

sqlplus CISADM@<IP>:1521/PSRM

I get the following error :

ORA-12504: TNS:listener was not given the SERVICE_NAME in CONNECT_DATA

I can perform ping either with IP, or hostname, tnsping with IP and hostname successfully.

My tnsnames.ora file:

PSRM =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = <IP>)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = PSRM)
    )
  )

My sqlnet.ora file:

SQLNET.AUTHENTICATION_SERVICES= (NTS)
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)

I am connecting from client PC to a Database which is located in a VM. The above files are from client

Files from VM, where Database is hosted:

tnsnames.ora:

PSRM =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = <IP>)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = PSRM)
    )
  )

listener.ora

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = <IP>)(PORT = 1521))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
  )

Any ideas?

Upvotes: 1

Views: 696

Answers (1)

PKey
PKey

Reputation: 3841

You should run it like this :

sqlplus CISADM@\"<IP>:1521/PSRM\"

Important: The \" in the beginning and end of the server:port/service is part of the syntax.

Upvotes: 3

Related Questions