ODBC connection to oracle time-out - windows

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.

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

SQL developer : Listener refused the connection

Dear stackoverflow community,
I know this question was already asked, but I tried to find a solution and unfortunately I'm blocked since 3 days now.
I installed Oracle 12c in Linux centos 7 server. When I try to access to the Oracle DB with SQL developer I have the following error:
Listener refused the connection with following error: ORA-12514, TNS:listener does not currently know of service requested in connect descriptor
What I do not understand is that if I restart the database I can connect. But Once I disconnect a try a reconnect I got the same error. Here is my listener.ora file
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = ns3008269.ip-151-80-45.eu)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
And my tnsnames.ora is :
rspdata =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = ns3008269.ip-151-80-45.eu)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = rspdata)
)
)
oraclepdb =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = ns3008269.ip-151-80-45.eu)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = oraclepdb)
)
)
And finally you can fin in attachment a screenshot of my Installation configuration.
I tried lot of and lot of thing... but still blocked.
Hello Stackoverflow community,
I was able to solve this issue. I re-installed Oracle 12c in Linux server and I used the tools netmgr and catmgr in order to configure the listener for the global DBname and also configure the services for PDB. This will automatically will modified the listener.ora and tnsnames.ora.
So my conclusion is that when installing Oracle12c do not modify by hand the listener.ora and tnsnames.ora.
Thank you all for your help and for the tips.

Oracle forms: TNS: could not resolve the connect identifier specified

I have oracle Enterprise edition and oracle forms installed on my computer, when i connect to my database from sqlplus and sqldevelopper, it connects without errors, but when i try to connect from oracle forms, it gives me this error:
ORA-12154:could not resolve the connect identifier specified
I have looked online and i read somewhere that it might be because i have more than one oracle client installed on my computer, and the sqlplus uses the right file and oracle forms uses the one that is not right, and i think that is my case, because i have two of the tnsnames.ora file :
in here:
C:\oracle\product\10.2.0\db_1\NETWORK\ADMIN\tnsnames.ora
and in here:
C:\oracle\product\10.2.0\NETWORK\ADMIN\SAMPLE
here is the content of the first tnsnames.ora file:
# tnsnames.ora Network Configuration File: C:\oracle\product\10.2.0\db_1\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = BOUHDID.Home)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ORCL)
)
)
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)
if it's the case, how can i fix this?
You could just set the TNS_ADMIN environment variabele.
This alawys points to the tnsnames.ora directory. And all oracle products look at this variabele.
So you just have to set TNS_ADMIN to:
C:\oracle\product\10.2.0\db_1\NETWORK\ADMIN
I solved my problem by doing these steps:
uninstalled Oracle froms and reports.
uninstalled Oracle dababase with universal installer.
Deleted all the registries and services associated with oracle.
Reinstalled Oracle database.
Reinstalled oracle forms & reports.
copied from my tnsnames.ora file located in
C:\oracle\product\10.2.0\db_1\NETWORK\ADMIN to the tnsnames.ora file located in C:\orant\NET80\ADMIN
this part:
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = BOUHDID)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
and it worked like a charm.
Depending on your Oracle_Home variable config, please check if TNS entry is present in the domains folder created while installing oracle forms & reports.
Example: C:\Oracle\Middleware\Oracle_Home\user_projects\domains\base_domain\config\fmwconfig\tnsnames.ora

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

Connecting to Oracle database installed on one pc to the java application from another machine

I've installed Oracle 12c (desktop class) on my machine, and I can use it via sql developer on the same machine. Now how can I use the same database from another machine (for java application) in the LAN? I tried using the jdbc thin driver as follows: jdbc:oracle:thin:#10.0.11.69:1521:orcl where 10.0.11.69 is my ip address where Oracle is installed. Do i need to install any server where oracle is installed(10.0.11.69) to connect to my db from another machine?
I'm trying this from past 3 days and referred to many questions of the same model but none solved my issue.
My tnsnames.ora description is as follows:
LISTENER_ORCL =
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
)
)
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
Thanks in advance.
You need to connect to PDB if it is a Oracle 12c installation. You can add the following entry in tnsnames.ora:
pdborcl =
(DESCRIPTION =
(ADDRESS = (PROTOCOL=TCP)(HOST=localhost)(PORT=1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = pdborcl)
)
)
After setting this, the listener needs to be restarted.
lsnrctl stop
lsnrctl start
Then the connect string will be something like this:
jdbc:oracle:thin:#//10.0.11.69:1521/pdborcl
Note the connect string above uses service name instead of SID, because in 12C we need to use service name instead of SID to connect to PDB. Check this post for more details.
Java application will not use tnsnames.ora by it's own. You have to call:
System.setProperty("oracle.net.tns_admin", "..path to tnsnames.ora");
To tell the driver where to search for it.
Also note, that some tnsnames.ora constructs are not supported by thin driver. For examples the "include" directive.
Thanks for the following link, Configuring the connection between client and server Oracle 10g
after researching for a long time I found that I need to add my LAN address(10.0.11.69) in the listener.ora file which solves my problem.
so my listener.ora will looks like this now:
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST=
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.0.11.69)(PORT = 1521))
)
)
)

Resources