Skip to content

Instantly share code, notes, and snippets.

@usutani
Last active August 29, 2015 13:58
Show Gist options
  • Select an option

  • Save usutani/10098625 to your computer and use it in GitHub Desktop.

Select an option

Save usutani/10098625 to your computer and use it in GitHub Desktop.
Ubuntu 12.04 に Oracle Database XE をインストール
@usutani
Copy link
Copy Markdown
Author

usutani commented Apr 8, 2014

仮想マシンを作成する
$ vagrant init hashicorp/precise64
$ vagrant up

Oracleからパッケージを入手する(要OTNアカウント)
http://www.oracle.com/technetwork/jp/database/express-edition/downloads/index.html

  • oracle-xe-11.2.0-1.0.x86_64.rpm.zip

仮想マシンにパッケージをコピーする
$ vagrant ssh-config > .vagrant.ssh.config
$ scp -F .vagrant.ssh.config path/to/oracle-xe-11.2.0-1.0.x86_64.rpm.zip default:

仮想マシンにログインする
$ vagrant ssh

@usutani
Copy link
Copy Markdown
Author

usutani commented Apr 8, 2014

$ sudo apt-get update
$ sudo apt-get install alien libaio1 unixodbc
$ unzip oracle-xe-11.2.0-1.0.x86_64.rpm.zip
$ cd Disk1/

rpm形式をdebian形式に変換する
$ sudo alien --to-deb --scripts oracle-xe-11.2.0-1.0.x86_64.rpm
oracle-xe_11.2.0-2_amd64.deb generated

@usutani
Copy link
Copy Markdown
Author

usutani commented Apr 8, 2014

$ sudo vi /sbin/chkconfig

#!/bin/bash
# Oracle 11gR2 XE installer chkconfig hack for Debian by Dude
file=/etc/init.d/oracle-xe
if [[ ! `tail -n1 $file | grep INIT` ]]; then
   echo >> $file
   echo '### BEGIN INIT INFO' >> $file
   echo '# Provides:             OracleXE' >> $file
   echo '# Required-Start:       $remote_fs $syslog' >> $file
   echo '# Required-Stop:        $remote_fs $syslog' >> $file
   echo '# Default-Start:        2 3 4 5' >> $file
   echo '# Default-Stop:         0 1 6' >> $file
   echo '# Short-Description:    Oracle 11g Express Edition' >> $file
   echo '### END INIT INFO' >> $file
fi
update-rc.d oracle-xe defaults 80 01

$ sudo chmod 755 /sbin/chkconfig
$ sudo ln -s /usr/bin/awk /bin/awk
$ sudo dpkg --install ./oracle-xe_11.2.0-2_amd64.deb

初期化スクリプトを修正する
sudo vi /u01/app/oracle/product/11.2.0/xe/config/scripts/init.ora
sudo vi /u01/app/oracle/product/11.2.0/xe/config/scripts/initXETemp.ora

#memory_target=
pga_aggregate_target=200540160
sga_target=601620480

パスワードは oracle に設定する
sudo /etc/init.d/oracle-xe configure

sqlplus で確認する
$ source /u01/app/oracle/product/11.2.0/xe/bin/oracle_env.sh
$ sqlplus system/oracle

@usutani
Copy link
Copy Markdown
Author

usutani commented Apr 8, 2014

仮想マシンをログアウトして1521ポートをフォワードする
$ vi Vagrantfile

config.vm.network :forwarded_port, guest: 1521, host: 1521

$ vagrant reload
$ sqlplus system/[email protected]

ボックスを保存する
$ vagrant package
$ vagrant box add oracle package.box

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment