It’s now or never

IT系の技術ブログです。気になったこと、勉強したことを備忘録的にまとめて行きます。

Oracle Database ExpressをCentOSにインストールする

Oracle Databaseは、基本的には商用(有償)のDBMSですが無償で使えるパッケージが有るみたいなので試してみます。

環境

パッケージのダウンロード

sudo yum install -y unzip
unzip oracle-xe-11.2.0-1.0.x86_64.rpm.zip

インストール

sudo yum install -y glibc make gcc binutils libaio libaio-devel bc net-tools
sudo dd if=/dev/zero of=/swap bs=1M count=2048
sudo chmod 600 /swap
sudo mkswap /swap
sudo swapon /swap
cat /proc/swaps

vi /etc/fstab

/swap swap swap defaults 0 0
sudo rpm -ivh Disk1/oracle-xe-11.2.0-1.0.x86_64.rpm
You must run '/etc/init.d/oracle-xe configure' as the root user to configure the database.

と表示されている

これはDB構成のコマンドらしいのでそのまま実行

sudo /etc/init.d/oracle-xe configure
  • 対話型で設定が聞かれる
Oracle Database 11g Express Edition Configuration
-------------------------------------------------
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.

// デフォルトのHTTPポート番号
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]:

/etc/init.d/oracle-xe: line 405: netstat: command not found

// SYSTEMユーザーのパスワード
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 instance...Done
Installation completed successfully.

DBへアクセス

  • コマンドの読み込み
. /u01/app/oracle/product/11.2.0/xe/bin/oracle_env.sh
  • sqlplusでアクセス
sqlplus system
  • パスワードを聞かれるため、先程設定したものを入力
sqlplus system

SQL*Plus: Release 11.2.0.2.0 Production on 日 3月 26 10:49:30 2017

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

パスワードを入力してください:


Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production
に接続されました。
SQL>
  • 正しくログインできれば設定完了

MySQLより説明が少なく少なくイメージがありますね。