Install Oracle ODBC Connector on Solaris

The following install was on x86 Solaris 10. The steps are similar on a Sparc Solaris 10 and on Solaris 11. Download the appropriate ZIP files (instantclient-basic and instantclient-odbc) to a directory. For example, /tmp/Oracle.

For Solaris Sparc 10, the 2 hosts pbul-qa-spsol11z-01 and pbul-qaspsol11z-02 already have Oracle ODBC installed. When installing EPM-UL, you must create odbc.ini in /opt/<prefix>pbul<suffix>/etc.

PMUL binaries are 32-bit. You must ensure 32-bit versions of unixODBC and Oracle ODBC connectors are installed on Solaris 10 and 11.

  1. Step 1 is the same as for Linux. Use the existing Oracle database/server and create your user.
  2. Run the following steps on the log server:
    # pkgadd -d http://get.opencsw.org/now
    # export PATH=$PATH:/opt/csw/bin
    # pkgutil -U -u -y
    # pkgutil -i -y unixodbc
    # mkdir /opt/oracleODBC
    # cd /opt/oracleODBC/
    # unzip /tmp/Oracle/instantclient-basic-solaris.x32-18.3.0.0.0dbru.zip
    # unzip /tmp/Oracle/instantclient-odbc-solaris.x32-18.3.0.0.0dbru.zip
    # unzip /tmp/Oracle/instantclient-sqlplus-solaris.x32-18.3.0.0.0dbru.zip
  3. In pb.settings set:
    eventdestinations authevt=odbc=Oracle
    odbcinidir  /opt/pbul/etc
  4. Create /etc/tnsnames.ora:
    # cat /etc/tnsnames.ora
    ORCLCDB=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=moonfish)(PORT=1521)))(CONNECT_DATA=(SID=ORCLCDB)))

The tnsnames.ora file needs to be in /etc. Copying it elsewhere and setting TNS_ADMIN to the new directory does not work.

  1. Create /opt/pbul/etc/odbcinst.ini:
    [oracle]
    Description = Oracle 18
    Driver      = /opt/oracleODBC/instantclient_18_3/libsqora.so.18.1
    ServerName  = ORCLCDB
  2. Create /opt/pbul/etc/odbc.ini:
    [oracle]
    Description = Oracle
    Driver      = oracle
    DSN         = ORCLCDB
    ServerName  = ORCLCDB
    UserID      = mdavis
    Password    = mdavis

Use the user name you created in step 1.

  1. Set LD_LIBRARY_PATH and TNS_ADMIN for the pblighttpd service:
    svccfg -s application/security/pblighttpd setenv LD_LIBRARY_PATH /opt/oracleODBC/instantclient_18_3:/opt/csw/lib
    svccfg -s application/security/pblighttpd setenv TNS_ADMIN /etc
    svcadm refresh pblighttpd
    svcadm restart pblighttpd
  2. Set LD_LIBRARY_PATH in the environment for pblog to work. Add the following to /etc/profile:
    LD_LIBRARY_PATH="/usr/lib:/lib:/opt/oracleODBC/instantclient_18_3:/opt/csw/lib"
    export LD_LIBRARY_PATH
    TNS_ADMIN=/etc
    export TNS_ADMIN

 

Make sure /usr/lib is first in LD_LIBRARY_PATH.

  1. To use oracle SSL authentication, create sqlnet.ora file, update TNS_NAMES configurations for pblighttpd and restart pblighttpd.
    • Create /etc/sqlnet.ora.
    #cat /etc/sqlnet.ora
    SQLNET.AUTHENTICATION_SERVICES= (TCPS)
    SSL_CLIENT_AUTHENTICATION = FALSE
    SSL_CIPHER_SUITES = (SSL_RSA_WITH_AES_256_CBC_SHA, SSL_RSA_WITH_3DES_EDE_CBC_SHA)
    SSL_SERVER_DN_MATCH = no
    WALLET_LOCATION = (SOURCE =(METHOD = FILE)(METHOD_DATA =(DIRECTORY = /home/oracle/app/oracle/wallet)) )
    ls /etc/*.ora
    /etc/sqlnet.ora  /etc/tnsnames.ora
    
    • Set the environment variable TNS_ADMIN=/etc/ to pblighttpd service.

    Use the below commands to set the variable:

    svccfg -s pblighttpd setenv TNS_NAME /etc/
    svcadm refresh pblighttpd
    

    Validate the configuration using below command:

    svcprop -p start/environment pblighttpd

TNS_ADMIN is the location from where ODBC drivers read sqlnet.ora and tnsnames.ora.

    • Restart pblighttpd.

  1. Run pbrun and verify using:
    # pblog --odbc -f Oracle

Export TNS_ADMIN=/etc if you are using oracle SSL connections.

  1. Check pbrest.log and other logs to make sure there is no error.

 

Set LD_LIBRARY_PATH with /opt/csw/lib:

When LD_LIBRARY_PATH is set to contain /opt/csw/lib without /usr/lib first, and we either validate or import pblighttpd-smf.xml, svccfg segfault on Solaris:

# LD_LIBRARY_PATH=/opt/oracleODBC/instantclient_18_3:/opt/csw/lib
# svccfg validate /usr/lib/beyondtrust/pb/rest/etc/pblighttpd-smf.xml
Segmentation Fault (core dumped)
#
# LD_LIBRARY_PATH=/opt/oracleODBC/instantclient_18_3
# svccfg validate /usr/lib/beyondtrust/pb/rest/etc/pblighttpd-smf.xml

Or

# LD_LIBRARY_PATH=/usr/lib:/opt/oracleODBC/instantclient_18_3:/opt/csw/lib
        # svccfg validate /usr/lib/beyondtrust/pb/rest/etc/pblighttpd-smf.xml

The reason for the segfault is a library conflict in /usr/lib and /opt/csw/lib.

# ldd /usr/sbin/svccfg
libxml2.so.2 =>  /usr/lib/libxml2.so.2
libscf.so.1 =>   /usr/lib/libscf.so.1
libl.so.1 =>     /usr/lib/libl.so.1
libuutil.so.1 =>         /usr/lib/libuutil.so.1
libumem.so.1 =>  /usr/lib/libumem.so.1
libdoor.so.1 =>  /usr/lib/libdoor.so.1
libmd5.so.1 =>   /usr/lib/libmd5.so.1
libtecla.so.1 =>         /usr/lib/libtecla.so.1
libc.so.1 =>     /usr/lib/libc.so.1
libpthread.so.1 =>       /usr/lib/libpthread.so.1
libz.so.1 =>     /usr/lib/libz.so.1
libm.so.2 =>     /usr/lib/libm.so.2
libsocket.so.1 =>        /usr/lib/libsocket.so.1
libnsl.so.1 =>   /usr/lib/libnsl.so.1
libgen.so.1 =>   /usr/lib/libgen.so.1
libcurses.so.1 =>        /usr/lib/libcurses.so.1
libmp.so.2 =>    /usr/lib/libmp.so.2
libmd.so.1 =>    /usr/lib/libmd.so.1
/platform/sun4v/lib/libc_psr.so.1
/lib/libm/libm_hwcap1.so.2
/platform/sun4v/lib/libmd_psr.so.1

If LD_LIBRARY_PATH does not have /usr/lib first, we get:

# LD_LIBRARY_PATH=/opt/oracleODBC/instantclient_18_3:/opt/csw/lib
# ldd /usr/sbin/svccfg
libxml2.so.2 =>  /usr/lib/libxml2.so.2
libscf.so.1 =>   /lib/libscf.so.1
libl.so.1 =>     /usr/lib/libl.so.1
libuutil.so.1 => /lib/libuutil.so.1
libumem.so.1 =>  /lib/libumem.so.1
libdoor.so.1 =>  /lib/libdoor.so.1
libmd5.so.1 =>   /lib/libmd5.so.1
libtecla.so.1 => /usr/lib/libtecla.so.1
libc.so.1 =>     /lib/libc.so.1
libpthread.so.1 =>  /lib/libpthread.so.1
libz.so.1 =>     /opt/csw/lib/libz.so.1
libz.so.1 (SUNW_1.1) =>  (version not found)
libm.so.2 =>     /lib/libm.so.2
libsocket.so.1 => /lib/libsocket.so.1
libnsl.so.1 =>   /lib/libnsl.so.1
libgen.so.1 =>   /lib/libgen.so.1
libcurses.so.1 => /lib/libcurses.so.1>
libmp.so.2 =>    /lib/libmp.so.2
libmd.so.1 =>    /lib/libmd.so.1
/platform/sun4v/lib/libc_psr.so.1
/lib/libm/libm_hwcap1.so.2
/platform/sun4v/lib/libmd_psr.so.1

For more information, see Install Oracle ODBC Connector on Linux.