Oracle Database 10g Express Edition(XE)のインストール

勉強する必要に迫られ、とりあえずXEをインストールしました。

必要なパッケージのインストール

$ sudo aptitude install libaio1 bc

Oracle Database 10g Express Editionのインストール

ここから[oracle-xe-universal_10.2.0.1-1.0_i386.deb]をダウンロードし、インストール。

$ sudo dpkg -i oracle-xe-universal_10.2.0.1-1.0_i386.deb

下記のエラーが発生し、インストール失敗。
どうやら、swap領域が足りないようです。(最低1GB必要らしい。)

This system does not meet the minimum requirements for swap space. Based on
the amount of physical memory available on the system, Oracle Database 10g
Express Edition requires 1024 MB of swap space. This system has 894 MB
of swap space. Configure more swap space on the system and retry the installation.

swap領域の確認。

$ cat /proc/swaps 
Filename				Type		Size	Used	Priority
/dev/sda5                               partition	915664	0	-1

ということで、swap領域を増やしました。

$ sudo mkdir -p /mnt/swap
$ cd /mnt/swap/
$ sudo dd if=/dev/zero of=swapfile bs=1M count=1024
$ sudo mkswap swapfile
$ sudo swapon swapfile

swap領域の確認。

$ cat /proc/swaps 
Filename				Type		Size	Used	Priority
/dev/sda5                               partition	915664	0	-1
/mnt/swap/swapfile                      file		1048568	0	-2        <-追加された

/etc/fstabへ設定追加。

### /etc/fstab
/mnt/swap/swapfile     none     swap     sw     0     0

XEのインストール。

$ sudo dpkg -i oracle-xe-universal_10.2.0.1-1.0_i386.deb

初期設定

デフォルトで。

$ 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]:

Specify a port that will be used for the database listener [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:
Confirm the password:

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

Starting Oracle Net Listener...Done
Configuring Database...Done
Starting Oracle Database 10g Express Edition Instance...Done
Installation Completed Successfully.
To access the Database Home Page go to "http://127.0.0.1:8080/apex"

環境変数の設定

ORACLE_HOMEとかにパスを通すために、~/.profileとかに設定追加。

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

リモートからのWeb管理画面(Database Home Page)アクセス有効化

デフォルトではローカルからのアクセスのみ有効となっていますが、そのためにGNOMEとか起動するのは面倒なので、リモートクライアントからアクセスできるように設定。

$ sqlplus system
SQL> EXEC DBMS_XDB.SETLISTENERLOCALACCESS(FALSE);

PL/SQLプロシージャが正常に完了しました。
SQL> exit

リモートクライアントからブラウザで、http://servername:8080/apexでアクセスできます。
ちなみに、リモートからのアクセスを無効化するのは、

SQL> EXEC DBMS_XDB.SETLISTENERLOCALACCESS(TRUE);


Oracle Database Express Edition
Debian、Ubuntu、KubuntuへのOracle Database XEのインストール*1
http://download-west.oracle.com/docs/cd/B25329_01/doc/install.102/b25144/toc.htm

*1:oss.oracle.comのリポジトリを使用する方法が記載されていますが、リポジトリへアクセスできませんでした