Tuesday, 7 August 2018

Oracle - "file too short" exception seen when attempting to invoke SQLPlus

So this is a fresh installation of Oracle 12c ( 12.2.0.1.0 ) on a Red Hat Enterprise Linux 7.5 box.

All has gone well …..

until now ….

When I log in as the DBA user: -

su - oracle

and attempt to access SQLPlus, I get this: -

sqlplus 

sqlplus: error while loading shared libraries: /home/oracle/app/oracle/product/12.2.0/dbhome_1/lib/libclntsh.so.12.1: file too short

I'd previously setup my Bash profile: -

vi ~/.bashrc

export ORACLE_HOME=/home/oracle/app/oracle/product/12.2.0/dbhome_1
export ORACLE_SID=orcl
export PATH=$PATH:$ORACLE_HOME/bin
if [ $?LD_LIBRARY_PATH ]
then
        LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
else
        LD_LIBRARY_PATH=$ORACLE_HOME/lib
fi
export LD_LIBRARY_PATH


and was able to validate that I could see the LD_LIBRARY_PATH variable: -

echo $LD_LIBRARY_PATH

/home/oracle/app/oracle/product/12.2.0/dbhome_1/lib:

and that the offending library was there: -

locate libclntsh.so

/home/oracle/app/oracle/product/12.2.0/dbhome_1/inventory/Scripts/ext/lib/libclntsh.so.12.1
/home/oracle/app/oracle/product/12.2.0/dbhome_1/inventory/backup/2018-08-07_03-13-33PM/Scripts/ext/lib/libclntsh.so.12.1
/home/oracle/app/oracle/product/12.2.0/dbhome_1/lib/libclntsh.so
/home/oracle/app/oracle/product/12.2.0/dbhome_1/lib/libclntsh.so.12.1


ls -al `locate libclntsh.so`

-rw-r----- 1 oracle oinstall 71638263 Aug  7 15:13 /home/oracle/app/oracle/product/12.2.0/dbhome_1/inventory/backup/2018-08-07_03-13-33PM/Scripts/ext/lib/libclntsh.so.12.1
-rwxr-x--- 1 oracle oinstall 71638263 Aug  7 15:13 /home/oracle/app/oracle/product/12.2.0/dbhome_1/inventory/Scripts/ext/lib/libclntsh.so.12.1
lrwxrwxrwx 1 oracle oinstall       17 Aug  7 15:14 /home/oracle/app/oracle/product/12.2.0/dbhome_1/lib/libclntsh.so -> libclntsh.so.12.1
-rwxr-x--- 1 oracle oinstall        0 Aug  7 15:14 /home/oracle/app/oracle/product/12.2.0/dbhome_1/lib/libclntsh.so.12.1


Note that the library - libclntsh.so.12.1 - is actually a symbol link, which is OK, BUT that the original file is zero bytes in length :-(

Following this: -


specifically: -

I relinked the binaries: -

$ORACLE_HOME/bin/relink all

writing relink log to: /home/oracle/app/oracle/product/12.2.0/dbhome_1/install/relink.log

and now have this: -

ls -al `locate libclntsh.so`

-rw-r----- 1 oracle oinstall 71638263 Aug  7 15:13 /home/oracle/app/oracle/product/12.2.0/dbhome_1/inventory/backup/2018-08-07_03-13-33PM/Scripts/ext/lib/libclntsh.so.12.1
-rwxr-x--- 1 oracle oinstall 71638263 Aug  7 15:13 /home/oracle/app/oracle/product/12.2.0/dbhome_1/inventory/Scripts/ext/lib/libclntsh.so.12.1
lrwxrwxrwx 1 oracle oinstall       17 Aug  7 16:54 /home/oracle/app/oracle/product/12.2.0/dbhome_1/lib/libclntsh.so -> libclntsh.so.12.1
-rwxr-xr-x 1 oracle oinstall 71613512 Aug  7 16:54 /home/oracle/app/oracle/product/12.2.0/dbhome_1/lib/libclntsh.so.12.1


which is better :-)

And, even more good news ….

sqlplus 

gives me: -

SQL*Plus: Release 12.2.0.1.0 Production on Tue Aug 7 16:55:16 2018

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

Enter user-name:


Yay!

No comments: