How to fix ORA-12547 TNS lost contact when try to connect to Oracle
Issue / Oracle error
sqlplus scott/tiger
SQL*Plus: Release 10.2.0.5.0 - Production on Wed May 18 09:32:35 2011
Copyright (c) 1982, 2010, Oracle. All Rights Reserved.
ERROR:
ORA-12547: TNS :lost contact when try to connect to Oracle.
Issue description
I saw that TNS connection issue along with ORA-12547 Oracle error several times, usually when trying to connect to Oracle database server on Unix / Linux host with an OS user that does not belong to oinstall group (Oracle binaries owner group). In this case, interesting enough that local TNS connection to database (when using tnsnames alias) works fine:
sqlplus scott/tiger@orcl
and only local BEQ protocol connection through an Oracle error ORA-12547:
sqlplus scott/tiger
ERROR:
ORA-12547: TNS:lost contact
There can be different reasons of this issue, but usually the problem is in wrong privileges/ownership of some Oracle binaries located in $ORACLE_HOME/bin directory. Perhaps, Oracle database binaries were installed / linked not correctly or something or somebody has changed the files’ ownership.
Solution
- 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
- Usually the above operation should fix the issue but I suggest continue investigating privileges of other files to avoid further possible problems. As the matter of fact these special rights of Oracle binaries are set by $ORACLE_HOME/root.sh script on Unix / Linux after the Oracle installation. You can run the script again as root user, if you see more files have wrong permissions or ownership (make backup before, just in case). For that I provide as an example 2 lists of oracle binary files in $ORACLE_HOME/bin directory with correct rights below.
Oracle 11gR2 (11.2.0.3) on Linux Redhat 6.x
-rwsr-s--x. 1 oramcelt oinstall 221227204 Aug 14 12:12 oracle
-rwsr-s--x. 1 oramcelt oinstall 221189362 Aug 14 11:03 oracleO
-rwsr-x---. 1 root oinstall 71758 Sep 17 2011 oradism
-rws--x---. 1 root oinstall 44437 Aug 14 11:02 nmo
-rws--x---. 1 root oinstall 66324 Aug 14 11:02 nmhs
-rws--x---. 1 root oinstall 34166 Aug 14 11:03 nmb
-rwsr-x---. 1 root oinstall 43402 Aug 14 11:03 jssu
-rwsr-x---. 1 root oinstall 43402 Aug 14 11:03 jssu
-rwsr-x---. 1 root oinstall 1249349 Aug 14 11:03 extjob
-rwsr-s--x. 1 oramcelt oinstall 65799 Aug 14 11:02 emtgtctl2
Oracle 11gR2 (10.2.0.3) on Linux Redhat 4.x
-rwsr-x--- 1 root oinstall 64850 Nov 6 2007 extjob
-rwsr-s--- 1 root oinstall 18376 Mar 1 2006 nmb
-rwsr-s--- 1 root oinstall 19566 Mar 1 2006 nmo
-rwsr-s--x 1 oracle oinstall 95118102 Nov 6 2007 oracle
-r-sr-s--- 1 root oinstall 14456 Nov 15 2006 oradism
Good luck and feel free to add solutions of the same issue in your comments.
Thanks!
I did not find the answer on OTN forums – but chmod 6751 oracle did the trick.
thanks for sharing…
This issue appears to have started wen an OS patch has been applied. I have found that performing a relink wil also resolve this issue.
chmod 6751 oracle worked for me as well, thanks.
Metalink recommends to shutdown the database prior to mess with it, otherwise it could crash the db.
Hi Luc,
Not a bad idea. Thanks for your remark
— Kirill
In my case I re run the root.sh and the error disappear
In my case, after I rerun root.sh, I have to chmod 6751 oracle, then it works fine.
RHEL6.4 Oracle 11.2.0.3.0
After I changed the owner and group id’s, I ran into the problem.
In our case, we sold the problem by getting permissions to oracle on /dev/null
In our case there was no
/proc filessystem
mounted ……
3hours of seraching ….
I had relinked couple of times but it did not fix the issue. The problems was that the file config.o, which had 0 bytes. In order to fix I renamed it to config.o.bad, so Oracle has fixed it creating a good one at the next relink and I was able to acess sqlplus. Here is the steps I used :
cd $ORACLE_HOME/rdbms/lib
mv config.o config.o.bad
cd $ORACLE_HOME
umask 022
relinktime=`date ‘+%Y-%m-%d-%H-%M-%S’`
touch relink_$relinktime.log
relink all 1>>relink_$relinktime.log 2>>relink_$relinktime.log
cat relink_$relinktime.log | grep -i FATAL
cd $ORACLE_HOME/sqlplus/lib
make -f ins_sqlplus.mk install 1>>relink_$relinktime.log 2>>relink_$relinktime.log
Of course I had ORACLE_BASE, ORACLE_HOME, LD_LIBRARY_PATH, PATH properly set.
chmod 6751 oracle worked for me as well, thanks.
tanks for chmod work and save me .
Thank you. This worked for me
Had this issue on a 12.1.0.2 upgrade and couldn’t fix by the usual means. Support had us all over the place, relinking, traces, truss, … Problem was really simple, Unix Admin had mounted the binaries file system with nosuid, which over-rides the suid on the oracle binary!
Excellent solution. Thank you.
I got into same error but the issue was caused by incorrect entry in /etc/fstab for oracle binaries related filesystem .
changing it to suid from nosuid resolved the issue for us .
Hi,
I encountered the same error while upgrading Oracle 11.2.0.1 to Oracle 11.2.0.3.
The reason of error was not setting of LD_LIBRARY_PATH.
The minutes i set it correctly i could connect and do my upgrade.
Thanks & Rgds.
M.H.Contractor.
chmod is a brilliant sol. It saved my time. Thanks.
chmod 6751 oracle worked for me as well, thanks.
This fixed the error for me as well…
Thank you.
SLES 11 with Oracle12
not work for me My previous setting was -rwxr-x—, how to revert back this settings ? please anser
Hi Ovais
just run $ORACLE_HOME/root.sh to set the proper rights and it will most porbably fix your problem.
— Kirill
Excellent, works like a charm…
Another possible solution to ORA-12547 TNS LOST CONTACT for HP-UX for this error:
Check the /dev/null file. It must be like the following:
crw-rw-rw- 1 bin bin 3 0x000002 Jan 30 09:05 null
instead of:
———- 1 bin bin 3 0x000002 Jan 30 09:05 null
If not, fix it. Contacting your hp-ux administrator.
Regards.
chmod 6751 oracle worked for me as well, thanks.
I am installing Oracle 12.1.0 on RHEL7. As soon as I launch DBCA, I get error message “Database Configuration Assistant failed to detect options for this Oracle Installation. ORA-12547: TNS: lost contact”.
I tried all above give methods but none of these worked. Could you please suggest if I should try something else too.
Thanks!
chmod 6751 oracle worked for me as well, thanks.
Thank you Kirill. This worked for me, as well.
The same error will apear if Unix permission for alert subdirectory in admin part of diag for you database is not correct. x permission was removed by accident and database was throwing back ORA-12547: TNS:lost contact.
None of db and listener logs will point to this issue, untill you try to restart database (which is problem on its own since you cannot login :-P)
Thanks a lot !!!!!
It worked and solved my big problem also.
Use correct user to launch dbca ($ORACLE_HOME owner)
Tried with command
chmod -R 6751 /oracle/
chmod 6751
both command does’nt work here.
plz reply with best option
i have oracle 12c
Thanks a lot.
using chmod 6751 helped to resolve the issue.
Thanks
Thanks a million Kirill. After hours of frustration, changing permissions as you suggested resolved my issue.
Thanks , below command worked for me as well
chmod 6751 oracle
thanks,it solved my problem
In my cause it was caused by additional parameter added to sqlnet.ora file namely: SQLNET.EXPIRE_TIME
Thanks