Unable to connect to my local Oracle database through Oracle SQL Developer - oracle

Unable to connect to my local Oracle 21c database using Oracle SQL Developer. Until now everything was fine. I set up tnsnames.ora as suggested:
my_test_database =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orclpdb)
)
)
I also could connect to my database using sqlplus \ as sysdba command. But every attempt to connect to my database (SYS user) through SQL Developer Error appears 12514 TNS: listener does not currently know of service. I am very grateful for any assistance.

Related

'TNS:could not resolve the connect identifier specified' when connecting to oracle instance through cx_Oracle

I have an Oracle instance on a AWS EC2 instance. When I run this in the AWS linux terminal, it is successful.
ubuntu#ip-xxx-xx-xx-xxx:~$ sqlplus user101/pass101#ip-xxx-xx-xx-xxx:1521/XE
However, when I run the same arguments when connecting through cx_Oracle I get a:
"ORA-12154: TNS:could not resolve the connect identifier specified" error
I know some common problems are with the tnsnames.ora file. I've placed that below.
XE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = ip-172-xx-xx-xx)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = XE)
)
)
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC_FOR_XE))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)
~
At the moment the full Easy Connect syntax is being interpreted as a TNS entry.
According to the Connect() documentation, you can use your current code if you specify that you are passing the user argument:
If the user parameter is passed and the password and dsn parameters are not passed, the user parameter is assumed to be a connect string in the format user/password#dsn, the same format accepted by Oracle applications such as SQL*Plus.
So this should work:
connection = cx_oracle.Connect(user="user101/pass101#ip-172-xx-xx-xx:1521/XE")
According to the Oracle connection handling documentation, you could also split that out:
connection = cx_oracle.Connect(
user="user101",
password="pass101",
dsn="ip-172-xx-xx-xx:1521/XE",
encoding="UTF-8"
)
Or if you want to use tnsnames.ora then just give that alias as the DSN value:
connection = cx_oracle.Connect(
user="user101",
password="pass101",
dsn="XE",
encoding="UTF-8"
)

Able to connect to Databse using TNS alias but NOT using service name

I am to trying connect to a database using TNS, and I am able to connect successfully using an alias:
sqlplus user/password#UHKGLXXX
However, when I connect to same database using the service name, I get the below error:
sqlplus user/password#pl0676o.hk.bbc:2006/UHKGLXXX.hk.bbc
ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
Can someone please help me out with this.
Below is the TNSNAMES entry :
UHKGLXXX =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = pl0676o.hk.bbc)(PORT = 2006))
)
(CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = UHKGLXXX.hk.bbc)
)
)
LISTENER_UHKGLXXX = (ADDRESS = (PROTOCOL = TCP)(HOST = pl0676o.hk.bbc)(PORT = 2006))
Have a look at your sqlnet.ora file.
Maybe it contains:
NAMES.DIRECTORY_PATH = (TNSNAMES)
This only allows for TNSNAMES alias use.
Change this to:
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)

Why I have to use tnsnames.ora in Oracle SQL Developer to connect some database

when I log on some oracle database, I can connect without tnsnames.ora. However, when I try to log on some other database, it reject because of TNS:connection timeout. What is changed? What does TNS file do? Why I have to have this ora file?
Thank you
File tnsnames.ora just resolves your database alias to full databases address.
Assume you have an entry as this:
ORA11 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.0)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = ORA12)
)
)
Then you can start for example SQL*Plus
sqlplus SCOTT#ORA11
or
sqlplus SCOTT#"(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.0)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=ORA12)))"
It does the same, the first way is just more convenient.

Getting Error: Listener currently does not know given SID when using SQL Developer

Please see screenshot:
I was successfully connected using SQL*Plus.
But when I trying to connect same database using same user using SQL Developer, then I'm getting error. Anyone have any idea ? I see all services running fine.
tnsnames.ora
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
Write
orcl in SID, not service name.
I think it will be good idea :)

ODBC connection to oracle time-out

I'm new here so I introduce myself, my name is Ettore Giallaurito and my job is in the IT services in Italy.
My question:
I'm trying to connect to an Oracle DB instance through an odbc (System DNS) connections under XP but I get an error ORA1254 TNS:could not resolvethe connect identifier specified.
I'm using oracle instant client 11.2 and I've my tnsnames properly configured, since I can get connected with DBVisualizer using the TNS method.
To be honest I do get connected in this case, but I need to insert the full connect string:
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = repsit01.sit.sor)(PORT = 1521))
(CONNECT_DATA = (SERVICE_NAME = REPSIT01))
)
since it doesn't get me in if I use just the SID, in my case REPSIT01 as showed below.
My tns entry is as follow:
REPSIT01 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.1)(PORT = 1521))
(CONNECT_DATA = (SERVICE_NAME = REPSIT01))
)
Any help would be much apprecciated.
Thanks in advance Ettore.
Try setting the environment variable TNS_ADMIN to the directory where your tnsnames.ora file resides.

Resources