osted by 2muchtea under LD_LIBRARY_PATH, Oracle, Ubuntu, instantclient, oci, ruby, ruby-oci8, sqlplus | Tags: build-essential, instantclient, ldd, LD_LIBRARY_PATH, libaio, libsqlplus.so, mkmf, mkmf.log, oci, ORA-12154, Oracle, ruby, ruby-oci8, sqlplus, strace, TNS_ADMIN, Ubuntu
Having fixed
the problem with the KVM switch on my machine I proceed to get my Ruby
scripts working on Ubuntu. Installing Ruby and getting Rails is a
breeze. The problem starts when I need to install ruby-oci8
.
You cannot get this by doing a gem install….need to download the tar.gz
file and run the setup. I try to use tar -xvf ruby-oci8-1.0.0.tar.gz
but it fails. (some problem with the header of the file). I then use
gzip and tar commands separately and it works.
To install ruby-oci8 you can either do this
make
make install
or do this
ruby setup.rb config
ruby setup.rb setup
ruby setup.rb install
When I try them, both fail. Looking at the error I see that I need
to configure ORACLE_HOME (in case of Oracle) or need to configure
LD_LIBRARY_PATH (in case of Oracle Instant Client). I know that I don’t
have them on my machine so I proceed to get the Oracle Instant Client
.
I read some blogs (see References) and find that I need the basic.zip
and sdk.zip packages. I download them and unzip them at this location
/opt/oracle/instantclient (need to sudo). Having done that I set my
LD_LIBRARY_PATH to /opt/oracle/instantclient.
LD_LIBRARY_PATH=/opt/oracle/instantclient
export LD_LIBRARY_PATH
I then proceed to create two symlinks
ln -s libclntsh.so.11.1 libclntsh.so
ln -s libocci.so.11.1 libocci.so
Note
: In the above case, the names would depend on the version of the instant client that you have.
I go back to try out the ruby-oci8 setup and it fails again. Back to
square one and I seem to have run out of ideas. A friend suggests me to
check if the instant client works properly by installing sqlplus and
connecting to the database. I go ahead with that (I would need sqlplus
anyways).
I get the sqlplus.zip file from here
.
Unzip it to the location /opt/oracle/instantclient. I now go ahead and
set the environment variables through the command line. (I have the
LD_LIBRARY_PATH set already) and add my tnsnames.ora file to the same
location.
PATH=$PATH:/opt/oracle/instantclient
SQLPATH=/opt/oracle/instantclient
export SQLPATH
TNS_ADMIN=/opt/oracle/instantclient
export TNS_ADMIN
I try this command at the command line now. (where the username , password and tnsnames have appropriate variables)
sqlplus username/password@tnsname
I get this now:
sqlplus: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory
What the !! Now what is this supposed to be?? I read more and run these commands:
ldd sqlplus
strace sqlplus
The first command gives me a list of library dependencies that
sqlplus requires and the second command (strace) gives me a trace of
system calls and signals. (see man pages of the command for details).
Both indicate that a library (libaio) is missing. I run the following
command :
sudo apt-get install libaio-dev
Now when I try to run sqlplus I get this error:
SQL*Plus: Release 11.1.0.6.0 - Production on Fri Dec 21 12:57:36 2007
Copyright (c) 1982, 2007, Oracle. All rights reserved.
ERROR:
ORA-12154: TNS:could not resolve the connect identifier specified
At least I am close. Hmmm…problem with the tnsnames. Soon, I find
that I had set TNSADMIN instead of TNS_ADMIN. sqlplus runs once i
correct that. So, I can now connect to the database and am sure that
the instantclient is installed correctly. Back to ruby-oci8 now.
Running the setup gives me the same problem. This time however I notice
that the instantclient is recognized but there is this error (I guess
the instantclient was not the problem after all …doh !!)
checking for cc... ---------------------------------------------------
error messages:
Permission denied - mkmf.log
---------------------------------------------------
I see that mkmf.log exists in the oci8 dir structure and has root
privileges. So, I need to run the setup as root. But since all the
environment variables are set on my login the setup complains that it
does not see LD_LIBRARY_PATH. I go ahead and add all environment
variables to /etc/profile. For global environment variables in Ubuntu
see this
. I restart my shell and run the following.
sudo -i
ruby setup.rb config
ruby setup.rb setup
ruby setup.rb install
Success. oci8 now installs without complaints. I try my ruby scripts
and everything looks good. The fruit of persistence is definitely sweet.
UPDATES:
I was helping a friend install oci8 on his machine when we faced some more hurdles. Adding them here:
1. mkmf not found: You will need the development version of Ruby. sudo apt-get install ruby1.8-dev
2. Make sure you install 32 bit versions and not 64 bit ones.
3. If you see this error : “libsqlplus.so: cannot open shared object file:”
,
you are missing the instantclient path. Somehow adding the path in
/etc/profile did not get picked up in our case. We had to add it in the
.bashrc file. Make sure you open a new terminal after the changes.
4. If you have problems running ruby setup, install etc (see the last
step above), check to see if you have the build-essential package
installed: sudo apt-get install build-essential
References:
http://ubuntuforums.org/archive/index.php/t-92528.html
http://roqet.org/oracle_instantclient.html
http://ruby-oci8.rubyforge.org/en/InstallForInstantClient.html
http://craiccomputing.blogspot.com/2007/01/using-oracle-as-backend-to-rails.html
http://ubuntuforums.org/archive/index.php/t-535311.html
http://rubyforge.org/forum/forum.php?thread_id=13948&forum_id=1078
https://help.ubuntu.com/community/EnvironmentVariables
Technorati Tags: ruby-oci8
, sqlplus
, LD_LIBRARY_PATH
, libaio
, TNS_ADMIN
, strace
, ldd
, Ubuntu
, ruby
, oci
, mkmf.log
, Oracle
分享到:
相关推荐
安装mumax3最全教程
安装vissim4.3 ,出现 installing plug-ins,please wait,卡住无法继续。解决办法
TUTORIAL FOR INSTALLING MINIX-386 MINIX 升级到 MINIX-386的经典 John Nall写的关于如何使用Bruce Evans的补丁程序将MINIX 1.5.10版升级到MINIX-386的说明。
The Windows platform has several options for installing Ruby. The first option is simply installing the compiled binaries. The second option is to use the one-click installer. If you’re unsure about ...
Installing STLinux on Ubuntu
Installing Activ Test on Your PC
quantum espresso 视频可以认真学习 进行入门,非常不错的材料 给大家进行分享,值得拥有
Mini-XML supports reading of UTF-8 and UTF-16 and writing of UTF-8 encoded XML files and strings. Data is stored in a linked-list tree structure, preserving the XML data hierarchy, and arbitrary ...
8. Set the CLASSPATH C:\Ruby192\bin – This is done by adding System Variables 9. Go to Cmd Prompt –> c:\Ruby192\bin>gem install selenium-client-1.2.18.gem Once you install selenium-client you should...
Microsoft Windows 2000 Scripting Guide - Installing Software on a Remote Computer
xtensa-esp32-elf-gcc8_4_0-esp-2021r2-patch2-win32 esp32资源for windows_x64(2022.03.22)
面是我在Ubuntu6.06 LTS 下源码编译安装samba主要安装过程,本人第一次用Ubuntu,刚装上去时候,没有gcc编译环境。郁闷了半天。找出这一过程发了不少的时间。可能还有些不妥,不过我经过这样的安装达到了向windows共享...
luci-i18n-base-zh-cn_git-22.115.68448-712bc8e-1_all.ipk
下载Harbor注册表的SSL根证书(请参见下图),然后将其移至要运行安装程序的工作站上的/tmp/harbor.crt 请遵循文档- Prerequisites部分请遵循文档-利用此处提供的一些示例进行Installing部分-$ docker login ...
ERROR: Error installing ruby-debug-base: The 'linecache' native gem requires installed build tools. Please update your PATH to include build tools or download the DevKit from '...
Now it's time to compile and install Asterisk. Let's change to the directory which contains the Asterisk source code. 从源代码安装 asterisk sipserver VOIP RTP pjsip webrtc
Oracle Database 11g Release 2 (11.2.0.3) RAC On Oracle Linux 6.3 Using VirtualBox This article describes the installation of Oracle Database 11g release 2 (11.2.0.3 64-bit) RAC on Linux (Oracle Linux ...
插件方式安装 zend studio,PDF文档
C:\>gem install watirERROR: Error installing watir: activesupport requires Ruby version >= 1.8.7. I have installed activesupport-2.3.8 as suggested by Charley Baker, and I was able to install Watir: ...
openedx 运行手册