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

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>

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 user from SQL Developer to AWS RDS

I tried to connect to an AWS RDS that I created. I used SQL Developer to add the connection. I used the default SYSTEM user of Oracle. I have configured my tnsnames and listener files by adding the following entries.
LISTENER
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1522))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1522))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = final.c3ixwyhkuph6.ap-south-1.rds.amazonaws.com)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1522))
)
)
TNSNAMES
FINAL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 'final.c3ixwyhkuph6.ap-south-1.rds.amazonaws.com')(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = final)
)
)
LISTENER_FINAL =
(ADDRESS = (PROTOCOL = TCP)(HOST = final.c3ixwyhkuph6.ap-south-1.rds.amazonaws.com)(PORT = 1521))
As you can see from this screenshot
AWS RDS Description Screenshot
the hostname is 'final.c3ixwyhkuph6.ap-south-1.rds.amazonaws.com', and the port number is 1521. Also, the SID here is 'final'. These have been added correctly by my above TNSNAMES and LISTENER entries.
However when I attempt to connect, I get the following
Error on SQL Developer
Status Failure -Test failed: IO Error: The Network Adapter could not establish the connection.
What could be the source of the error?
Make sure that your SID in SQL Developer is your database name on AWS and that you are using the correct username. In your screenshot, you have it as SYSTEM but the default username on AWS is admin. Go to the Configuration page in AWS and verify the highlighted portions in the screenshot below:
Assuming your DB Name in your Configuration page above is indeed "final", you should be selecting the SID option instead of Service name in SQL Developer, and inputting "final" as demonstrated in the snippet below.

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)

JDBC Connection failing with ORA-12505 on Win8, Oracle 11g XE

I'm having an error that goes beyond what I see in TNS-12505: TNS:listener does not currently know of SID given in connect descriptor
I'm using Windows 8, Oracle 11.2 XE, java 1.7.15, and Eclipse Juno SR2.
The error I receive is:
java.sql.SQLException: Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
I have the driver registered properly, and I've edited the listener.ora to make the service explicit, in both ways I've seen given as exampled - under SID_LIST_LISTENER, I added:
(SID_DESC =
(SID_NAME = XE)
(ORACLE_HOME = C:\oraclexe\app\oracle\product\11.2.0\server)
)
and under LISTENER = (DESCRIPTION_LIST I added
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = XE)
)
tnsnames.ora contains, as its first entry:
XE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = XE)
)
)
The source code making the calls is:
Class.forName(JDBC_DRIVER);
String connectionString = "jdbc:oracle:thin:localhost:1521/XE";
myConnection = DriverManager.getConnection(connectionString, "myuser", "myuserpw");
I've also been through the following permutations on the connectionString. with results noted here:
jdbc:oracle:thin:#localhost:1521:XE // java.sql.SQLException: ORA-01017: invalid username/password; logon denied
jdbc:oracle:thin:localhost:1521:XE // error ORA 12505
jdbc:oracle:thin:#//localhost:1521:XE // error java.sql.SQLRecoverableException: IO Error: The Network Adapter could not establish the connection
jdbc:oracle:thin:#localhost:1521/XE // error ORA-01017
jdbc:oracle:thin:#//localhost:1521/XE // error ORA-01017
Anyone have ideas?
I have an Answer! (Bloody-minded stubbornness is its own reward, I guess)
I changed which Connection call I made and restructured the connection string thataway, as in:
String connectionString = "jdbc:oracle:thin:myuser/mypw#localhost:1521:XE";
myConnection = DriverManager.getConnection(connectionString);
THAT works! Now the next guy can Google it. The version of the call with three parameters blows up every time I try it, but the same fundamental string with the username/pw embedded works in the single-parameter call.
I believe this is a bug in the driver provided with the XE database - oh Oracle, will you let us know?
OPEN cmd
execute the lsnrctl command.
Type start in the LSNRCTL> prompt.

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