An Oracle blog – Amardeep Sidhu

Little bit of fun with Oracle and the related technologies…

ORA-12547: TNS:lost contact

with 18 comments

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>

Written by Sidhu

May 18th, 2011 at 11:13 am

18 Responses to 'ORA-12547: TNS:lost contact'

Subscribe to comments with RSS or TrackBack to 'ORA-12547: TNS:lost contact'.

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

    sunil

    12 Aug 11 at 12:30 am

  2. Nice post.

    Taj

    22 Aug 11 at 5:42 pm

  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

    北在南方

    22 Aug 11 at 6:59 pm

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

    北在南方

    22 Aug 11 at 7:01 pm

  5. Thanks

    problem is solve

    suhas

    28 Nov 11 at 9:10 am

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

    Gaurav R

    16 Dec 11 at 5:13 pm

  7. We can also use following commands:

    cd $ORACLE_HOME/bin
    relink all

    Gaurav R

    16 Dec 11 at 5:25 pm

  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>

    isma

    6 Jan 12 at 8:57 am

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

    Brian Repko

    6 Jan 12 at 9:16 am

  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.

    gopal

    21 Jan 12 at 9:39 am

  11. great. chmod 6751 helped a lot.

    Meiron

    21 Jan 12 at 11:46 pm

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

    Vivek

    13 Mar 12 at 11:26 am

  13. Helped me too. Thanks.

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

    Elliot

    17 Mar 12 at 12:17 am

  14. @Elliot

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

    Sidhu

    21 Mar 12 at 2:59 pm

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

    Amith

    15 May 12 at 5:40 am

  16. Great ! :)

    Sidhu

    17 May 12 at 11:45 am

  17. Thanks Amardeep.. worked for me

    Amit

    9 Jun 12 at 8:36 pm

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

    amanpreet

    29 Jun 12 at 12:21 pm

Leave a Reply

*
To prove you're a person (not a spam script), type the answer to the math equation shown in the picture. Click on the picture to hear an audio file of the equation.
Click to hear an audio file of the anti-spam equation