Wednesday, August 23, 2017

OBIEE 12c : Environment Variables on Linux

This is just a quick one for all those who want to what environment variables should be set to use the OBIEE 12c environment on Linux environment. Make sure to include this list in the .bash_profile file of the Linux user used to run the OBIEE Application.

For those who are not aware of the .bash_profile location, the file will be in hidden mode in user home directory ( generally the directory you will be landed as soon as you login ). Can also find from environment variable HOME as per below.

[oracle@MyLinux oracle]$ pwd
/user/oracle
[oracle@MyLinux oracle]$echo $HOME
/user/oracle
[oracle@MyLinux oracle]$ l.

You can see the same using WinSCP. The assumptions here are OBIEE is installed as per below

/oracle/applications/OBIEE12c - Software Installtion
/oracle/applications/OBIEE12c/Domain_Home - Domain is installed here
/oracle/applications/OBIEE12c/Oracle_Home - FMW is installation directory

Open the .bash_profile file and add the below as needed

PATH=$PATH:$HOME/.local/bin:$HOME/bin
export JAVA_HOME=/oracle/applications/Java/jdk1.8.0_144
export LANG=en_US.UTF-8
export DOMAIN_HOME=/oracle/applications/OBIEE12c/Domain_Home/bi
export ORACLE_HOME=/oracle/applications/OBIEE12c/Oracle_Home
export BI_PRODUCT_HOME=/oracle/applications/OBIEE12c/Oracle_Home/bi
export BI_ORACLE_HOME=/oracle/applications/OBIEE12c/Oracle_Home/bi
export COMMON_COMPONENTS_HOME=$ORACLE_HOME/oracle_common
export ORACLE_DOMAIN_CONFIG_DIR=$DOMAIN_HOME/config/fmwconfig
export ORACLE_BI_ENVIRONMENT_DIR=$ORACLE_DOMAIN_CONFIG_DIR/bienv
export WL_HOME=$ORACLE_HOME/wlserver
export ORACLE_BI_CONFIG_DIR=$DOMAIN_HOME/config/fmwconfig/biconfig
export ODBCINI=/oracle/applications/OBIEE12c/Domain_Home/bi/config/fmwconfig/bienv/core/odbc.ini
export AMAZONREDSHIFTODBC=/userhome/oraclebi/.amazon.redshiftodbc.ini 
export ODBCHOME=/opt/amazon/redshiftodbc
export LIBPATH=$ODBCHOME/lib/64
export LD_LIBRARY_PATH=/opt/amazon/redshiftodbc/lib/64:/usr/local/lib:$ODBCHOME/lib/64:/usr/lib64:/usr/lib
export PATH=/oracle/applications/Java/jdk1.8.0_144/bin:$PATH:$ODBCHOME:/usr/lib64:/usr/lib:$JAVA_HOME/bin

Wednesday, August 16, 2017

Linux ODBC : GLIBCXX_3.4.20 not found, [RESOLVED]

I have done a setup of ODBC for Amazon Redshift on RedHat Linux 7.2 recently as per my earlier post OBIEE 12c: Amazon Redshift ODBC setup which was done a year ago.

All went well except i was not able to use the ODBC driver as it throws errors.

First i tried to see if my configuration was correct, the first step is to see if my DSN shows up or not.

To test this i use the odbcinst command 

[oracle@My-Linux ~]$ odbcinst -q -s
[ODBC]
[AnalyticsWeb]
[opss_datasource]
[biplatform_datasource]
[Redshift]

Next thing is to check if the DSN listed is working or not, which can be done using i sql

[oracle@My-Linux ~]$ isql -v Redshift
[01000][unixODBC][Driver Manager]Can't open lib '/opt/amazon/redshiftodbc/lib/64/libamazonredshiftodbc64.so' : file not found
[ISQL]ERROR: Could not SQLConnect

As the error says the file libamazonredshiftodbc64.so is not accessible for the ODBC manager, we will try and access the same to see if it has any issues.

[oracle@My-Linux ~]$ ldd /opt/amazon/redshiftodbc/lib/64/libamazonredshiftodbc64.so
/opt/amazon/redshiftodbc/lib/64/libamazonredshiftodbc64.so: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /opt/amazon/redshiftodbc/lib/64/libamazonredshiftodbc64.so)
        linux-vdso.so.1 =>  (0x00007fff88ffe000)
        libdl.so.2 => /usr/lib64/libdl.so.2 (0x00007faf36d23000)
        libpthread.so.0 => /usr/lib64/libpthread.so.0 (0x00007faf36b06000)
        librt.so.1 => /usr/lib64/librt.so.1 (0x00007faf368fe000)
        libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x00007faf365f5000)
        libm.so.6 => /usr/lib64/libm.so.6 (0x00007faf362f2000)
        libgcc_s.so.1 => /usr/lib64/libgcc_s.so.1 (0x00007faf360dc000)
        libc.so.6 => /usr/lib64/libc.so.6 (0x00007faf35d1b000)
        /lib64/ld-linux-x86-64.so.2 (0x00007faf39937000)


You can now see that the GLIBCXX_3.4.20 was not found in libstdc++.so.6 library file. Let us see what the file has to confirm if its available or not.

[oracle@My-Linux ~]$ strings /usr/lib64/libstdc++.so.6 | grep GLIBCXX               
GLIBCXX_3.4
GLIBCXX_3.4.1
GLIBCXX_3.4.2
GLIBCXX_3.4.3
GLIBCXX_3.4.4
GLIBCXX_3.4.5
GLIBCXX_3.4.6
GLIBCXX_3.4.7
GLIBCXX_3.4.8
GLIBCXX_3.4.9
GLIBCXX_3.4.10
GLIBCXX_3.4.11
GLIBCXX_3.4.12
GLIBCXX_3.4.13
GLIBCXX_3.4.14
GLIBCXX_3.4.15
GLIBCXX_3.4.16
GLIBCXX_3.4.17
GLIBCXX_3.4.18
GLIBCXX_3.4.19
GLIBCXX_DEBUG_MESSAGE_LENGTH

So it is true that the GLIBCXX_3.4.20  is missing which is required by the Amazon driver, which is the root cause for the issue. Now lets see what can be done to resolve this.

We have to basically update the libstdc++ to a higher version which includes the GLIBCXX_3.4.20. For me the below command worked.

[oracle@My-Linux ~] yum update libstdc++

Depending on your OS you can update using different commands like

sudo apt-get install libstdc++6Above command will install it if not already donesudo add-apt-repository ppa:ubuntu-toolchain-r/test sudo apt-get updatesudo apt-get upgradesudo apt-get dist-upgrade

Now try and run the isql command with username and password to verify the connection.
[oracle@My-Linux ~]$ isql Redshift username password
+---------------------------------------+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
+---------------------------------------+
SQL>

Oracle DB : Get the Oracle Database version using a SQL Query

To find the Oracle DB Version to which you are connected now use the below queries.

select * from v$version;

The Results will be as below, The database version i used is 11.2.0.3

Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
PL/SQL Release 11.2.0.3.0 - Production"CORE 11.2.0.3.0 Production"
TNS for Linux: Version 11.2.0.3.0 - Production
NLSRTL Version 11.2.0.3.0 - Production


Sometimes the above command may result in Table or view doesn't exist error, reason can be you are not a DBA.

The below can be used as an alternative.

select * from product_component_version;

The Results for the above command will be like below.

PRODUCT VERSION STATUS
NLSRTL 11.2.0.3.0 Production
Oracle Database 11g Enterprise Edition 11.2.0.3.0 64bit Production
PL/SQL 11.2.0.3.0 Production
TNS for Solaris: 11.2.0.3.0 Production

Linux : Find all files containing specific text on Linux


The most common requirement these days is to find something that you have saved sometime ago in some file in a discrete folder, most importantly he one which you dont remember currently.Windows is pretty staright forward that everyone knows how to serach a file and I will not bore you with details.

However Linux is a different game when it comes to searching files and its contents. We will see a command that will let us do that work in simple and easy to remember manner.
            grep -rnw '/path/to/folder/' -e 'string'               
-r or -R is recursive,
-n is line number, and
-w stands for match the whole word.
-l (lower-case L) can be added to just give the file name of matching files.

Along with above options a few others like , --exclude, --include, --exclude-dir or --include-dir flags could be used for more efficient searching:


This below command will only search through the files which have .properties or .sh extensions:

           grep --include=\*.{properties,sh} -rnw '/path/to/folder/' -e "string"       

This below command will exclude searching all the files ending with .txt extension:

            grep --exclude=*.txt -rnw '/path/to/folder/' -e "string"                           

Just like exclude files, it's possible to exclude/include directories through --exclude-dir and --include-dir parameter. For example, this will exclude the dirs dir1/, dir2/ and all of them matching *.ext/:

            grep --exclude-dir={dir1,dir2,*.ext} -rnw '/path/to/folder/' -e "string"     

Hope you got what you came for.