Very simple issue but took some amount of time in troubleshooting so thought about posting it here. May be it proves to be useful for someone.

Scenario was: Oracle is installed from “oracle” user and all runs well. There is a new OS user “test1” that also needs to use sqlplus. So granted the necessary permissions on ORACLE_HOME to test1. Tried to connect sqlplus scott/tiger@DB and yes it works. But while trying sqlplus scott/tiger it throws:

[sql]$ 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

Enter user-name: ^C $[/sql]

Did a lot of troubleshooting including checking tnsnames.ora, sqlnet.ora, listener.ora and so on. Nothing was hitting my mind so finally raised an SR. And it has to do with the permissions of the $ORACLE_HOME/bin/oracle binary. The permissions of oracle executable should be rwsr-s–x or 6751 but they were not. See below:

[sql]$ id uid=241(test1) gid=202(users) groups=1(staff),13(dba) $

$ cd $ORACLE_HOME/bin $ ls -ltr oracle -rwxr-xr-x    1 oracle   dba       136803483 Mar 16 20:32 oracle $

$ chmod 6751 oracle $ ls -ltr oracle -rwsr-s–x    1 oracle   dba       136803483 Mar 16 20:32 oracle $

$ sqlplus scott/tiger

SQL*Plus: Release 10.2.0.5.0 - Production on Wed May 18 10:23:27 2011

Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.

Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> show user USER is “SCOTT” SQL>[/sql]

Comments

Comment by sunil on 2011-08-12 00:30:20 +0530

great fix. had a similar issue. thanks for the post.

Comment by Taj on 2011-08-22 17:42:26 +0530

Nice post.

Comment by 北在南方 on 2011-08-22 18:59:30 +0530

I have a database which has been upgraded from 11.2.0.1 to 11.2.0.2 ; when execute “sqlplus /” as a OS user ADMIN which is not belong to the oracle oinstall group,ORA-12547: TNS:lost contact occurs
when do “sqlplus /nolog” and then conn /as sysdba as ORACLE user ,the resault id normal
oracle@p1a.ora.sd.aliyun.com:/home/oracle>sqlplus /nolog
SQL*Plus: Release 11.2.0.2.0 Production on Sat Aug 20 14:59:50 2011
Copyright (c) 1982, 2010, Oracle. All rights reserved.
@>conn /as sysdba
Connected.
sys@alibank1>exit

but when do this as ADMIN uers ,ORA-12547: TNS:lost contact occurs;
admin@p1a.ora.sd.aliyun.com:/home/admin>tnsping alibank1
TNS Ping Utility for Linux: Version 11.2.0.2.0 – Production on 20-AUG-2011 14:57:19
Copyright (c) 1997, 2010, Oracle. All rights reserved.
Used parameter files:
TNS-03505: Failed to resolve name
admin@p1a.ora.sd.aliyun.com:/home/admin>sqlplus /nolog
SQL*Plus: Release 11.2.0.2.0 Production on Sat Aug 20 14:57:33 2011
Copyright (c) 1982, 2010, Oracle. All rights reserved.
@>conn /as sysdba
ERROR:
ORA-12547: TNS:lost contact

Comment by 北在南方 on 2011-08-22 19:01:25 +0530

I am a oracle dba from chain and looking forward to your advice..

Comment by suhas on 2011-11-28 09:10:28 +0530

Thanks

problem is solve

Comment by Gaurav R on 2011-12-16 17:13:44 +0530

Thanks. had a similar issue after upgrading from Oracle10g (10.2.0.5) to Oracle11g.

Comment by Gaurav R on 2011-12-16 17:25:36 +0530

We can also use following commands:

cd $ORACLE_HOME/bin
relink all

Comment by isma on 2012-01-06 08:57:25 +0530

Hi,
Need your help.
Even after perform the command as suggested, I’m still can’t start the listener. Help!!
root@ormdevl # chmod 6751 oracle
root@ormdevl # ls -ltr oracle
-rwsr-s–x 1 oracle dba 66435324 Mar 8 2006 oracle
root@ormdevl # lsnrctl

LSNRCTL for Solaris: Version 9.2.0.7.0 – Production on 06-JAN-2012 11:21:02

Copyright (c) 1991, 2002, Oracle Corporation. All rights reserved.

Welcome to LSNRCTL, type “help” for information.

LSNRCTL> start
Starting /oracle/9.2.0/bin/tnslsnr: please wait…

ld.so.1: tnslsnr: fatal: /oracle/9.2.0/lib/libclntsh.so.9.0: Permission denied
TNS-12547: TNS:lost contact
TNS-12560: TNS:protocol adapter error
TNS-00517: Lost contact
Solaris Error: 32: Broken pipe
LSNRCTL>

Comment by Brian Repko on 2012-01-06 09:16:32 +0530

Had the same issue – thanks a ton!!

Comment by gopal on 2012-01-21 09:39:09 +0530

chmod 6751 oracle
$ ls -ltr oracle
-rwsr-s–x 1 oracle dba 136803483 Mar 16 20:32 oracle
$

Resolved my issue. Thanks for your support.

Comment by Meiron on 2012-01-21 23:46:11 +0530

great. chmod 6751 helped a lot.

Comment by Vivek on 2012-03-13 11:26:26 +0530

ORA-12547: TNS:lost contact
exapmple :

– $ORACLE_HOME
– chmod r 777 where oracle is installed
– chown -R oracle_llg uo2 (changing recursively the owner of u02 where oracle is installed )
– chown -R oracle_llg:oinstall uo2(changing recursively the group of u02 where oracle is installed)

this helped me..

Comment by Elliot on 2012-03-17 00:17:28 +0530

Helped me too. Thanks.

Any idea on what would have caused the permissions to change? I don’t want it to happen again.

Comment by Sidhu on 2012-03-21 14:59:08 +0530

@Elliot

May be they were like this since ever. Or it was working fine before you faced this error one day ?

Comment by Amith on 2012-05-15 05:40:53 +0530

Thanks Amardeep. It worked like a charm.
Cheers
Amith

Comment by Sidhu on 2012-05-17 11:45:18 +0530

Great ! 🙂

Comment by Amit on 2012-06-09 20:36:02 +0530

Thanks Amardeep.. worked for me

Comment by amanpreet on 2012-06-29 12:21:21 +0530

Thanks Amardeep…. worked for me too….

Comment by satya on 2017-08-01 10:20:01 +0530

Thanks Amardeep,

Comment by Rakesh Chouksey on 2017-09-23 16:25:37 +0530

Thanks Amardeep.. it is really helpful blog. Thanks mate.

Comment by Sidhu on 2017-11-06 17:20:20 +0530

Cheers !