sqlplus: error while loading shared libraries: libsqlplus.so: wrong ELF class: ELFCLASS64

This error usually while you do something wrong. Wait, what’s an error when you do everything right? Okay, here it is: You install the instantclient 32 rpm oracle-instantclient12.1-sqlplus- On that server, you switch home using oraenv $ . oraenv ORACLE_SID = [oracle] ? DB01 The Oracle base has been set to /u01/app/oracle You start sqlplus… Continue reading sqlplus: error while loading shared libraries: libsqlplus.so: wrong ELF class: ELFCLASS64

network ip calculation with ifconfig

Most *nix are different. I’ll start with a plain Linux output ifconfig eth0 eth0: flags=4163 mtu 1500 inet netmask broadcast to get the network ip, I just bitwise-and the inet and the netmask. To do it with the shell, I convert the ip to an integer and use the & (AND) operator… Continue reading network ip calculation with ifconfig

free Oracle cloud forever

I could not miss this ! After offering free apex for non-productive usage (apex.oracle.com), free sql environment for playing (livesql.oracle.com), Oracle now offers free for ever infrastructure and database. With a few clicks, a credit card (that won’t be charged) and a few minutes of patience, you will be able to have your own Linux… Continue reading free Oracle cloud forever

Unix ODBC Sybase

very similar to Unix ODBC Oracle instead of tnsnames, the connections are defined in $SYBASE/interfaces. the odbc.ini must exists as well in $SYBASE. if you test with unixODBC-devel, keep in mind to use /usr/bin/isql and not $SYBASE_OCS/bin/isql $ODBCSYSINI/odbc.ini [syb] Driver = Sybase16 DSN = syb ServerName=SYB01 $ODBCINI/odbcinst.ini [Sybase16] Description = Adaptive Server Enterprise Driver =… Continue reading Unix ODBC Sybase

Unix ODBC Oracle

To connect via ODBC, check https://laurentschneider.com/wordpress/tag/odbc This article is related to Unix/Linux. Often you have a fat client written in C, while java uses JDBC instead of ODBC. Okay, it’s pretty easy, if you have an oracle client, you probably already have libsqora.so.xx.1 in your LD_LIBRARY_PATH. In this case you can connect using ODBC. What… Continue reading Unix ODBC Oracle

Categorized as linux, unix Tagged

disallow pseudo terminal in ssh

Some Oracle documentation wants you to setup ssh with no password and no passphrase. Configuring ssh This is not really something your security admin will like. First, using DSA, which is deprecated and disabled by default in OpenSSH 7.0, is a pretty dump instruction OpenSSH 7.0 and greater similarly disable the ssh-dss (DSA) public key… Continue reading disallow pseudo terminal in ssh

Untrusted X11 forwarding

I wrote a while ago about my security concerns regarding xhost + xterm -display mypc:0 Way back then, I suggested ssh tunnel. SSH is pretty easy to set up, by enabling the X11Forwarding option. In OpenSSH 3.8 release note, 2004, there was a new default . ssh(1) now uses untrusted cookies for X11-Forwarding In the… Continue reading Untrusted X11 forwarding

run sudo, ssh, password, su in simulated interactive mode

Some commands do not like non-interactive mode $ passwd newpassword > newpassword > EOF Changing password for user lsc. Current password for lsc@example.com: passwd: Authentication token manipulation error $ echo oraclepassword | su – oracle standard in must be a tty $ echo sudopassword | sudo su – oracle [sudo] password for lsc: sudo: sorry,… Continue reading run sudo, ssh, password, su in simulated interactive mode

How to *really* send a script to the background

Let’s check this small script – foo.sh #!/bin/sh echo foo.1:`date` | tee $HOME/tmp/foo.txt sleep 3 echo foo.2:`date` | tee -a $HOME/tmp/foo.txt $ $HOME/tmp/foo.sh foo.1:Thu Nov 27 17:34:53 CET 2014 foo.2:Thu Nov 27 17:34:56 CET 2014 Very obvious, I write to the console, wait three seconds, then write to the console. Ok, let’s take another script… Continue reading How to *really* send a script to the background

fun with cron

Today I find out that my scheduler was too busy to execute all jobs in my crontab !? * * * * * (while :;do ssh example.com :; done) 59 23 19 06 * touch /tmp/bang my while loop is going to produce so much hangs on the cron deamon that it may not be… Continue reading fun with cron

remove the current directory

Can I remove the current directory? I used to believe you cannot. Solaris: $ uname -s SunOS $ mkdir /tmp/bla $ cd /tmp/bla $ rm -r /tmp/bla rm: Cannot remove any directory in the path of the current working directory /tmp/bla $ AIX: $ uname -s AIX $ mkdir /tmp/bla $ cd /tmp/bla $ rm… Continue reading remove the current directory

Categorized as linux Tagged

Check mount option in linux

I did not find a clean way to check the mount option in Linux. For instance wsize=32768 On AIX, I simply type “mount” and see the mount option… For some reasons, my Linux does not show me the complete mount options ! $ mount precision:/nfsserver on /nfsclient type nfs (rw,bg,addr= $ grep nfsclient /proc/mounts precision:/nfsserver… Continue reading Check mount option in linux

Categorized as linux

shell and list of files

How do you loop thru a list of files? For instance you want to archive than delete all pdf documents in the current directory : Bad practice : tar cvf f.tar *.pdf rm *.pdf There are multiple issue with the command above 1) new files could come during the tar, so the rm will delete… Continue reading shell and list of files

Categorized as linux, unix

Generate network graph from command line

I recently wrote on gnuplot, today I tried another command line utility to generate graphs, graphviz, version 2.24.0 on AIX5L. Pretty straightforward syntax : ( echo “digraph Emp {” sqlplus -s -L scott/tiger

scp tuning

I twitted yesterday : laurentsch copying 1TB over ssh sucks. How do you fastcopy in Unix without installing Software and without root privilege? I got plenty of expert answers. I have not gone to far in recompile ssh and I did not try plain ftp. Ok, let’s try first to transfer 10 files of 100M… Continue reading scp tuning

What is the current setting of NLS_LANG in sqlplus?

I just learnt a neat trick from Oracle Support. How do you see the current value of NLS_LANG in SQLPLUS ? HOST is not the right answer. E.g.: Unix: SQL> host echo $NLS_LANG AMERICAN_SWITZERLAND Windows: SQL> HOST ECHO %NLS_LANG% %NLS_LANG% The correct setting is revealed by @.[%NLS_LANG%] E.g.: Unix: SQL> @.[$NLS_LANG] SP2-0310: unable to open… Continue reading What is the current setting of NLS_LANG in sqlplus?

Time offset in Unix

What is the time offset of the current date in Unix? perl -e ‘ $t=time; @l=localtime($t); @g=gmtime($t); $d=$l[2]-$g[2]+($l[1]-$g[1])/60; $gd=$g[3]+$g[4]*31+$g[5]*365; $ld=$l[3]+$l[4]*31+$l[5]*365; if($gd$ld){$d-=24} print ($d.”\n”)’ 2 Am I in summer (DST)? perl -e ‘if((localtime)[8]){print”yes”}else{print “no”}’ yes

last access time of a file

I was reading http://blogs.oracle.com/myoraclediary and there was a command about printing the modification details of a file. In Linux / Cygwin “stat” exists as a command $ stat /etc/hosts Access: 2010-08-25 15:20:49.782522200 +0200 Modify: 2010-08-18 14:04:25.868114200 +0200 Change: 2010-08-18 14:04:26.072413100 +0200 Or use the one-liner perl below ### st_atime; /* Time of last access */… Continue reading last access time of a file

to cvs or to subversion

First surprise, after migration, the size of my subversion folder is double the size of my cvs folder. With a bunch of 2Gb disks shared amoung dozens of unix persons, and regular reminders the current usage reached 100%, you will feel the pain of having each developers doublesizing its home directory… The reason is a… Continue reading to cvs or to subversion

extract xml from the command line

I just discovered this morning this cool utility in my /bin directory : xmllint You can use it to extract values from your xml files within your shell scripts $ cat foo.xml John Jack $ echo ‘cat //emplist/emp[@no=”1″]/ename/text()’| xmllint –shell foo.xml | sed -n 3p John I like this !

read without Enter

A small unix tip today. Do you want to continue ? If you are expecting “y” or “n” but do not want to enforce the user to type y[Enter] but simply y, you can use the -n option in bash. Within a ksh script: yorn=$(bash -c ‘read -p “Do you want to continue ? “… Continue reading read without Enter


Do you know cd ? I thought I did until this afternoon … OK, let’s start some basic. I create two directories $ echo $SHELL /bin/ksh $ mkdir /tmp/foo $ mkdir /tmp/bar create a symlink /tmp/bar/baz pointing to /tmp/foo $ ln -s /tmp/foo /tmp/bar/baz create a file foo1 in foo $ touch /tmp/foo/foo1 change to… Continue reading cd

Categorized as linux, unix Tagged


Something I like in ksh is to change from /my/old/directory/path to /my/new/directory/path by typing cd old new. This does not work in bash So I had to find a workaround 😉 $ ksh $ cd /app/oracle/product/ $ cd 6 7 $ pwd /app/oracle/product/ $ bash $ cd 7 6 bash: cd: 7: No such file… Continue reading cd OLD NEW

Categorized as linux, unix Tagged

chmod -R 777 .

This is one of the thing I hate to see, recursively changing everything to 777 👿 If you want to give read access to all, then 644 is enough for files and 755 for directories. If you want to give execution permission too, you could give 755 to executable files. Also sometimes you have files… Continue reading chmod -R 777 .