on using oracle database link theres an error "ORA-12154 TNS Could not resolve the connect identifier specified" - oracle

I'm trying to define a database link on oracle 10.2 with connection identifier that throws the error in the question header.
I have the connection identifier (service name) in my tnsnames.ora file.
I can connect with sqlplus using this service name. no problem.
This is the creation sql:
create database link dev1.REGRESS.RDBMS.DEV.US.ORACLE.COM
connect to user1 identified by pass1
using 'dev1';
select using the link:
select * from t_users#dev1;
I get: ORA-12154: TNS:could not resolve the connect identifier specified
connecting to oracle with sqlplus to the 'unidentified' service (with no problem):
sqlplus user1/pass1#dev1
I defined another link to the same database I'm woking in (loopback) - works OK.
I read and tried anything I could find about the subject but did not solve this.
Any suggestions?

Try:
create database link dev1 connect to user1 identified by pass1 using 'dev1';
Also note that a tnsnames.ora entry for dev1 has to exist on the database server that you're linking from.

Related

Trying to connect to database, getting error ORA-12154: TNS:could not resolve the connect identifier specified

I am new to oracle, I just installed oracle when I am trying to connect to the database I got this error.ORA-12154: TNS: could not resolve the connect identifier specified.
To connect onn Oracle DB you should configure the file tnsnames.ora wich define DNS to your oracle server.
After configure file, you can test your connection with tnsping DNS_NAMED_SERVER
if you never heard about tns names, you can read more on Oracle Docs https://docs.oracle.com/database/121/NETRF/tnsnames.htm#NETRF260

"ORA-12154:TNS:could not resolve the connect identifier specified" on Mac in SQL Developer

Connecting through Oracle SQL Developer(version 18.2.0.183) using wallet files(cwallet.sso and ewallet.p12) we are getting the following error “ORA-12154:TNS:could not resolve the connect identifier specified “when we test the connection via Advanced connection type in SQL Developer. We are using “jdbc:oracle:oci:/#NAME”. We are able to connect using SQLPLUS using “sqlplus /#NAME”. This is on a Mac(High Sierra) with the Instant Client Version 12.2.0.1.0.
https://www.oracle.com/technetwork/topics/intel-macsoft-096467.html
We have the TNSNAMES.ora and SQLNET.ora files configured and the wallet is set and working fine with SQLPLUS.
Is there anything we should look at to troubleshoot this further? Or any workarounds you might suggest?
Thanks,
Tom
Same advice I gave on the OTN forums -
make sure SQL Developer is reading the TNSNAMES file you think it is.
show tns
connect hr/oracle#orcl -- execute in a sqlworksheet with F5
TNS Lookup locations
--------------------
1. USER Home dir
C:\Users\jdsmith
Location used:
-------------
C:\Users\jdsmith
Available TNS Entries
---------------------
LISTENER_ORCL12C
ORCL
ORCL12C
Connected.
Connection created by CONNECT script command disconnected
If that fails, try EZCONNECT syntax
connect hr/oracle#server:port/SID
Also, there is a TNS connection type you can use. If OCI is enabled in preferences, your connection will be 'thick' and use sqlnet and tnsnames ora files.

How to find Oracle database connection details

I am new to Oracle DB and have created a new Oracle 12c database. I am creating a new connection through SQLDeveloper and where can I get the connection details? HostName? Port? SID?
I tried connecting using default details given in documentation but got the below error
Test failed: Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor>
You really need to give more info if you need help :)
What Server are you using? Linux? Windows?
Post your oratab file (/etc/oratab)
Post your TNS file ($ORACLE_HOME/network/admin/tnsnames.ora)
Post your Listener file ($ORACLE_HOME/network/admin/listener.ora)
Assuming you're using Linux :D
You need to look at the file "/etc/oratab" if you're on Linux.
This will contain your SID.
Your TNS (located in $ORACLE_HOME/network/admin/) should contain the TNS Entry with SID as per your oratab file.
This is an example entry you will find in the oratab file:
orcl:/opt/oracle/product/10.2.0/db_1:Y
The let hand side "orcl" is your SID, and you will use this for your SID in the Oracle TNS.
If you find that your TNS is configured correctly, then the error message you provided may also indicate that your Database was not registered to the Listener.
You may connect to the sql database as follows:
Set your Oracle Environment
$ . oraenv
Prompts for SID: Enter the value "orcl" (if this is your SID?)
now login:
$ sqlplus / as sysdba
This will log you into oracle as a sysdba.
Execute the follwing:
SQL> Alter System Register;
You should notice a confirmation message that the system is altered.
now exit SQLplus, and try again
SQL> exit
On Windows ISTR, to get the SID, look at the running processes and you should see something called "oracleXXX.exe" or similar. The XXX will be your SID.
You should also see a "TNS" or "Listener" process, probably with the same "XXX".
To get the port number, (usually 1521-1526), find the folder where Oracle was installed to "the "Oracle Home") and in there go to the "network\admin" folder. You should see a "listener.ora" file in there, and if you view this is notepad you should be able to figure out what the port is set to.
This file should also tell you what host/network address the listener is attaching to - you use this IP as the "Hostname" in you connection. Sometimes (again I'm a bit cloudy with Oracle on Windows) the listener.ora might be named listnereXXX.ora, with XXX matching the value you will have seen in SID the checks above.
Obviously if you are new to Oracle, do not amend these files.
If you have netstat/wireshark or similar you can see what the port is attached to the TNS/Listener process.
If you have installed it on same machine on which you are running sql-developer then
host: 127.0.0.1
port: 1521
username and password same as you put while installing oracle datatabse.
keep sid blank

Error while restoring oracle 10g .dmp file in oracle database 12c

I've got a .dmp file created with Oracle 10g containing the database of one of my clients. I can't for the life of me get it set up with my 12c installation. I can connect to my db using https://localhost:5500/em
I've created a user 'BOB' in my desired PDB and granted import, read and write permissions. Next I try to import using the following command:
impdp BOB/password#//localhost:1521/pdbname full=y directory=dpdump_dir dumpfile=BOB.dmp
However this gives me the following errors:
UDI-12541: operation generated ORACLE error 12541
ORA-12541: TNS:listener does not currently know of service requested in connect descriptor
In the listener.ora and tnsnames.ora i have EZCONNECTOR and ports 1521. Does anyone know how to get this to work?
Many thanks in advance,
Bob
First ensure that you can do tnsping for pdbname to ensure db connect :- $ tnsping bdbname
If you get details of connection string by tnsping, you can try command with following format:
impdp bob/password#127.0.0.1:1521/pdbname directory=dpdump_dir dumpfile=BOB.dmp
I have removed "full=y" as it's not required if you are not restoring full database, specially it used apply with imp/exp utility.
You should remember that pdbname is being specified as a dbname/service_name in your example. You can confirm service_name by following command:
$ lsnrctl services; /* You can get service name and put it on your impdp command. */
In addition, you can try without specifying ip,port and dbname as you are working in localhost itself:
$ impdp bob/password directory=dpdump_dir dumpfile=BOB.dmp
First of all, you should check the connection
sqlplus> BOB/password#localhost:1521/pdbname
If you cannot connect, please connect with sys / as sysdba
Then using command:
SQL> alter session set container=pdbname
SQL> alter pluggable database pdbname open
Then quit and try to your command again. :)

Error in Toad - ora 12154

I am trying to make a connection using Toad to a database (xe10 free edition) and it givea me a error:
ORA-12154
I tried changing the sqlnetORA to:
SQLNET.AUTHENTICATION_SERVICES= (NONE)
and still the same error.
1st check to make sure you can ping the database, if yes move to next step if not resolve firewall/network issues.
2nd check to see if you can connect via SQL*plus. If you can connect with SQL+ then your TNS is fine and Toad seems to be the issue, if you cannot then there is an issue with your TNS file.
Be sure to try and connect directly using the following method:
In Toad click "Session" > "New Connection"
There are 3 options TNS, Direct, LDAP (Shown as Tabs) . Select "Direct"
User: sys
Password : <passwd>
Host: 127.0.0.1
Port: 1521
Service Name: XE
Connect as: SYSDBA
If you are unable to connect via SQL+ or Toad then fix your .tns, I have attached a few helpful links below which should help resolve your problem.
http://www.dba-oracle.com/t_ora_12154_tns_resolve_service_name.htm
http://www.orafaq.com/wiki/Tnsnames.ora
try to comment the following line in sqlnet.ora
#names.default_domain = world
otherwise, Oracle will append .world to your host string
Often, it's a typographical error in your connexion string or in your tnsnames.ora file. More information here : 11g/ORA-12154.

Resources