LoginSignup
18
13

More than 5 years have passed since last update.

amazon linux に sqlplus をインストール

Last updated at Posted at 2015-08-18

amazon linux に sqlplus を入れたときのメモ

  • パッケージの入手先

http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html
(先にユーザーIDをつくってサインインしておく必要があり)

上記URIに、さまざまなパッケージがあるが、今回はsqlplusだけ欲しかったので

oracle-instantclient12.1-sqlplus-12.1.0.2.0-1.x86_64.rpm をダウンロードした。

  • インストール

rpmなので、rpmコマンドでインストール

# rpm -ivh oracle-instantclient12.1-sqlplus-12.1.0.2.0-1.x86_64.rpm 
Preparing...                          ################################# [100%]
Updating / installing...
   1:oracle-instantclient12.1-sqlplus-################################# [100%]

これで、sqlplus64コマンドおよび必要なライブラリがインストールされる。

  • ライブラリのパス設定

インストールしただけでは

# sqlplus64 
sqlplus64: error while loading shared libraries: libsqlplus.so: cannot open shared object file: No such file or directory

という悲しい結果になるので、ライブラリのパスを通す必要がある。

ダウンロードページの下の方にインストール方法が書いてあって、その中にライブラリのパスを通すために環境変数を設定しろ、と書いてある。

export LD_LIBRARY_PATH=/usr/lib/oracle/12.1/client64/lib:$LD_LIBRARY_PATH

これを ~/.bashrc なんかに書いておけばよいのだが、それだとそのユーザのみ有効なので/etc/ld.so.conf.d/oracle.conf というファイルを作成し、ライブラリのパスを設定してみる。
(/etc/ld.so.confで include *.conf というような設定があるので拡張子が.confであればファイル名は何でもよい)

# cat /etc/ld.so.conf.d/oracle.conf 
/usr/lib/oracle/12.1/client64/lib

作成後、ldconfigコマンドを実行して設定を有効化する。

# ldconfig
# sqlplus64 

SQL*Plus: Release 12.1.0.2.0 Production on Tue Aug 18 13:45:32 2015

Copyright (c) 1982, 2014, Oracle.  All rights reserved.

Enter user-name: 
18
13
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
18
13