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

The issue started when i installed the server version with already existing client version of Oracle 10g.
Background : The Oracle client version 10g was installed (at c:/oracle) to connect to a database residing in other country. So we can just connect to it and have limited access to it.
Path => c:/oracle/ora_client/network/admin/listener.ora
So to work as admin I installed 10g server at the same location c:/oracle on windows. I can now work as server.
Path => c:/oracle/product/db_1/network/admin/listener.ora
But the issue arises when I try to connect with my application installed to setup connection as a client (to server residing in other country), it fails and throws an error ORA-12154.
So, do I have to uninstall my server version (just in case the confusion might have arrived due to the presence of two Oracle databases)?
How can I fix it? What has been the probable cause for it? Please advise!

When you installed the server version it updated the environment variables to point to the server installation and not the client installation. The definition of TNS aliases is done in tnsnames.ora and no the listener.ora. So you would have to copy the already existing entries from c:/oracle/ora_client/network/admin/tnsnames.ora to c:/oracle/product/db_1/network/admin/tnsnames.ora. Be careful that you obey the tnsnames.ora format.

I faced this error today. Spent a lot of time checking what I did wrong while configuring listener. Even after I configured it using netca I still had the same error:
ORA-12154: TNS:could not resolve the connect identifier specified
It appeared that the cause was bad password for sys containing '#' character.
For example when you connect as below:
$sqlplus sys as sysdba
The response is
SQL*Plus: Release 11.2.0.4.0 Production on Wed May 27 08:24:19 2015
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Enter password: ple#se ERROR: ORA-12154: TNS:could not resolve the
connect identifier specified
That is it. Very easy case.

Related

Connect to Oracle 19C Cloud from sqlplus

I am not able to connect to my Oracle 19C Cloud DB, I have downloaded the wallet and placed it in a secured place in my machine(windows).
I have installed Oracle 19C Client in my machine,
and updated tnsnames.ora(network/admin) with connection strings from wallet zip,
Not sure how whether I have missed any config like Environment variables
Getting below error from sqlplus
ERROR:
ORA-12154: TNS:could not resolve the connect identifier specified
Note: I am able to connect to Cloud from Sql developer using the wallet file.
And I have Oracle 18c XE running in my machine.
Any help will be appreciated, thanks in advance.
Your problem seems to be related with the issue that you have an Oracle XE database version installed in your own laptop.
When you run sqlplus or any other OCI tool to connect to Oracle, no matter whether the database is a remote host or in the cloud, sqlplus evaluates the TNS_ADMIN environment variable to identify where your sqlnet and tnsnames files are located. If there is no variable, it uses the default values of your main Oracle registry entries, that for sure point to your XE version, as it was installed before.
When you get ORA-12154: TNS:could not resolve the connect identifier specified , your session is not finding any information regarding the target in your configuration files, probably because the session is evaluating the files in your XE installation
Try to do the following
Copy the wallet files provided by your Oracle Cloud to a location different to your XE installation.
Export the TNS_ADMIN variable in your sqlplus cmd session to this new path
Run sqlplus using wallet
Example ( I believe you did points 1 and 2 )
Install Oracle Client software on your computer. Use either the full
Oracle Database Client 11.2.0.4 (or higher) or the Oracle Instant
Client 12.1.0.2 (or higher). The Instant Client contains the minimal
software needed to make an Oracle Call Interface connection. The
Instant Client 12.1.0.2 (or higher) is sufficient for most
applications.
Download client credentials and store the file in a secure folder on
your client computer. See Download Client Credentials (Wallets).
Unzip/uncompress the credentials file into a secure folder on your client computer.
Edit the sqlnet.ora file in the folder where you unzip the
credentials file, replacing "?/network/admin" with the name of the
folder containing the client credentials.
Example
WALLET_LOCATION = (SOURCE = (METHOD = file) (METHOD_DATA = (DIRECTORY="/my_new_path")))
SSL_SERVER_DN_MATCH=yes
cmd> set tns_admin = my_new_path
cmd> sqlplus /#yourtnsentry
I don't know whether your cloud database is using a Public IP address or not, or if you want to use SSH tunneling to connect to the database. Take a look here, because then you might want to use SQLcl ( Sql Developer Command Line )
https://docs.cloud.oracle.com/en-us/iaas/Content/Database/Tasks/connectingDB.htm

Can't connect to local MySQL server through socket tmp/mysql.sock

Having just tried to access some mysqladmin privileges within terminal (flush_hosts), I have noticed that the socket problem has resurfaced with the error
Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)*.
I have no servers running currently.
How can this be solved?
Wow, yourself mentioned, you 'must' run a server that can to connect it,Please consider:
root#debian:/etc/init.d# /etc/init.d/mysql stop
[ ok ] Stopping MySQL database server: mysqld.
root#debian:/etc/init.d# mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
root#debian:/etc/init.d# /etc/init.d/mysql start
[ ok ] Starting MySQL database server: mysqld ..
[info] Checking for tables which need an upgrade, are corrupt or were
not closed cleanly..
root#debian:/etc/init.d# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 37
Server version: 5.5.24-5 (Debian)
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
OK, it appears that there must have been some messed up configurations along the way. I went back to scratch and installed the latest .DMG for MySQL and everything is working fine now. If you have .sock issues I'm guessing your best bet is to reinstall MySQL, it doesn't take very long at all. Thanks for the help!
try removing socket field in the database.yml file or change it with the right path to mysql.sock if you know where it is in you machine.

How to connect to newly installed Oracle XE instance?

I have installed Oracle XE on Win7 x64 machine. Installation completed successfully without problem, or perhaps installer didn't tell about them. But after installation I can't connect to database; its web interface is not working. I have looked through list of open ports, and there is no 8080 port as was noted during installation. Also I can't connect via SQLPlus.
SQL> connect SYSTEM
Enter password:
ERROR:
ORA-12638: Credential retrieval failed
Somewhere in the web it was told to edit sqlnet.ora file, I have changed it in the following way:
# SQLNET.AUTHENTICATION_SERVICES = (NTS)
SQLNET.AUTHENTICATION_SERVICES = (NONE)
and now I get next error
SQL> connect SYSTEM
Enter password:
ERROR:
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
What do I need to change so that I can connect to it?
I figured out the issue.
I was using domain login to install Oracle XE. If you are using domain login to install Oracle XE then the database creation will fail (though you may not get any error messages on that regard).
Solution:
Install Oracle using a local admin user.
Change SQLNET.AUTHENTICATION_SERVICES to (NONE) in sqlnet.ora.
Now login with your domain user to use oracle XE.
Check the Oracle services are started
Did you set your ORACLE_SID environment variable to the name of the instance you're connecting to?
Make sure oracle service is started.
did to ran netca after installation? - if not you can ran it from cmd
You can't connect using system if the instacne is down only as sysdba (user sys)
Make sure your ORACLE_HOME,ORACLE_SID,PATH environment variables are ok
If everything was ok then you can try to start/connect to the instance manually
Sample:
C:\Documents and Settings\asafm>
C:\Documents and Settings\asafm>
C:\Documents and Settings\asafm>sqlplus "sys as sysdba"
SQL*Plus: Release 11.2.0.1.0 Production on Fri May 11 16:21:42
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Enter password:
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 535662592 bytes
Fixed Size 1375792 bytes
Variable Size 360710608 bytes
Database Buffers 167772160 bytes
Redo Buffers 5804032 bytes
Database mounted.
Database opened.
SQL>
SQL>
SQL>select status from v$instance;
As Rejeev Divakaran said, installing oracle XE with local windows user, and switching back to domain user account, started db, able to connect.
Config
Office Laptop
Windows 7 64 Bit
Oracle 11g XE
Can you connect this way from the command line:
sqlplus / as sysdba
if so at the SQL prompt enter
SQL>startup
If the command returns ok then try to connect with a username and password.
This error message usually occurs when the database could not be started. The windows service may be running, but still Oracle might not be able to spawn server threads and hand out client connections.
Have a Look into app\oracle\admin\xe\bdump\alert_xe.log for any error messages during the last start of the Oracle service.
Just in case someone is as "lucky" as me: I recently couldn't install Oracle with a local user (as suggested here before) because the target machine (Win2k8 x64) was also the Domain Controller of that network.
All users were in domain - no local users available :(
Here are the steps I performed:
Installed Oracle XE in my local machine (that works fine). Made a backup (using the built-in backup.bat);
Transferred the fast_recovery_area folder to my target machine;
Installed the Oracle XE in the target machine normally;
Edited the %ORA_HOME%\network\admin\sqlnet.ora file and performed this well-known edit:
SQLNET.AUTHENTICATION_SERVICES= (NONE)
Edited the %ORA_HOME%\bin\restore.bat file:
Replaced every entry rman target / (...) by rman target sys/MySysDbaPass (...)
Replaced every entry (...) connect / as sysdba^; by (...) connect sys/MySysDbaPass as sysdba^;
Runned restore.bat - when prompted, pointed to the fast_recovery_area I've transferred before.
Done! (pheew!)
Sorry for answering this YEARS old question, but I managed to make it work...
Make sqlnet.ora change.
Run StopDB.bat
Run MakeDB.bat
This will create a demo database, reset the password to 'oracle', and will also allow you to connect without error.

ODBC Oracle Connection error from MS Access

I currently support an MS Access database that has linked connections using the Microsoft ODBC Driver for Oracle. I can connect to the current linked tables without any issues, but we are required for security reasons to change the password on the account accessing the Server.
I have changed the password successfully but now when I attempt to relink the tables I get the error:
ODBC--call failed
Microsoft ODBC driver for ORacle ORA-12154: TNS could not resolve service name
These tables are part of a critical application and now we can't connect. Any suggestions on how to resolve this?
The ORA-12154 error indicates that you are specifying a TNS alias that is not resolving. Are you using a DSN for your connection to Oracle? If so, what is the TNS alias you're specifying there? Does that alias exist in your tnsnames.ora file? Are there multiple tnsnames.ora files on the client?
The tnsnames.ora file is on the client machine where Access is installed. Without knowing what version of the Oracle client is installed, the simplest way to find out which tnsnames.ora file is being used is probably to open up a DOS prompt and type "tnsping service_name" where `service_name" is whatever TNS alias is specified in your DSN. You'll get something like
C:\Users\jcave>tnsping fuddy_duddy
TNS Ping Utility for 64-bit Windows: Version 11.2.0.1.0 - Production on 07-OCT-2
010 08:10:51
Copyright (c) 1997, 2010, Oracle. All rights reserved.
Used parameter files:
C:\oracle\product\11.1.0\db_1\NETWORK\ADMIN\sqlnet.ora
TNS-03505: Failed to resolve name
The "Used parameter files" line tells you the directory where the TNS related files are stored. There should be a tnsnames.ora and a sqlnet.ora file in that directory.

unable to import dump using "imp"

I am trying to import into oracle using imp command and the output of the command is as below.
invincible:/home/invincible# imp
Import: Release 10.2.0.1.0 - Production on Thu Aug 12 22:19:00 2010
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Username: n_data
Password:
IMP-00058: ORACLE error 1034 encountered
ORA-01034: ORACLE not available
ORA-27123: unable to attach to shared memory segment
Linux Error: 13: Permission denied
IMP-00005: all allowable logon attempts failed
IMP-00000: Import terminated unsuccessfully
invincible:/home/invincible#
user name and password are correct(I am able to connect using sqldeveloper). I have granted dba access to n_data. All the environment variables are set (I ran oracle_env.sh before running env ). So what might be the problem? I am running oracle on debian.
Check this blog post: ORA-27123: unable to attach to shared memory segment.
It describes same error as you have and problem was caused with incorrectly set permissions on oracle executable.
This is excerpt from the above blog post:
Here the oracle file permission has
-rwxrwxr-x i.e. 775, but this file must have the permission -rwsr-s- -x
i.e. 6751
Change the permissions for oracle
file.
$ cd $ORACLE_HOME/bin
$ chmod 6751 oracle
$ ls -l oracle
-rwsr-s--x 1 oracle dba 119582976 Feb 3 2008 oracle
After changing the permissions on
oracle executable file, all the users
are now able to connect to the
database without any errors.
Read blog post for detailed information.
The error suggests it is trying to connect to an instance on the same host that isn't there. Generally I'd say the database isn't actually up and running, but if you can connect with SQL Developer, it suggests it is. But check you are on the correct machine.
Also try
echo :${ORACLE_SID}:
There may be some stray character in the SID. If you are using XE, you want to see :XE: (in upper case, not mixed or lower)
Have you tried
imp n_data/password#XE

Resources