Co2y's Blog

在ubuntu14.04下安装oracle

参考http://www.oracle.com/technetwork/database/database-technologies/express-edition/downloads/index.html

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
sudo apt-get install alien
sudo alien -d --scripts oracle-xe-11.2.0-1.0.x86_64.rpm
sudo dpkg -i oracle-xe-11.2.0-2_amd64.deb
sudo vim /var/lib/dpkg/info/oracle-xe.postinst
#else
#/sbin/chkconfig --add oracle-xe
sudo /var/lib/dpkg/info/oracle-xe.postinst
sudo apt-get install libaio1
sudo vim /etc/init.d/oracle-shm
#! /bin/sh
# /etc/init.d/oracle-shm
#
#
case "\$1" in
start)
echo "Starting script /etc/init.d/oracle-shm"
# Run only once at system startup
mkdir /var/lock/subsys 2>/dev/null
touch /var/lock/subsys/listener
if [ -e /dev/shm/.oracle-shm ]; then
echo "/dev/shm is already mounted, nothing to do"
else
rm -f /dev/shm 2>/dev/null
mkdir /dev/shm 2>/dev/null
#mount -B /run/shm /dev/shm
mount -t tmpfs shmfs -o size=2048m /dev/shm
touch /dev/shm/.oracle-shm
fi
;;
stop)
echo "Stopping script /etc/init.d/oracle-shm"
echo "Nothing to do"
;;
*)
echo "Usage: /etc/init.d/oracle-shm {start|stop}"
exit 1
;;
esac
#
### BEGIN INIT INFO
# Provides: oracle-shm
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Bind /run/shm to /dev/shm at system startup.
# Description: Fix to allow Oracle 11g use AMM.
### END INIT INFO
sudo chmod 755 /etc/init.d/oracle-shm
sudo update-rc.d oracle-shm defaults 01 99
sudo reboot
sudo vi ~/.bashrc
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe
export ORACLE_SID=XE
export NLS_LANG=`$ORACLE_HOME/bin/nls_lang.sh`
export ORACLE_BASE=/u01/app/oracle
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
export PATH=$ORACLE_HOME/bin:$PATH
sudo source ~/.bashrc
sudo ln -s /usr/bin/awk /bin/awk
sudo mkdir /var/lock/subsys
sudo /etc/init.d/oracle-xe configure
sudo /etc/init.d/oracle-xe { start | stop }

以下为删除 oracle

1
2
3
4
5
6
sudo -s /etc/init.d/oracle-xe stop
ps -ef | grep oracle | grep -v grep | awk '{print $2}' | xargs kill
sudo dpkg --purge oracle-xe
sudo rm -r /u01
sudo rm /etc/default/oracle-xe
sudo update-rc.d -f oracle-xe remove

参考 https://community.oracle.com/thread/2303639

以上不能保证正确

友情提示&总结:

不要用debian系安装oracle!