Ruby TNS:could not resolve the connect identifier specified - ruby

I have C:\ORACLE added to my ORACLE_HOME
I have C:\ORACLE and C:\ORACLE\bin in PATH
I have C:\ORACLE\network\admin in TNS_ADMIN
I am using Ruby OCI8 to connect to remote oracle server (same effect using slqplus):
require 'oci8'
OCI8.new(#user, #password,"#{#host}:#{#port}/#{#sid}")
I get this error:
oci8.c:557:in oci8lib_300.so: ORA-12154: TNS:could not resolve the connect identifier specified (OCIError)
Under C:\ORACLE\network\admin I have tnsnames.ora as:
ORCL =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (HOST = <host>)(PORT = <port>)) )
(CONNECT_DATA =
(SID = <sid>)
)
)
My os is WINDOWS 10 x64.
Please help.
Thanks

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"
)

Unable to connect to pdb from sql developer while cdb is getting connected Oracle 19c

I have recently installed Oracle 19c enterprise edition on Virtual box with host as windows 10 while guest machine in Linux Oracle.
I am able to connect to CDB database both from sqlplus(Installed on Virtualbox i.e. guest machine) and SQLDeveloper installed on windows 10.
But I am unable to connect to PDB database from SQL Developer while I am able to connect it from SQL PLUS i.e. from guest machine using export ORACLE_PDB_SID=testpdb1
In SQLDeveloper I am getting below error message.
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
(CONNECTION_ID=+zZy85nyTtSOaamzG3UnBw==)
When using the service name raido button below error message apprears:
Status : Failure -Test failed: Listener refused the connection with the following error:
ORA-12514, TNS:listener does not currently know of service requested in connect descriptor
(CONNECTION_ID=H5R80kOxSAy+Cv74InS7MQ==)
Below are my Listener.ora and Tnsnames.ora
testcdb =
(ADDRESS_LIST=
# (ADDRESS=(PROTOCOL=tcp)(HOST=atif.localdomain)(PORT=1521))
(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.29.71)(PORT=1521))
# (ADDRESS=(PROTOCOL=tcp)(HOST=atif)(PORT=1521))
# (ADDRESS=(PROTOCOL=ipc)(KEY=PNPKEY))
)
# SID_LIST_<lsnr>
# List of services the listener knows about and can connect
# clients to. There is no default. See the Net8 Administrator's
# Guide for more information.
#
SID_LIST_testcdb=
(SID_LIST=
(SID_DESC=
# #BEQUEATH CONFIG
# (GLOBAL_DBNAME=salesdb.mycompany)
(SID_NAME=testcdb)
(ORACLE_HOME=/f01/app/oracle/product/19.3)
# #PRESPAWN CONFIG
# (PRESPAWN_MAX=20)
# (PRESPAWN_LIST=
# (PRESPAWN_DESC=(PROTOCOL=tcp)(POOL_SIZE=2)(TIMEOUT=1))
# )
)
)
STARTUP_WAIT_TIME_testcdb=0
CONNECT_TIMEOUT_testcdb=10
TRACE_LEVEL_testcdb=OFF
LOG_DIRECTORY_testcdb=/f01/app/oracle/product/19.3/network/admin
LOG_FILE_testcdb=testcdb
TRACE_DIRECTORY_testcdb=/f01/app/oracle/product/19.3/network/admin
TRACE_FILE_testcdb=testcdb
ADMIN_RESTRICTIONS_testcdb=ON
SUBSCRIBE_FOR_NODE_DOWN_EVENT_testcdb=OFF
Tnsnames.ora
testcdb =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.29.71)(PORT = 1521))
# (ADDRESS = (PROTOCOL = TCP)(HOST = atif)(PORT = 1521)
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = testcdb)
# (INSTANCE_NAME = testcdb)
)
)
testpdb1 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.29.71)(PORT = 1521))
# (ADDRESS = (PROTOCOL = TCP)(HOST = atif)(PORT = 1521)
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = testpdb1)
# (INSTANCE_NAME = testcdb)
)
)
You MUST use the PDB service name when connecting to a multi-tenanted pluggable database.
The SID will also be used to go back to a Container Database.
Change your radio button to 'Service Name' from 'SID'

TNS:could not resolve the connect identifier specified at OCI call OCIServerAttach

I am working on OBIEE-12c. My db is also Oracle-12c. During repository creation i am getting following error.
[nQsError:17014] Could not connect to Oracle database.
[nQsError:17001] Oracle Error code: 12154, message: ORA-12154:
TNS:could not resolve the connect identifier specified
at OCI call OCIServerAttach.
Have you tried writing the full connection string, as it appears in the tnsnames.ora file, instead of just the name??
Instead of writing pdborcl write:
(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))(CONNECT_DATA = (SERVER = DEDICATED)(SERVICE_NAME = pdborcl))
)
Or whatever your connect string looks like.
I'm not sure why that happens but i couldn't make my work until I did that.
to resolve the issue, try the following
(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))(CONNECT_DATA = (SERVER = DEDICATED)(SERVICE_NAME = <what ever SID you specified>)))
log : anonymous
P/w : < the password you specified when creating the Database>

BizTalk ORA-12154: TNS:could not resolve the connect identifier specified

I am having issue with the new TNS connection. I have added the below code in to the tnsnames.ora file. I can verify the connection using the SQL Oracle developer, it is perfect.
c0xlxx =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = xxxxxxxxx)(PORT=xxxxxxxxx))
)
(CONNECT_DATA =
(SERVICE_NAME = xxxxxxx )
)
)
I did the sameway in the BizTalk application dev environment, it is working perfectly.But when I use in the BizTalk application in test environment using WCF-Custom adapter for OracleDBBinding with URI oracledb://c0xlxx/ it is throwing error
The adapter failed to transmit message going to send port "WcfSendPort_LTMDBBindingtoAX_View_VW_JOB_DEPT_Custom" with URL "oracledb://c0xlxx/". It will be retransmitted after the retry interval specified for this Send Port. Details:"Microsoft.ServiceModel.Channels.Common.ConnectionException: ORA-12154: TNS:could not resolve the connect identifier specified ---> Oracle.DataAccess.Client.OracleException: ORA-12154: TNS:could not resolve the connect identifier specified Help me out.
Have some diferent properties to conection strings on TNS, you must need to seek the correct for your situation Example:
xxxxxx =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = xxxx)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = xxxx)
(SID = xxxx)
)
)
Can you send a properties who you entered to connect in SQL Oracle developer. Are you sure if you connect over TNS protocol in SQL Oracle developer
Try tnsping on windows cmd, command tnsping servername yours is c0xlxx. This command look like a ping, but its for oracle db server ping

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