Oracle Express版のダウンロード
インストール
インストールコマンド:
sudo rpm -ivh oracle-xe-11.2.0-1.0.x86_64.rpm
インストールする際、スワイプ領域サイズの不足より以下のエラーが発生する場合があります。
This system does not meet the minimum requirements for swap space.
Based on the amount of physical memory available on the system,
Oracle Database 11g Express Edition requires 1970 MB of swap space.
This system has 0 MB of swap space. Configure more swap space on the system and retry the installation.
スワップファイルの作成方法
1.dd コマンドを使用してルートファイルシステムにスワップファイルを作成します。ここで「bs」はブロックサイズ、「count」はブロック数です。この例で、スワップファイルは 4 GB です。
$ sudo dd if=/dev/zero of=/swapfile bs=1G count=4
2.スワップファイルの読み書きのアクセス許可を更新します。
$ chmod 600 /swapfile
3.Linux スワップ領域のセットアップ:
$ mkswap /swapfile
4.スワップ領域にスワップファイルを追加して、スワップファイルを即座に使用できるようにします。
$ swapon /swapfile
5.手順が正常に完了したことを確認します。
$ swapon -s
6./etc/fstab ファイルを編集して、起動時にスワップファイルを有効にします。
$ vi /etc/fstab
$ /swapfile swap swap defaults 0 0
コンフィグレーション
インストール後にoracle xeのコンフィグレーションを行う。
sudo /etc/init.d/oracle-xe configure
This will configure on-boot properties of Oracle Database 11g 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]:8185
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 11g Express Edition to be started on boot (y/n) [y]:y
Starting Oracle Net Listener...Done
Configuring database...Done
Starting Oracle Database 11g Express Edition
ホスト名の設定
tnsnames.oraからホスト名を特定する。
cat /u01/app/oracle/product/11.2.0/xe/network/admin/tnsnames.ora
XE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = ip-10-0-0-208)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = XE)
)
)
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC_FOR_XE))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)
上記のHOST(HOST = ip-10-0-0-208)に合わせてHOSTSファイルに追記する。
sudo vi /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ip-10-0-0-208
::1 localhost6 localhost6.localdomain6
環境変数の設定
sudo vi /etc/bashrc
以下の環境変数を追記する。
ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe
export ORACLE_HOME
ORACLE_SID=XE
export ORACLE_SID
NLS_LANG=`$ORACLE_HOME/bin/nls_lang.sh`
export NLS_LANG
PATH=$ORACLE_HOME/bin:$PATH
export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH
上記の変更を反映
source /etc/bashrc