Install oracle client on Redhat 7

When trying to run one of our application on a Redhat 7 amazon  instance, I had this error: cannot open shared object file: No such file or directory

DBMS API Library loading fails
This library is a part of DBMS client installation, not SQLAPI++
Make sure DBMS client is installed and
this required library is available for dynamic loading

1) The directories in the user's LD_LIBRARY_PATH environment variable
2) The list of libraries cached in /etc/
3) /usr/lib, followed by /lib

The application needed the oracle client library to connect to our Oracle DB.

To install it, we did:

  • download from oracle the file oracle-instantclient12.1-basic-
  • install it:
    • yum install oracle-instantclient12.1-basic-
  • Create a symbolic link

cd /usr/lib/oracle/12.1/client64/lib/

ln -s




Posted in Cracking the coding interview - a python experience | Leave a comment

Start a docker container on CentOS at boot time as a linux service

I have an amazon EC2 instance running RedHat 7, with docker service installed and enabled. I need a particular container to be started at boot time.
I have done this by installing a service which runs after the docker service is executed.

Note: If docker daemon does not start at boot, you might want to enable the docker service

systemctl enable docker.service

Here are the steps.

Create the file /etc/systemd/system/docker_demo_container.service


ExecStart=/usr/bin/docker start my_container_name
ExecStop=/usr/bin/docker stop my_container_name


Now I can start the service

systemctl start docker_demo_container

And I can enable the service so it is executed at boot

systemctl enable docker_demo_container

That’s it, my container is started at boot.

Also take a look at related docker documentation.



Posted in docker, linux | Leave a comment

[Solved] My Java application fails to connect to my Oracle database

Yesterday we debugged with Pepe some random connection reset exceptions in our application when trying to connect to the Oracle database. He wrote this nice post about it.

Goldfish tips


Yesterday we faced a very weird issue: we have a Java application connecting to an Oracle DB via ojdbc6.

In these days it stopped working, magically: no relevant changes in the system configuration or source code.

The application couldn’t connect to the database: on client side, debugging the stack traces shown it was stuck in the logon process; on server side, Oracle was killing the connection for a timeout waiting for the client:


What’s weird is that we could successfully connect to the same DB using the same credentials of our application via SqlPlus, SQL Developer. And even the same application worked fine from another machine using the same JDK.

To make sure it wasn’t our application, we tested with the following small java class (please forgive the style):

This class shown the same problems of our application but it turned out to be very convenient because…

View original post 130 more words

Posted in java, linux | Leave a comment

Install or upgrade to docker 1.8.x on ubuntu 15.04

Ubuntu 15.04 repositories only contain docker 1.5, therefore, this is the version you get if you apt-get install docker on ubuntu.
If you need (and you should) latest version of docker (here 1.8.3), these are the steps you need to perform (as root):

Update the apt-get source

 vi /etc/apt/sources.list
 #Append this line:  
 deb ubuntu-vivid main

Then type this at command prompt

apt-key adv --keyserver hkp:// --recv-keys 58118E89F3A912897C070ADBF76221572C52609D

install/upgrade docker

apt-get update
apt-get install docker-engine

Note: If you are upgrading, accept all default options (for configuration override) when prompted.

configure docker
For some reason, the file /etc/default/docker which used to contain the docker options is not read anymore. You can add docker option by editing the file /lib/systemd/system/docker.service and add the options at the end of the line

ExecStart=/usr/bin/docker daemon -H fd://

For instance, mine looks like this

/usr/bin/docker daemon -H fd:// --insecure-registry my.private.domain:5000 -g /docker

Restart the docker service

   systemctl daemon-reload
   service docker stop
   service docker start


Posted in docker | Leave a comment

Clean files on oracle server to free up disk space

I’m an oracle newbie .  Today I had to free up some disk space on our oracle server.

I had to:

  • Step1. delete old databases not used anymore
  • Step2. clean-up the database logs

Step1. delete old databases not used anymore 

  • ssh to the db sever with -X and run dbca
ssh -X oracle@myOracleServer

When dbca window opens, select “Delete Database”, then delete your databases.

Step2. Delete old logs

  • run adrci
  • show homes
adrci> show homes
ADR Homes
  • For each home delete all logs older than one day
adrci>  set homepath diag/tnslsnr/targaryen/listener
adrci> PURGE -age 1440 -type ALERT
Posted in Cracking the coding interview - a python experience | Leave a comment

Increase disk size of docker containers when using device mapper

Hi. If you you are using docker with device mapper (for instance, the default config on a fedora system) you might want to change 2 things:

* Increase the storage disk for one container which defaults to 10G
* Increase the total data space used by docker on your platform, which defaults to (type ‘docker info’): Data Space Total: 107.4 GB

Important notice: If you perform the following operations, you will lose all images and containers.

Before performing these operations, stop the docker service.

docker service stop

Increase the data storage used by a container

Edit the docker config file, usually /etc/sysconfig/docker. Modify the options line and add –storage-opt dm.basesize=400G. For me, it looks like this:

-g /DATA/docker --storage-opt dm.basesize=90G --storage-driver=devicemapper 

The -g option specify the docker hoe folder. Device mapper will create files in this folder.
I set the max disk size of a container to 90G. Of course this is a boundary, my containers will not take as much, but they are bounded to that.

Increase the total data storage used by your docker installation
I took the solution from this post.
My docker home folder is in /DATA/docker. If you use the default config, replace /DATA/docker with /var/lib/docker in the following operations.

* Remove the docker folder

  rm -rf /DATA/docker

* Create the storage folder

mkdir -p /DATA/docker/devicemapper/devicemapper

* Create your pool. Let’s create a 250G file

dd if=/dev/zero of=/DATA/docker/devicemapper/devicemapper/data bs=1G count=0 seek=250 

This is it. You can now start docker service:

docker service start

Type docker info to see the ‘Data Space Total’ property value.
Download your images and start your containers. Inside a container type ‘df -h’. You should now see 90G of disk storage.

Posted in docker, linux | 1 Comment

Remove docker unneeded containers and images

Docker does not remove your old containers or images. This is your job, not docker’s.  But, at some point, some cleanup needs to be performed.

It is up to you to decide what to remove.  I show here an example of how I clean my docker containers and images.

How to I do it

List all containers and select, with grep, only containers  that needs to be deleted.

We list containers with docker ps. This command lists  one container per line, with these attributes: CONTAINER ID,   IMAGE,  COMMAND,  CREATED, STATUS, PORTS, CONTAINER NAME :

fc9f4ab5c23c registry:latest "docker-registry" 4 days ago Up 17 hours my_registry 

Deleting not needed containers

These are my rules to delete containers:

  • Do not delete any containers that contain any of these keywords in their name: registry:latest,nexus,keep
  • Only delete Exited containers (not running). In any case, docker will refuse to delete running containers
containers_to_keep=$(docker ps -a | grep 'keep\|registry:latest\|nexus' | awk '{ print $1 }')
containers_to_delete=$(docker ps -a | grep Exited | grep -Fv "$containers_to_keep" | awk '{ print $1 }')
docker rm $containers_to_delete || echo "Could not remove some containers"

Deleting not needed images

For images, I want to keep all latest versions and all images having any of these keywords in their name: keep,nexus.

images_to_keep=$(docker images | grep  'latest\|keep\|nexus' | awk '{ print $3 }')
images_to_delete=$(docker images | grep -Fv "$images_to_keep" | awk '{ print $3 }')
docker rmi $images_to_delete || echo "Could not remove some images"

This is it.

Posted in Cracking the coding interview - a python experience | Leave a comment