An Oracle blog – Amardeep Sidhu

May 18, 2011

ORA-12547: TNS:lost contact

Filed under: Troubleshooting — Sidhu @ 11:13 am
Tags: ,

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:

$ 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
$

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:

$ 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>

21 Comments »

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

    Comment by sunil — August 12, 2011 @ 12:30 am | Reply

  2. Nice post.

    Comment by Taj — August 22, 2011 @ 5:42 pm | Reply

  3. 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 北在南方 — August 22, 2011 @ 6:59 pm | Reply

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

    Comment by 北在南方 — August 22, 2011 @ 7:01 pm | Reply

  5. Thanks

    problem is solve

    Comment by suhas — November 28, 2011 @ 9:10 am | Reply

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

    Comment by Gaurav R — December 16, 2011 @ 5:13 pm | Reply

  7. We can also use following commands:

    cd $ORACLE_HOME/bin
    relink all

    Comment by Gaurav R — December 16, 2011 @ 5:25 pm | Reply

  8. 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 isma — January 6, 2012 @ 8:57 am | Reply

  9. Had the same issue – thanks a ton!!

    Comment by Brian Repko — January 6, 2012 @ 9:16 am | Reply

  10. 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 gopal — January 21, 2012 @ 9:39 am | Reply

  11. great. chmod 6751 helped a lot.

    Comment by Meiron — January 21, 2012 @ 11:46 pm | Reply

  12. 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 Vivek — March 13, 2012 @ 11:26 am | Reply

  13. 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 Elliot — March 17, 2012 @ 12:17 am | Reply

  14. @Elliot

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

    Comment by Sidhu — March 21, 2012 @ 2:59 pm | Reply

  15. Thanks Amardeep. It worked like a charm.
    Cheers
    Amith

    Comment by Amith — May 15, 2012 @ 5:40 am | Reply

  16. Great ! 🙂

    Comment by Sidhu — May 17, 2012 @ 11:45 am | Reply

  17. Thanks Amardeep.. worked for me

    Comment by Amit — June 9, 2012 @ 8:36 pm | Reply

  18. Thanks Amardeep…. worked for me too….

    Comment by amanpreet — June 29, 2012 @ 12:21 pm | Reply

  19. Thanks Amardeep,

    Comment by satya — August 1, 2017 @ 10:20 am | Reply

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

    Comment by Rakesh Chouksey — September 23, 2017 @ 4:25 pm | Reply


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Theme: Rubric. Get a free blog at WordPress.com

%d bloggers like this: