ORA-12547: TNS:lost contact

This is a quick note to cover ORA-12547: TNS:lost contact error, I would try to include all possible causes of ORA-12547: TNS:lost contact error so that this post itself could assist you in sorting the issue.

sqlplus / as sysdba

SQL*Plus: Release 11.1.0.7.0 - Production on Wed Mar 30 11:59:06 2011

Copyright (c) 1982, 2008, Oracle. All rights reserved.

ERROR:
ORA-12547: TNS:lost contact

ORA-12547: TNS:lost contact error could be due to any of the following reasons:-

  • Incorrect permissions on the ORACLE executable.
  • Insufficient ulimit setting for stack.
  • $ORACLE_HOME/rdbms/lib/config.o is 0 bytes.
  • Oracle binaries have not been linked correctly.
  • A missing $ORACLE_HOME/dbs directory.
  • Incorrect kernel parameters settings.

Incorrect permissions on the ORACLE executable

To check where the permission issue lies use strace (One of my favorite troubleshooting tool)

strace -f -o /tmp/strace.log $ORACLE_HOME/bin/sqlplus / as sysdba

Then scan the log for EACCES (Permission denied):-

21810 open("/apps/oracle/server/11.2.0.4/admin/ORCL/diag/rdbms/orcl/ORCL/alert/log.xml", O_WRONLY|O_CREAT|O_APPEND, 0664) = -1 EACCES (Permission denied)
......

21810 open("/apps/oracle/server/11.2.0.4/admin/ORCL/diag/rdbms/orcl/ORCL/trace/alert_ORCL.log", O_WRONLY|O_CREAT|O_APPEND, 0664) = -1 EACCES (Permission denied)

To confirm this check the permission of $ORACLE_HOME/bin/oracle

ls -ltr $ORACLE_HOME/bin/oracle

The permission should be -rwsr-s–x,

-rwsr-s--x. 1 oracle oinstall 228470203 Dec  3  2014 /apps/oracle/server/11.2.0.4/dbhome_1/bin/oracle

If its different execute below command to fix it:-

chmod 6751 oracle

Insufficient ulimit setting for stack

Check the current ulimit setting for stack

ulimit -a

Check the install guide for your specific platform and version of Oracle and set the stack appropriately.

$ORACLE_HOME/rdbms/lib/config.o is 0 bytes

Check to ensure the following two files are not 0 bytes:

$ORACLE_HOME/bin/oracle
$ORACLE_HOME/rdbms/lib/config.o

If yes, rename the following file:

cd $ORACLE_HOME/rdbms/lib
mv config.o config.o.bad

Then, relink the oracle binary to fix the issue:

$ORACLE_HOME/bin/relink oracle

Oracle binaries have not been linked correctly

If relinking the binaries in above step doesn’t fixed the issue then shutdown the database and listener and then issue:-

$ORACLE_HOME/bin/relink all

Incorrect kernel parameters settings

Last but not the least this error can be even due to incorrect kernel parameter settings thus if the above mentioned fixes does not resolve your issue please cross check the kernel parameter settings of your env. with the documentation, and amend the configuration in case of any discrepancy and restart the listener.

Hope this helps you in fixing ORA-12547: TNS:lost contact error, in case of any concerns or assistance please feel free to add your comment below and we would respond accordingly.

6 thoughts on “ORA-12547: TNS:lost contact

  1. I have followed the steps mentioned above but still getting the same error, is it require tnsnames.ora file, during installation it is not getting generated in my case.

    Like

  2. Dears,

    I like to share my case with you.

    I have Oracle 11G R2 installed on IBM AIX 5, by mistake I copied /var/adm/wtmp to /dev/null (it should be: cp /dev/null /var/adm/wtmp) thus the permission of file /dev/null become read only (–r–r–r)

    I modified the permission of /dev/null to 666 (read write) and sqlplus / as sysdba works fine again

    Regards

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.