ORA-12154:TNS:could not resolve the connect identifier inPL/SQL developer - oracle

I instaled Oracle and pl/sql developer to manage my databases. but when i want to connect to pl/sql i got the error : ORA-12154:TNS:could not resolve the connect identifier
this is my tns.ora :
XE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = yegane-laptop)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = XE)
)
)

Sometimes, the notepad which you edit your tnsnames.ora file puts '....'(dots) front of each newline. For example:
XE =
..(DESCRIPTION =
....(ADDRESS = (PROTOCOL = TCP)(HOST = yegane-laptop)(PORT = 1521))
....(CONNECT_DATA =
.....(SERVER = DEDICATED)
......(SERVICE_NAME = XE)
...)
..)
you can check this case with notepad++ selecting 'Show All Charecters'.

Related

Can't connect to oracle database with Oracle SQL Developer

When I try to connect I get error:
I disabled firewall, started the OracleServiceXE, but still get error.
When I use command lsnrctl status, I get:
lsnrctl start:
My tnsnames.ora file looks like that:
# tnsnames.ora Network Configuration File: C:\app\Coi\product\18.0.0\dbhomeXE\NETWORK\ADMIN\tnsnames.ora
# Generated by Oracle configuration tools.
XE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.0)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = XE)
)
)
LISTENER_XE =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.8)(PORT = 1521))
ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
)

ora-12504 in Oracle Forms

I got ora-12504:tns:listener was not given the SERVICE_NAME in CONNECT_DATA in Oracle Forms Builder but I can connect to same instance by SqlDeveloper!
What should change in Oracle Forms Builder?
I think you (should) have an Windows environment variable TNS_ADMIN for your current user.
In your Windows' registry, probably have a key such as [HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\KEY_OH135135763] which has two sub-key
FORMS_PATH with value C:\Oracle\Middleware\Oracle_FRHome1\forms;
and
TNS_ADMIN with value C:\Oracle\Middleware\asinst_1\config
presumed.
Add TNS_ADMIN's value at the end of the FORMS_PATH's value as
C:\Oracle\Middleware\Oracle_FRHome1\forms;C:\Oracle\Middleware\asinst_1\config
and now you should be able to connect.
Or Problem may be related to your tnsnames.ora files' syntax, you may try the following one :
mydb=
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = myproddb)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = prddb.mycompany.com)
)
)
instead of
mydb=
(DESCRIPTION =
(ADDRESS_LIST=
(ADDRESS = (PROTOCOL = TCP)(HOST = myproddb)(PORT = 1521))
)
(SERVER = DEDICATED)
(SERVICE_NAME = prddb.mycompany.com)
)
i.e. excluding (CONNECT_DATA = and including (ADDRESS_LIST= might be problematic.

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?
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.

cannot connect to oracle database with SQLPLUS via service name

I am trying to connect to an Oracle database from SQLPLUS using service_name but I received the
ORA-12154 error (ORA-12154: TNS:could not resolve the connect identifier specified.
NOTE: when I am using the SQL Developer, everything works fine.
here it is my tnsnames.ora settings:
SAMPLEDB =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = sampledb)
)
)
This is the connection command I use:
sqlplus test/password#localhost:1521/sampledb
Can someone tell me what am I doing wrong, please?
Besides the obvious (the command to start SQL*Plus is, of course, sqlplus), you are missing a line in the definition of the SAMPLEDB connect identifier.
Insert between the first and the second line the following line (EXACTLY as written below):
(DESCRIPTION =
You must have deleted it somehow.
SAMPLEDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = sampledb)
)
)

Two oracle databases on one IP

What I have:
1) Oracle 11R1 services on Local system
2) Oracle 12c services on other account
TNS listener run from oracle 11R1 (but also I've create one for 12c)
As a first solution I try
A12c =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 1.1.1.1)(PORT = 1531))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = A12c.1.1.1)
)
)
B11R1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 1.1.1.1)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = B11R1)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 1.1.1.1)(PORT = 1521))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 1.1.1.1)(PORT = 1531))
)
)
With this configuration I could connect to 11r1 (also on 1531 port !) but nt to 12c. When I setup two listener situation was same. When I run with 12c listener I could not connect to any databases.
Will be grateful for any suggestions.
Thank you

Resources