安装步骤:
第一步:
在终端输入: xhost +127.0.0.1
第二步:
安装必要的个工具:
终端输入: sudo apt-get install build-essential libaio1 gawk ksh libmotif3 alien libtool lsb-rpm (要在软件源里勾上有版权与合法性问题限制的软件,还有设备的专有驱动)
sudo apt-get install build-essential libaio1 gawk ksh libmotif3 alien libtool lsb-rpm
第三步:
修改一些 Ubuntu 的 /bin/sh 的默认连接:
终端输入:
root@zhanghc-Ubuntu:~# cd /bin
root@zhanghc-Ubuntu:/bin# ls -l /bin/sh
lrwxrwxrwx 1 root root 4 2008-04-28 19:59 /bin/sh -> dash
root@zhanghc-Ubuntu:/bin# ln -sf bash /bin/sh
root@zhanghc-Ubuntu:/bin# ls -l /bin/sh
lrwxrwxrwx 1 root root 4 2008-05-01 22:51 /bin/sh -> bash
第四步:
增加用户和组:
终端输入:
root@zhanghc-Ubuntu:/bin# cd / root
root@zhanghc-Ubuntu:~# addgroup oinstall
root@zhanghc-Ubuntu:~# addgroup dba
root@zhanghc-Ubuntu:~# addgroup nobody
root@zhanghc-Ubuntu:~# usermod -g nobody nobody
root@zhanghc-Ubuntu:~# useradd -g oinstall -G dba -p password -d /home/oracle -s /bin/bash oracle
root@zhanghc-Ubuntu:~# mkdir /home/oracle
root@zhanghc-Ubuntu:~# chown -R oracle:dba /home/oracle
root@zhanghc-Ubuntu:~# ln -s /usr/bin/awk /bin/awk
root@zhanghc-Ubuntu:~# ln -s /usr/bin/rpm /bin/rpm
root@zhanghc-Ubuntu:~# ln -s /usr/bin/basename /bin/basename
root@zhanghc-Ubuntu:~# mkdir /etc/rc.d
root@zhanghc-Ubuntu:~# for i in 0 1 2 3 4 5 6 S ; do ln -s /etc/rc$i.d /etc/rc.d/rc$i.d ; done
root@zhanghc-Ubuntu:~# mkdir -p /u01/app/oracle
root@zhanghc-Ubuntu:~# chown -R oracle:dba /u01
第八步:
系统默认值:
( 1 )增加下面这些到 /etc/sysctl.conf 文件的末尾:
fs.file-max = 65535
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 1024 65535
net.core.rmem_default = 1048576
net.core.rmem_max = 1048576
net.core.wmem_default = 262144
net.core.wmem_max = 262144
( 2 )增加下面这些到 /etc/security/limits.conf 文件末尾:
oracle soft nproc 2047
oracle hard nproc 16383
oracle soft nofile 1023
oracle hard nofile 65535
( 3 )增加下面这些到 /etc/pam.d/login 文件末尾:
session required /lib/security/pam_limits.so
session required pam_limits.so
增加完成后执行下面的命令: sysctl -p
第九步:
( 1 )解压源文件: oracle11g 的安装包解压到 /home/oracle/install/ 目录
( 2 )更改权限: chown -R oracle:dba install
(3) 设置 DISPLAY 参数: export DISPLAY=127.0.0.1:0.0 (这里我设置成 :0.0 ,因为网上说这样可以自动查找合适的,安装界面可以启动,但是切换用户到 oracle 就不能启动了,出现说颜色设置不正常,估计是某些环境为设置,没办法,我只好使用用户 oracle 登录 gdm ,可以使用命令 gdmflexserver 来额外启动一个 gdm 桌面,然后再安装出现安装界面了)
第十步:
重启,进入 oracle 用户。
( 1 )终端输入: ./runInstaller -jreLoc /usr/lib/jvm/java-6-sun/jre/
。。。。。。
( 2 )图形安装界面出现
。。。。。
( 3 )忽略预检中的错误和警告
。。。。。
( 4 )选 "Create a Database" 来安装数据库。(原文是通过 netca 建立监听, dbca 建库,我第一次也是这样做的, dbca 建库时会报错,因为 ubutunbu 不支持 RPM 包)。
。。。。。。。
安装过程中出现了一个 makefile 的错误,某个库文件没有编译过去,但是还可以继续安装,估计以后使用会出问题;另外在安装的最后会有个配置环节等很久,只有一个广告框,不要以为出问题了
( 5 )完成后。
su wangjian ( 这是我的有 sudo 权限的用户,你自己装视情况而定 )
终端输入: /u01/app/oracle/product/11.2.0/dbhome_1/root.sh
退出 OUI
第十一步:
修改配置文件: /etc/profile
export ORACLE_HOME=u01/app/oracle/product/11.2.0/dbhome_1
export PATH=$PATH:u01/app/oracle/product/11.2.0/dbhome_1/bin
第十二步:
( 1 )建立启动脚本:
在 u01/app/oracle/product/11.2.0/dbhome_1/bin 下建立文件: oracledb ,内容:
#!/bin/bash
#
# /etc/init.d/oracledb
#
# Run-level Startup script for the Oracle Listener and Instances
# It relies on the information on /etc/oratab
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=u01/app/oracle/product/11.2.0/dbhome_1
export ORACLE_OWNR=oracle
export PATH=$PATH:$ORACLE_HOME/bin
if [ ! -f $ORACLE_HOME/bin/dbstart -o ! -d $ORACLE_HOME ]
then
echo "Oracle startup: cannot start"
exit 1
fi
case "$1" in
start)
# Oracle listener and instance startup
echo -n "Starting Oracle: "
su $ORACLE_OWNR -c "$ORACLE_HOME/bin/lsnrctl start"
su $ORACLE_OWNR -c "$ORACLE_HOME/bin/dbstart $ORACLE_HOME"
touch /var/lock/oracle
echo "OK"
;;
stop)
# Oracle listener and instance shutdown
echo -n "Shutdown Oracle: "
su $ORACLE_OWNR -c "$ORACLE_HOME/bin/lsnrctl stop"
su $ORACLE_OWNR -c "$ORACLE_HOME/bin/dbshut $ORACLE_HOME"
rm -f /var/lock/oracle
echo "OK"
;;
reload|restart)
$0 stop
$0 start
;;
*)
echo "Usage: `basename $0` start|stop|restart|reload"
exit 1
esac
exit 0
为了可以方便使用 oracle 数据库的命令,最好在 oracle 用户设置 shell 环境,将 ORACLE_HOME/bin 添加进去
( 2 )修改脚本为可执行的:
终端输入: chmod a+x u01/app/oracle/product/11.2.0/dbhome_1/bin/oracledb
第十三步:
开机启动:
root@zhanghc-Ubuntu:~# ln -s u01/app/oracle/product/11.2.0/dbhome_1/bin/oracledb /etc/init.d/oracledb
root@zhanghc-Ubuntu:~# sudo apt-get install sysv-rc-conf
root@zhanghc-Ubuntu:~# sudo sysv-rc-conf --level 2345 oracledb on
可能出现的问题:
( 1 )安装界面乱码或者停止响应
问题可能来源: JDK 与 Oracle 自带的 jdk 冲突
( 2 ) netca 建立监听, dbca 建库时会报错
问题可能来源:因为 ubutunbu 不支持 RPM 包
(3) 文件目录的读写权限:
注意用户的切换
补充说明:
在 Linux 下使用 sqlplus <span sty