戻る


Ubuntuに対して、Oracleのインストールを試みてみる。

XE (EXPRESS)は Ubuntuに対して実績があるようなので、XEでチャレンジする事にした。


http://www.fourmeisters.com/blog/kimada/2007/12/vmware_player_ubuntu_linux_ora_1.html

 

リポジトリの追加

/etc/apt/sources.list に、オラクル系のリポジトリを追加

deb http://oss.oracle.com/debian unstable main non-free

aptのキーをダウンロードしてインポートする。

$ wget http://oss.oracle.com/el4/RPM-GPG-KEY-oracle -O- | sudo apt-key add -

--03:10:09-- http://oss.oracle.com/el4/RPM-GPG-KEY-oracle
=> `-'
oss.oracle.com をDNSに問いあわせています... 141.146.12.120
oss.oracle.com|141.146.12.120|:80 に接続しています... 接続しました。
HTTP による接続要求を送信しました、応答を待っています... 200 OK
長さ: 1,744 (1.7K) [text/plain]

100%[======================================================>] 1,744 --.--K/s

03:10:10 (62.37 MB/s) - `-' を保存しました [1744/1744]

OK
 

パッケージのリストを更新する。

$ sudo apt-get update

 …
取得:23 http://security.ubuntu.com hardy-security/multiverse Packages [11.9kB]
取得:24 http://security.ubuntu.com hardy-security/multiverse Sources [1105B]
1283kB を 10s で取得しました (119kB/s)
パッケージリストを読み込んでいます... 完了

ORACLE XE パッケージのダウンロードとインストールを実行する。

$ sudo apt-get install oracle-xe-universal

パッケージリストを読み込んでいます... 完了
依存関係ツリーを作成しています
状態情報を読み取っています... 完了
以下のパッケージが自動でインストールされましたが、もう必要とされていません:
ipamonafont libestraier8 libqdbm14 opfc-modulehp-ipamonafont-source opfc-modulehp
これらを削除するには 'apt-get autoremove' を利用してください。
以下の特別パッケージがインストールされます:
libaio
以下のパッケージが新たにインストールされます:
libaio oracle-xe-universal
アップグレード: 0 個、新規インストール: 2 個、削除: 0 個、保留: 4 個。
262MB のアーカイブを取得する必要があります。
この操作後に追加で 451MB のディスク容量が消費されます。
続行しますか [Y/n]? Y


取得:1 http://oss.oracle.com unstable/main libaio 0.3.104-1 [6018B]
取得:2 http://oss.oracle.com unstable/non-free oracle-xe-universal 10.2.0.1-1.1 [262MB]
262MB を 8min16s で取得しました (529kB/s)
未選択パッケージ libaio を選択しています。
(データベースを読み込んでいます ... 現在 156778 個のファイルとディレクトリがインストールされています。)
(.../libaio_0.3.104-1_i386.deb から) libaio を展開しています...
未選択パッケージ oracle-xe-universal を選択しています。
(.../oracle-xe-universal_10.2.0.1-1.1_i386.deb から) oracle-xe-universal を展開しています...
libaio (0.3.104-1) を設定しています ...

oracle-xe-universal (10.2.0.1-1.1) を設定しています ...
Executing Post-install steps...
-e You must run '/etc/init.d/oracle-xe configure' as the root user to configure the database.


Processing triggers for libc6 ...
ldconfig deferred processing now taking place

サービス起動時の設定オプションを指定する。

$ sudo /etc/init.d/oracle-xe configure

Oracle Database 10g Express Edition Configuration
-------------------------------------------------
This will configure on-boot properties of Oracle Database 10g Express
Edition. The following questions will determine whether the database should
be starting upon system boot, the ports it will use, and the passwords that
will be used for database accounts. Press <Enter> to accept the defaults.
Ctrl-C will abort.

Specify the HTTP port that will be used for Oracle Application Express [8080]:8070

Specify a port that will be used for the database listener [1521]:1521

Specify a password to be used for database accounts. Note that the same
password will be used for SYS and SYSTEM. Oracle recommends the use of
different passwords for each database account. This can be done after
initial configuration:sys

Password can't be null. Enter password:
Confirm the password:sys

Do you want Oracle Database 10g Express Edition to be started on boot (y/n) [y]:n

Starting Oracle Net Listener...Done
Configuring Database...

Installation Completed Successfully.
To access the Database Home Page go to "http://127.0.0.1:8070/apex"

クライアント環境変数の設定

/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/oracle_env.sh

上記のシェルを流せばよいのだが、下記のエラーを直さないと エラーがでる

$ sudo vi /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/nls_lang.sh

108行目あたり

# Detertmine the LANGUAGE_TERRITORY part of NLS_LANG
# we derive it from the current locale by inspecting the LC_ALL and
# the LANG environment variable. Other LC_* environment variables
# are not inspected.
#
if [ -n "$LC_ALL" ]; then
locale=$LC_ALL
elif [ -n "$LANG" ]; then
locale=$LANG
else
locale=
fi


Oracle Application Expressを、ホストOS側のWebブラウザからも使用できるようにする。
デフォルトでは、ローカルのWebブラウザからしか使用できないようになっていますが、ホストOS側から使えた方が、何かと便利なので、この設定は行っておいた方がいいと思います。
$ sqlplus system

と、あるが、コマンドが command not found となってしまう。

sqlplus  は /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin に存在していたが、直接打っても

Error 6 initializing SQL*Plus
Message file sp1<lang>.msb not found
SP2-0750: You may need to set ORACLE_HOME to your Oracle software directory

と、エラーとなってしまう。

オラクルの開始/終了などのコマンドは 以下にある
/etc/init.d/oracle-xe {start|stop|restart|force-reload|configure|status|enable|disable}
#にて 投入する事。

原因は …/oracle_env.sh の実行結果が正しく反映されていないのではないか。
oracle_env.shの中身を直接 投入したら sqlplus も 打つことができた。

なぜ …/oracle_env.sh が ただしく反映されないのだろうか。

原因
…/oracle_env.sh を起動するときに、. (ピリオド)をつけずにながしていたので、呼び元のシェルプロセスには反映されてなかったみたいですね。


$ . /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/oracle_env.sh

このように ピリオド付きで毎回実行すればよいが、大変なので、~/.bashrc の最後の行に追加した。

$ source .bashrc で 設定内容の反映

env を打ち込んで、
ORACLE_SID=XE
PATH=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin:
ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server
が含まれていたら、OK


SQL*Plus: Release 10.2.0.1.0 - Production on 月 6月 15 00:59:48 2009

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

ユーザー名を入力してください: system
パスワードを入力してください:


Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
に接続されました。
SQL>

やっと、つながった!

GUiの 指定は、 自端末から http://127.0.0.1:8070/apex  はつながったが、他端末からアドレス指定は、単純にはいかないようだ

他の端末から起動できるようにするには
 



オラクルの起動
# /etc/init.d/oracle-xe start

オラクルの停止
# /etc/init.d/oracle-xe stop

リスナーの状態をみるコマンド
$ lsnrctl status

リスナーの起動
$ lsnrctl start

LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 16-6月 -2009 22:32:41

Copyright (c) 1991, 2005, Oracle. All rights reserved.

/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/tnslsnrを起動しています。お待ちください...

TNSLSNR for Linux: Version 10.2.0.1.0 - Production
NL-00280: ログ・ストリーム/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/network/log/listener.logの作成のエラー。
NL-00278: ログ・ファイルをオープンできません。
SNL-00016: snlfohd: ファイルのオープンに・

リスナーが起動に失敗しました。前述のエラー・メッセージを参照してください...

このようなエラーが発生した

http://ameblo.jp/t-kobayashi0906/entry-10125782439.html

http://otn.oracle.co.jp/forum/message.jspa?messageID=19003802

http://otndnld.oracle.co.jp/document/products/oracle10g/101/doc_v12/server.101/B12448-02/tnsus.htm

http://www.fiberbit.net/user/kunyami/oracle/xe/install.html

 

/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/network/admin/tnsnames.ora
の赤字を部分をコメントアウトすれば良い? どういう意味?

# listener.ora Network Configuration File:

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = /usr/lib/oracle/xe/app/oracle/product/10.2.0/server)
      (PROGRAM = extproc)
    )
  )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
#      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC_FOR_XE))
      (ADDRESS = (PROTOCOL = TCP)(HOST = a50)(PORT = 1521))
    )
  )

#DEFAULT_SERVICE_LISTENER = (XE)

 

リスナーの停止
$ lsnrctl stop

 


基本的な設定はしてみよう

 


戻る