TNS:could not resolve the connect identifier - oracle

I am very new to this
I install oracle in Linux machine with orcl service
And created one mmsc user. If I am not login with mmsc user and try to connect sqlplus with the command, "sqlplus mmsc/mmsc" and "sqlplus mmsc/mmsc#orcl" Then listener is working for both the option.
But after login to mmsc user,
listener is working for "sqlplus mmsc/mmsc" but not working for "sqlplus mmsc/mmsc#orcl".
Please help me to solve this issue.
Thanks in Advance
Regards
Sankar

The problem is that the client does not find the tnsnames.ora file. The file is generally located in the directory $ORACLE_HOME/network/admin. To find the file it is the best to set the environment variable TNS_ADMIN to point to that directory. This of course requires that the mmsc user has read permissions in that directory.

Related

Default username and password for SQL*Plus in Ubuntu 14.04?

I followed the instructions mentioned to install SQL*Plus from Oracle Instant Client and How to Install SQLPlus.
SQL*Plus is successfully installed on my system but I cannot login and use it. There is a similar question here and here, but it is does not solve my problem.
On googling, most sources said that we enter a password upon installation, but I was neither prompted nor displayed any password. (I can attach terminal screen shots if it is required)
Is there any way I can login and start using SQL*Plus? Is there any default username or password?
I am stuck here: sqlplus username/password#//dbhost:1521/SID
I need a valid username and password. scott/tiger was of no help.
sqlplus / as sysdba gives this -> ERROR: ORA-12162: TNS:net service name is incorrectly specified and prompts me to enter username and password which I don't have.
I originally asked this question on AskUbuntu feeling its more appropriate there. If this question does not belong here, please comment and I will remove it.
EDIT:
I executed these statements after reading from here:
ORACLE_HOME=/u01/oracle; export ORACLE_HOME
ORACLE_SID=asdb; export ORACLE_SID
Now, On executing sqlplus / as sysdba I get the error message
ERROR: ORA-12545: Connect failed because target host or object does not exist
On executing sqlplus64 scott/tiger#//dbhost:1521/SID I get the error message
ERROR: ORA-12154: TNS:could not resolve the connect identifier specified
It does not have anything to do with Ubuntu. When you enter sqlplus / as sysdba sqlplus tries to connect to the local database, which sid and oracle home should be specified by the environment variables ORACLE_SID and ORACLE_HOME. You, obviously, have not defined these variables.
All you need is to get the username, password, host name, where your database is located, port for the listener (the default port is 1521) and the Oracle SID. Then connect with sqlplus username/password#//dbhost:1521/SID. If you know the password for SYS user and have orapwSID file in the $ORACLE_HOME/dbs directory on the server side, you can connect with sys with the following command: sqlplus sys/password#//dbhost:1521/SID as sysdba.
moving everything into instant_client_11_* directory worked for me.

How can I solve "Got minus one from a read call" in oracle sql developer?

When I run the sql developer and set the all data,click the connect but i get this error:
Status : Failure -Test failed: IO Error: Got minus one from a read call
I am beginner in Oracle. How can I solve that error?
I use 64-bit Windows7 and oracle 12c.
In my case the error is connected to a problem about the client's (SQL Developer) ojdbc8 driver and the Oracle 19.3 docker container. The solution for me was to set a system property on the client -- you can do it within the JDBC connection string):
jdbc:oracle:thin:#tcp://host:port/service?oracle.net.disableOob=true
This is the thread that lead me to the answer.
The cause of the error is described here:
https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=357910144923387
You can also solve this problem by dissabling OOB on server side in the sqlnet.ora:
DISABLE_OOB=ON
Another workaround is to use the ojdbc7 driver.
Hope this helps some of us.
From your inputs in the dialog, you are using port 5500. That port is what is used for EM Express. It answers to HTTPs traffic only. So in this case the -1 error message means the protocol negotiation failed. SQLDEV is trying to talk SQL*NET to something listening for HTTPs.
The port you are looking for is 1521 if it wasn't altered. If it was check the $ORACLE_HOME/network/admin/listener.ora for the proper port number.
You need set "tcp.validnode_checking = no" or comment this parameter in sqlnet.ora file then restart listener on db server and test again.
Try it.
I got the same issue but following steps worked for me, it seems Gaurav also has shared it already:
1.Go to the folder where you have installed the database (Like: F:\app)
2.Here you will be able to see many folders, go to product\11.2.0("your databse version")\dbhome_1\NETWORK\ADMIN
3.find listener.ora file and open as text file
4.Check for the port number in that file
5.Now provide that port number while doing connection in sql developer.
Seems you have enabled ACL on the listener.
You can follow these steps to avoid the error:
1. Go to directory $ORACLE_HOME/network/admin
2. Modify sqlnet.ora file with following parameter:
tcp.validnode_checking = no
3. If you don't want to disable this, you can put the machine names as follows:
tcp.invited_nodes=(machine1, machine2)
3. Bounce the listener.
Hope that helps
Ensure the DB is up and running and you can connect locally AS SYSDBA to the database using Oracle binaries owner (usually oracle:oinstall Unix / Linux user). If it does not work, probably you encounter a different problem.
Check privileges of an Oracle file on Unix / Linux host where database is running:
cd $ORACLE_HOME/bin
ls -ltr oracle
-rwxr-xr-x 1 oracle oinstall 136803483 Mar 16 20:32 oracle
Change permissions as below:
chmod 6751 oracle
ls -ltr oracle
-rwsr-s--x 1 oracle oinstall 136803483 Mar 16 20:32 oracle
Most of the answers out there for this problem point to using the wrong PORT number in your connection options, or similar. In my case, after a couple hours of searching, the reason showed to be something else.
Mind which user you are using when starting Oracle listener. You should do it with the oracle user, not as root. Otherwise you end up with listener files being created as e.g. user deamon group root instead of user oracle group dba. This in turn leads to:
TNS-12555: TNS:permission denied
TNS-12560: TNS:protocol adapter error
TNS-00525: Insufficient privilege for operation
Linux Error: 1: Operation not permitted
To check whether this is the case, go to
/var/tmp/.oracle
and list all files (ls -la). If you find out some of the s#* files being created by a root-group user, stop the listener (lsnrctl stop), delete the above files as root and restart the listener as oracle user.
Unfortunately sqldeveloper doesn't show the full stack-trace when reading "Got minus one from a read call". I could find the problem thanks to switching to SQL-Squirrel.
In my case, I was given wrong host and port. I typed "tnsping yourServiceName" in command line in window 10. It returns a different host and port, then I used the correct one in sql developer and it worked.
In my case, it happened when I was using Docker with Oracle 19C.
The workaround is to find the listener.ora file, change 'PORT' and restart the container, ORACLE DB, listener.
It is presumed to be an error that occurred when the host tried to access TCP because it was already LISENT (HOST) by another process.
(When accessing Docker, consider that in most cases, you are accessing localhost.)
I changed the port to 1523, and all the problems were solved.
Try to do what the link , or check listener directory permission, or use command /dbhome/bin/relink all
Try
Connection name: HR_ORCL
Username: HR ,
Password: hr ,
Connection type : local,
Role: SYSDBA
Click on connect.
It will work.
Actually, It is not database specific issue. it is related to port value generated by database during your installation. To overcome on this issue, please follow below.
Go to the folder where you have installed the database (Like: F:\app)
Here you will be able to see many folders, go to product\11.2.0("your databse version")\dbhome_1\NETWORK\ADMIN
find listener.ora file and open as text file
Check for the port number in that file
Now provide that port number while doing connection in sql developer.
Hope it will resolve your issue.

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

oracle listener supports no service

I am having trouble with my Oracle instance.
I get the following error when I run lsnrctl stat in command prompt. I even confirmed Oracle services running.
The listener supports no services.
I assume the platform is Windows and the Oracle version is 11g.
When an Oracle database instance starts, it tries to register itself to the default listener or to the listener registered in the init parameters as the local_listener. What you can do is
make sure that your local_listener parameter points to your listener
make sure that your listener runs on localhost port 1521 (using the listener.ora file)
This is when the database is using a dynamic listener. You could also make the listener a static one by entering the instance details in the listener.ora file. Docu about the listener.ora is found here Oracle Net Listener Parameters (listener.ora)
when the listener is created after creation of database,we need to explicitly register our instance.
try:
starting database by doing startup and check the listerner status by lsnrctl status and it your instance is running it means pmon has done registering your instance with the listener itself.
A solution is very simple for this error, first, let's understand why this error occurs. It basically has two reasons which are:
1) Your database and service name is not properly set in Oracle environment it should be same everywhere check below parameter values
-ORACLE_SID in oracle environment.
-Check Database Instance name.
-SID_NAME in tnsnames.ora file.
-SERVICE_NAME in listener.ora file.
2) Host name/IP address is missing, not correct or spelling mistake, so please check the below.
-Check the IP ADDRESS in /etc/hosts file.
-It should be same in listener.ora and tnsnames.ora file
-And it should be able to ping from the local and remote server.
Now see I've also faced the same problem and resolved:
please visit this StackOverflow link:
https://stackoverflow.com/a/45065640/6332029
I hope it will help, thanks!
In my case it was easy - for some reason, after restarting my laptop, services stopped working.
So, Run > services > start OracleService helped to start the listener
I had this problem with the latest Oracle 19c version with CentOS 8 installation.
So there is a bug with this Oracle DB instance.
What happens: When you install the ORACLE DB, it automatically creates the listener with an instance. The problem exist in the Hierarchy File System of Linux and how the permission is distributed between the Sudo User group and the non-oracle User.
What you have to do :
Okay to solve this, you have to open your bash profile
***nano ~/.bash_profile***
this is equivalent to environment variables in Windows.
write text in editor: export ORACLE_HOME=/u01/app/oracle/product/{oracle-version}/dbhome_1
Save & Exit
Execute: export ORACLE_HOME=/u01/app/oracle/product/{oracle-version}/dbhome_1
test the environment variable :
Echo $ORACLE_HOME -- should display result
execute chmod 777 /home
execute chown -R oracle /home
open terminal su oracle && cd /u01/app/oracle/product/{oracle-version}/dbhome_1/bin
with oracle account execute ./lsnrctl start -- it should run with no services still
execute: su {root account} && sudo ./dbstart
it should run run with 1 or 2 error.. its fine as long as it doesn't say "ORACLE_HOME is not set"
go back to execute: su oracle && ./lsnrctl status with non root account
That's it.. it should now connect with your service and handler, should give the instance of your db name to connect with. You can use the sys as sysdba and password during installation to log into the database.
After starting the listener service I had to wait 60 seconds before the services would show up as running. So if you enter "lsnrctl stop" followed by "lsnrctl start" you might have to wait a minute before "lsnrctl status" will show your listener services.
I did check all the things but could not find the cause. So I re-installed the Oracle and using that now.

Oracle Pro*C ORA-12547

I'm working on re-compiling some Pro*C code that no one currently at my company has ever compiled. It's compiling OK, but when I copy it to the production server and run it I'm getting Oracle error ORA-12547 (TNS: lost contact)
Any ideas?
Oh, figured it out. :-)
The C executable isn't run directly on the server, but launched through a script that sets up the connection environment. i.e. something like this:
export SHLIB_PATH=/oracleDatabaseSidHere/oracle/10.2/lib:/usr/lib:/oracleDatabaseSidHere/oracle/10.2/odg/lib
export ORACLE_BASE=/oracleDatabaseSidHere/oracle
export ORACLE_SID=oracleDatabaseSidHere
export ORACLE_HOME=/oracleDatabaseSidHere/oracle/10.2
# Set up the path and executable to run
PATH=.\:$PATH:$ORACLE_HOME/bin:/usrlocal/bin
PATH=$PATH:/path_to_application_logs
cd /path_to_application
application
Related to this, I just found out that I get the same error ORA-12547 TNS lost contact on my Windows machine when I try to connect to an Oracle database with PL/SQL and at the same time I have a VPN connection open.
I had a similar problem on Linux, Oracle 11gR2. Oracle owner could run SQL*Plus and get in via either TNS or local connection. Non-oracle user could log in via TNS, but not as local connection.
Turns out the answer was that the ORACLE_HOME filesystem was mounted "nosuid". Removing that mount option solved my issue.

Resources