'ORA-12547 TNS: Lost Contact' on local connect to database

Not long ago after installation of Oracle Database 11G XE on my tiny server, I faced a situation when I could not access my database. It was due to the fact every time I tried to connect, I got ORA-12547 TNS: Lost Contact just after entering user name and password.

Also I can add I never saw such a situation on a Windows system, so I tried to work out a solution which could be specific to Linux setups.

What is more interesting, remote connections to the database worked fine. Or even when I tried to connect from the same machine, but used listener, everything was fine:

$ sqlplus sys@localhost as sysdba

SQL*Plus: Release 11.2.0.2.0 Production on Fri Mar 23 23:55:16 2018

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

Enter password:

Connected to:
Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production

SQL>

So, this investigation proves the fact, that only local (bequeth) connection did not work.

Solution

  1. Noticable, that if you are encountering the same problem, Oracle Database binaries owner (usually oracle:dba) should still be able to connect to the database instance locally. If not so, perhaps, you have a different issue.
  2. The problem appear to be related to broken users permissions on oracle binaries. To be more precise, my case was missing set UID permission on them. To restore all what needed, perform this operation:
chmod 6751 $ORACLE_HOME/bin/*

Now, bequeth connection should work properly:

[dsavenko@zza-server: ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.2.0 Production on Sat Mar 24 00:04:20 2018

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


Connected to:
Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production

SQL>

What really surprises and freaks me out, that the exception tells nothing about permissions problems. As well as nothing is in database log and trace files. Hope this post will help somebody not to waste as big amount of time fixing it as me.

Good luck and do not hesitate to add your solutions to same issues in comments!