Watch out for the permission of “tmp” directory during installation of SAP HANA

My colleague creates a SLES11SP3 docker image, and wants to install SAP HANA database in the SLES11SP3 container. But the error occurs during installation:

# ./hdbinst
......
Creating instance...
  hdbparam: Working configuration directory:  "/hana/shared/H00/global/hdb/custom/config"
  hdbnsutil: creating persistence ...
  hdbnsutil: writing initial topology...
  hdbnsutil: writing initial license: status check = 2
Installation failed
  error installing
    Cannot create Instance
      Cannot start sapstartsrv
        Waiting for sapstartsrv failed: timeout reached (120)
        Waiting for sapstartsrv failed: timeout reached (120)

Log file written to '/var/tmp/hdb_H00_install_2016-05-04_19.18.27/hdbinst.log' on host 'fe769d9f6bae'.

Check the /var/tmp/hdb_H00_install_2016-05-04_19.18.27/hdbinst.log:

19:22:42.406 - INFO:     Starting service
19:22:42.406 - INFO:       Starting external program /usr/sap/H00/HDB00/exe/sapstartsrv
19:22:42.406 - INFO:         Command line is: /usr/sap/H00/HDB00/exe/sapstartsrv pf=/hana/shared/H00/profile/H00_HDB00_fe769d9f6bae -D -u h00adm
19:22:42.438 - INFO:         Output line 1: Impromptu CCC initialization by 'rscpCInit'.
19:22:42.438 - INFO:         Output line 2:   See SAP note 1266393.
19:22:42.726 - INFO:         Output line 3: Impromptu CCC initialization by 'rscpCInit'.
19:22:42.726 - INFO:         Output line 4:   See SAP note 1266393.
19:22:42.857 - INFO:         Program terminated with exit code 0
19:22:42.857 - INFO:     Waiting for sapstartsv...
19:22:42.862 - INFO:       sapstartsrv is not running: Net::HTTPS: connect: Connection refused
19:22:43.864 - INFO:       sapstartsrv is not running: Net::HTTPS: connect: Connection refused
......
19:24:43.091 - ERR :       Waiting for sapstartsrv failed: timeout reached (120)
19:24:43.092 - INFO:     Checking unix domain socket
19:24:43.093 - ERR :       Cannot establish http connection to unix domain socket '/tmp/.sapstream50013' (No such file or directory)
19:24:43.093 - INFO:       sapstartsrv is not running: connect: No such file or directory
19:24:44.094 - ERR :       Cannot establish http connection to unix domain socket '/tmp/.sapstream50013' (No such file or directory)
19:24:44.094 - INFO:       sapstartsrv is not running: connect: No such file or directory
......

After tough debugging, the reason is the tmp folder doesn’t grant write permissions to users except root:

drwxr-xr-x    2 root root  4096 May  4 19:17 tmp

Change the permission of /tmp:

# chmod a+w /tmp

Then the installation is successful!

 

Using unixODBC to connect SAP HANA database

There are 2 methods of installing unixODBC:
(1) Use packages provides by OS vendors, such as:

yum install unixODBC

(2) Download the source code from unixODBC website, and build it:

./configure
make 
make install

Please notice: by default, the configuration files are in /etc/unixODBC:

# odbcinst -j
unixODBC 2.3.1
DRIVERS............: /etc/unixODBC/odbcinst.ini
SYSTEM DATA SOURCES: /etc/unixODBC/odbc.ini
FILE DATA SOURCES..: /etc/unixODBC/ODBCDataSources
USER DATA SOURCES..: /root/.odbc.ini
SQLULEN Size.......: 8
SQLLEN Size........: 8
SQLSETPOSIROW Size.: 8

And this may introduce the following connection error:

# isql HDB system xxxxxx -v
[08S01][unixODBC][SAP AG][LIBODBCHDB SO][HDBODBC] Communication link failure;-10709 Connect failed (no reachable host left)
[ISQL]ERROR: Could not SQLConnect

The solution is either you create a symbol link of /etc/odbc.ini which points to /etc/unixODBC/odbc.ini:

ln -s /etc/unixODBC/odbc.ini /etc/odbc.ini

Or when compiling from source code, specify the sysconfdir option in configuring process:

./configure --sysconfdir=/etc

The odbc.ini file is like this:

[HDB]
Driver = /usr/sap/hdbclient/libodbcHDB.so
servernode = localhost:30015

The 00 in 30015 is the instance number of SAP HANA.

When using isql to connect SAP HANA database, if not provide user name and password, the error message is a little confused:

# isql HDB -v
[08S01][unixODBC][SAP AG][LIBODBCHDB SO][HDBODBC] Communication link failure;-10709 Connection failed (RTE:[-1] Kerberos error. Major: "unspecified [851968]", minor: "No Kerberos credentials available [2529639053/-1765328243]")
[ISQL]ERROR: Could not SQLConnect

But after specifying the user name and password, the connection is OK:

# isql HDB system xxxxxx -v
+---------------------------------------+
| Connected!                            |
|                                       |
| sql-statement                         |
| help [tablename]                      |
| quit                                  |
|                                       |
+---------------------------------------+
SQL>

Reference:
Connect to HANA with unixODBC fails.

 

Install openssl-0.9.8 for SAP HANA

SAP HANA has a special love for openssl-0.9.8, so to install SAP HANA, you must first get openssl-0.9.8 dynamic library ready:

(1) Download openssl-0.9.8 source code from here, and uncompress it.

(2) To build dynamic library, you should add shared option when configuring:

./config shared
make
make install_sw

(3) Because the default installation directory is /usr/local/ssl, to let SAP HANA find the openssl library, you should add/usr/local/ssl/lib into /etc/ld.so.conf file:

# cat /etc/ld.so.conf
/usr/local/ssl/lib
/usr/local/lib64
/usr/local/lib
include /etc/ld.so.conf.d/*.conf
# /lib64, /lib, /usr/lib64 and /usr/lib gets added
# automatically by ldconfig after parsing this file.
# So, they do not need to be listed.

Then execute ldconfig command:

# ldconfig

It is OK for installing SAP HANA now.