在Ubuntu 10.04下安装Oracle 11g 第二版(转)

原文地址:http://blog.chinaunix.net/u3/114361/showart_2227746.html(稍微改动)

 

 

安装步骤:
第一步:
修改X server 的默认设置,点菜单的System -> Administration -> Login Window(系统->管理->登录窗口),选择“Security(安全)”选项卡,取消“Deny TCP connections to the Xserver(拒绝TCP连接到X服务器)”的勾,重启Xserver(或者重启系统)。---以上若没有找到,可不用设置--------

然后在终端输入: xhost +127.0.0.1
第二步:
安装必要的个工具:
终端输入: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桌面,然后再安装出现安装界面了)
第十步:
(1)终端输入:./runInstaller -jreLoc /usr/lib/jvm/java-6-sun/jre/
。。。。。。
(2)图形安装界面出现
。。。。。
(3)忽略预检中的错误和警告
。。。。。
(4)选"Create a Database"来安装数据库。(原文是通过netca建立监听,dbca建库,我第一次也是这样做的,dbca建库时会报错,因为ubutunbu 不支持RPM包)。
。。。。。。。


安装过程中出现了一个makefile的错误,某个库文件没有编译过去,但是还可以继续安装,估计以后使用会出问题;另外在安装的最后会有个配置环节等很久,只有一个广告框,不要以为出问题了
(5)完成后。
终端输入:/u01/app/oracle/product/11.1.0/db_1/root.sh
退出OUI
第十一步:
修改配置文件:/etc/profile
export ORACLE_HOME=/u01/app/oracle/product/11.1.0/db_1
export PATH=$PATH:/u01/app/oracle/product/11.1.0/db_1/bin
第十二步:
(1)建立启动脚本:
在/u01/app/oracle/product/11.1.0/db_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.1.0/db_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.1.0/db_1/bin/oracledb
第十三步:
开机启动:
root@zhanghc-Ubuntu:~# ln -s /u01/app/oracle/product/11.1.0/db_1/bin/oracledb /etc/init.d/oracledb
root@zhanghc-Ubuntu:~# sudo sysv-rc-conf --level 2345 oracledb on
可能出现的问题:
(1)安装界面乱码或者停止响应
问题可能来源:JDK与Oracle 自带的jdk冲突
(2)netca建立监听,dbca建库时会报错
问题可能来源:因为ubutunbu 不支持RPM包
(3)文件目录的读写权限:
注意用户的切换


补充说明:
在Linux下使用sqlplus不能使用上下箭头运行命令历史,可以使用软件rlwarp,安装后运行rlwrap sqlplus就可以实现,很方便;
另外,在使用sqldeveloper是想链接数据库时,先要把数据库启动起来,在linux下的命令脚本只是把oracle数据库的服务启动而已,真正启动哪个数据库还需要在sqlplus使用命令:startup来启动,然后就可以通过sqldeveloper链接了,注意链接的端口参数;
使用oem时,会出现按钮乱码,可以通过修改浏览器的语言选项,添加英语支持,并上调到第一个位置(我安装后没有出现此问题)。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值