Help us understand the problem. What is going on with this article?

Linuxからsqlplusを利用してOracleに接続する

More than 3 years have passed since last update.

やってみた時のメモ。

参考

やってみた

上記リンクを参考にOracleのサイトから以下のrpmをダウンロード

  • oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64.rpm
  • oracle-instantclient12.1-sqlplus-12.1.0.2.0-1.x86_64.rpm

インストール

$sudo rpm -ivh oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64.rpm

$sudo rpm -ivh oracle-instantclient12.1-sqlplus-12.1.0.2.0-1.x86_64.rpm

LD_LIBRARY_PATHを設定する必要があるようなので以下で対応。

$sudo vi /etc/ld.so.conf.d/oracle.conf 
/etc/ld.so.conf.d/oracle.conf
/usr/lib/oracle/12.1/client64/lib
$ldconfig
$sqlplus64 -V

SQL*Plus: Release 12.1.0.2.0 Production

これでsqlplus64コマンドが利用できるので実際に接続してみます。
接続コマンドは以下を参考に実施。
ユーザー名、ホスト名、SIDは適宜変更。

Oracle DB インスタンスを作成して Oracle DB インスタンス上のデータベースに接続する

$sqlplus64 'root@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=xxxxx.ap-northeast-1.rds.amazonaws.com) (PORT=1521))(CONNECT_DATA=(SID=ORCL)))'

パスワードを入力することでログインできました。

Why do not you register as a user and use Qiita more conveniently?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away