Linux oracle 11g r2 安装前检查及安装

Linux环境配置网址:yii666.com

[c-sharp] view
plaincopy
  1. OS:Fedora 15
  2. DB:Oracle 11gR2
  3. 将Oracle安装到home/oracle_11目录

配置过程:本文来自Oracle官方文档+网上资料

Oracle官方文档:http://www.oracle.com/pls/db112/homepage

1. 以root用户登录到Linux

2. 检查机器硬件要求

2.1 内存要求

[c-sharp] view
plaincopy
  1. 至少需要1GB的内存
  2. 查看机器内存大小
  3. # grep MemTotal /proc/meminfo

2.2 swap空间要求

[c-sharp] view
plaincopy
  1. 内存大小                 swap空间大小
  2. 1 GB ~ 2 GB             内存大小*1.5
  3. 2 GB ~ 16 GB            内存大小
  4. > 16 GB          16 GB
  5. 查看swap空间大小
  6. # grep SwapTotal /proc/meminfo

2.3 空闲硬盘要求文章来源地址:https://www.yii666.com/article/758341.html

[c-sharp] view
plaincopy
  1. /tmp目录需要1 GB的空闲空间
  2. 查看/tmp目录的空闲空间
  3. # df -h /tmp
  4. 安装Oracle软件需要的硬盘空间
  5. Enterprise Edition   3.95(software files)+1.7(data files)
  6. Standard Edition     3.88(software files)+1.5(data files)
  7. 查看机器中每个磁盘的空闲空间
  8. # df -h

3. 检查操作系统软件要求

Oracle官方文档中包含了多个Linux系统的要求,详细请参考官方文档

Fedora 15 (RHEL 5.x)的软件要求列表如下:

[c-sharp] view
plaincopy
  1. binutils-2.17.50.0.6
  2. compat-libstdc++-33-3.2.3
  3. elfutils-libelf-0.125
  4. elfutils-libelf-devel-0.125
  5. elfutils-libelf-devel-static-0.125
  6. gcc-4.1.2
  7. gcc-c++-4.1.2
  8. glibc-2.5-24
  9. glibc-common-2.5
  10. glibc-devel-2.5
  11. glibc-headers-2.5
  12. kernel-headers-2.6.18
  13. ksh-20060214
  14. libaio-0.3.106
  15. libaio-devel-0.3.106
  16. libgcc-4.1.2
  17. libgomp-4.1.2
  18. libstdc++-4.1.2
  19. libstdc++-devel-4.1.2
  20. make-3.81
  21. numactl-devel-0.9.8.i386
  22. sysstat-7.0.2
  23. libxp
  24. libxt
  25. 查看系统是否安装了该软件包
  26. # rpm -q package_name

4. 创建安装Oracle需要的系统组和用户

[c-sharp] view
plaincopy
  1. 创建Oracle Inventory 组
  2. # groupadd oinstall
  3. 创建OSDBA 组
  4. # groupadd dba
  5. 创建Oracle软件创建者
  6. # useradd -g oinstall -G dba oracle
  7. 修改oracle用户的密码
  8. # passwd oracle

5. 配置系统内核参数值

[c-sharp] view
plaincopy
  1. 编辑/etc/sysctl.conf文件
  2. vim /etc/sysctl.conf
  3. 在打开的文件底部添加下面内容
  4. fs.aio-max-nr = 1048576
  5. fs.file-max = 6815744
  6. kernel.shmall = 2097152
  7. kernel.shmmax = 536870912
  8. kernel.shmmni = 4096
  9. kernel.sem = 250 32000 100 128
  10. net.ipv4.ip_local_port_range = 9000 65500
  11. net.core.rmem_default = 262144
  12. net.core.rmem_max = 4194304
  13. net.core.wmem_default = 262144
  14. net.core.wmem_max = 1048586
  15. 改变当前系统内核参数值(让/etc/sysctl.conf立即生效)
  16. # sysctl -p

6. 检查Oracle安装用户(oracle)资源限制

[c-sharp] view
plaincopy
  1. 修改/etc/security/limits.conf文件
  2. vim /etc/security/limits.conf
  3. 在打开的文件底部添加下面内容
  4. oracle              soft    nproc   20470
  5. oracle              hard    nproc   16384
  6. oracle              soft    nofile  10240
  7. oracle              hard    nofile  65536
  8. oracle              soft    stack   10240

7. 创建安装Oracle软件所需要的目录

[c-sharp] view
plaincopy
  1. # mkdir -p /home/oracle_11/app/
  2. # chown -R oracle:oinstall /home/oracle_11/app/
  3. # chmod -R 775 /home/oracle_11/app/

8. 配置安装Oracle安装用户(oracle)的环境

[c-sharp] view
plaincopy
  1. 编辑 /home/oracle/.bash_profile
  2. vim /home/oracle/.bash_profile
  3. 在打开的文件中添加下面内容
  4. umask 022
  5. export ORACLE_BASE=/home/oracle_11/app
  6. export ORACLE_HOME=$ORACLE_BASE/oracle/product/11.2.0/db_1
  7. export ORACLE_SID=orcl --Oracle实例名,可修改
  8. export PATH=$PATH:HOME/bin:$ORACLE_HOME/bin
  9. 编辑 /etc/pam.d/login
  10. vim /etc/pam.d/login
  11. 在打开的文件中添加下面内容
  12. session required /lib/security/pam_limits.so
  13. session required pam_limits.so
  14. 编辑 /etc/profile
  15. vim /etc/profile
  16. 在打开的文件中添加下面内容
  17. if [ $USER = "oracle" ]; then
  18. if [ $SHELL = "/bin/ksh" ]; then
  19. ulimit -p 16384
  20. ulimit -n 65536
  21. else
  22. ulimit -u 16384 -n 65536
  23. fi
  24. fi

9. 查看系统是否支持图形界面

[c-sharp] view
plaincopy
  1. 查看root用户下是否已设置DISPLAY变量
  2. # echo $DISPLAY
  3. 如果有值出现,则说明已设置DISPLAY变量;否则,就需要手动设置DISPLAY

10. 开始安装Oracle软件

[c-sharp] view
plaincopy
  1. # cd /tmp
  2. # unzip linux_11gR2_database_1of2.zip linux_11gR2_database_2of2.zip
  3. # xhost +
  4. # su - oracle
  5. $ export DISPLAY=:0
  6. $ cd /database
  7. $ ./runInstaller
  8. 接下来系统会启动Oracle图形安装界面,安装过程和Windows下一样

在安装过程中,会提示在root用户下运行两个脚本文件(具体是哪两个,不记得了,按提示操作即可)。

Linux下的Oracle在安装结束后是处于运行状态的。重启机器后,Oracle不会像在Windows下那样将Oracle添加到Windows服务,在linux下需要手动启动Orcle服务

[c-sharp] view
plaincopy
  1. 以oracle用户下,执行下面的命令
  2. 进入sqlplus
  3. $ sqlplus /nolog
  4. 以sysdba的身份连接到数据库,并启动Oracle数据库引擎
  5. SQL> conn /as sysdba
  6. SQL> startup
  7. 退出sqlplus,运行Listener
  8. SQL> exit
  9. $ lsnrctl start

这样就可以连接到Oracle数据库了。如果想用Oracle提供的EM来管理Oracle的话还需要启动EM控制台,运行如下命令:

[c-sharp] view
plaincopy
  1. $ emctl start dbconsole

这样就可以通过http://localhost:1158/em/ 来访问EM控制台了。网址:yii666.com<

使用dbstart和dbstop来启动Oracle服务

可能使用dbstart命令来启动数据库更方便一些,但初次安装完oracle之后使用dbstart命令会报这样的错误

[c-sharp] view
plaincopy
  1. ORACLE_HOME_LISTNER is not SET, unable to auto-start Oracle Net Listener
  2. Usage: /u01/app/oracle/product/11.2/db/bin/dbstart ORACLE_HOME

出现这样错误的原因是由于没有设置ORACLE_HOME_LISTNER的原因,我们查看一下dbstart这个文件

[c-sharp] view
plaincopy
  1. more  /home/oracle_11/app/oracle/product/11.2/db/bin/dbstart

部分内容如下文章地址https://www.yii666.com/article/758341.html

[c-sharp] view
plaincopy
  1. # First argument is used to bring up Oracle Net Listener
  2. ORACLE_HOME_LISTNER=$1
  3. if [ ! $ORACLE_HOME_LISTNER ] ; then
  4. echo "ORACLE_HOME_LISTNER is not SET, unable to auto-start Oracle Net Listener"
  5. echo "Usage: $0 ORACLE_HOME"
  6. else
  7. LOG=$ORACLE_HOME_LISTNER/listener.log
  8. # Set the ORACLE_HOME for the Oracle Net Listener, it gets reset to
  9. # a different ORACLE_HOME for each entry in the oratab.
  10. export ORACLE_HOME=$ORACLE_HOME_LISTNER

解决方案就算将$ORACLE_HOME赋值给$ORACLE_HOME_LINTNER,保存,退出

再一次执行dbstart,但是没有反映,没有报错,如果我们需要使用dbstart,则需要在/etc/oratab这个文件中的实例最后的N改成Y,如下

[c-sharp] view
plaincopy
  1. orcl:/home/oracle_11/app/oracle/product/11.2/db:Y

OK,保存,再试一下dbstart命令,返回结果如下

[c-sharp] view
plaincopy
  1. Processing Database instance "orcl": log file /home/oracle_11/app/oracle/product/11.2.0/db_1/startup.log

dbshut进行同样的设置.这样,以后就可以在启动监听之后直接使用dbstart和dbshut命令来启动和关闭数据了

将Oracle服务添加到Linux开机启动项,以root用户建立/etc/rc.d/init.d/oradb脚本文件,文件内容如下:

[c-sharp] view
plaincopy
  1. #!/bin/bash
  2. # chkconfig: 2345 90 10
  3. export ORACLE_BASE=/home/oracle_11/app/
  4. export ORACLE_HOME=$ORACLE_BASE/oracle/product/11.2.0/db_1
  5. export ORACLE_SID=orcl
  6. export PATH=$PATH:$ORACLE_HOME/bin
  7. ORCL_OWN="oracle"
  8. # if the executables do not exist -- display error
  9. if [ ! -f $ORACLE_HOME/bin/dbstart -o ! -d $ORACLE_HOME ]
  10. then
  11. echo "Oracle startup: cannot start"
  12. exit 1
  13. fi
  14. # depending on parameter -- start, stop, restart
  15. # of the instance and listener or usage display
  16. case "$1" in
  17. start)
  18. # Oracle listener and instance startup
  19. echo -n "Starting Oracle: "
  20. su - $ORCL_OWN -c "$ORACLE_HOME/bin/dbstart"
  21. touch /var/lock/subsys/oradb
  22. su - $ORCL_OWN -c "$ORACLE_HOME/bin/emctl start dbconsole"
  23. echo "OK"
  24. ;;
  25. stop)
  26. # Oracle listener and instance shutdown
  27. echo -n "Shutdown Oracle: "
  28. su - $ORCL_OWN -c "$ORACLE_HOME/bin/emctl stop dbconsole"
  29. su - $ORCL_OWN -c "$ORACLE_HOME/bin/dbshut"
  30. rm -f /var/lock/subsys/oradb
  31. echo "OK"
  32. ;;
  33. reload|restart)
  34. $0 stop
  35. $1 start
  36. ;;
  37. *)
  38. echo "Usage: 'basename $0' start|stop|restart|reload"
  39. exit 1
  40. esac
  41. exit 0

将该文件添加到开机启动

[c-sharp] view
plaincopy
  1. # chmod 755 /etc/rc.d/init.d/oradb
  2. # chkconfig --add oradb

重启服务

[c-sharp] view
plaincopy
  1. # service oradb stop
  2. # service oradb start

下次启动机器的时候,Oracle服务会随机器一起启动。

Oracle数据库安装、配置完成。

Tip:Oracle数据库的默认端口号:1521,Oracle提供的EM管理器默认端口号是1158。文章来源地址https://www.yii666.com/article/758341.html

原文地址:http://blog.csdn.net/westmaniac/article/details/6539487

版权声明:本文内容来源于网络,版权归原作者所有,此博客不拥有其著作权,亦不承担相应法律责任。文本页已经标记具体来源原文地址,请点击原文查看来源网址,站内文章以及资源内容站长不承诺其正确性,如侵犯了您的权益,请联系站长如有侵权请联系站长,将立刻删除

Linux oracle 11g r2 安装前检查及安装-相关文章

  1. Mysql mysqldumpslow命令详解

  2. Linux oracle 11g r2 安装前检查及安装

  3. 如何检查linux 下是否安装java(jdk)环境

  4. Linux下软件安装,卸载,管理

  5. Go在linux下的安装

  6. Linux(CentOs)下安装Phantomjs + Casperjs

  7. Linux RedHat无法安装软件问题(No package gcc available. Nothing to do)

  8. linux telnet服务安装与配置

    关闭防火墙:service iptabls stop            chkconfig iptabls off1、安装telnet服务[root@rheltest1 ~]# rpm -qa |grep telnet   //检查是否安装这相关软件包telnet-0.17-47.el6.x86_64telnet-server-0.17-47.el6.x86_64如果未安装,配置YUM源,使用yum install telnet telnet-server命令安装2、开启telnet服务(因为tel

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信图片_20190322181744_03.jpg

微信扫一扫打赏

请作者喝杯咖啡吧~

支付宝扫一扫领取红包,优惠每天领

二维码1

zhifubaohongbao.png

二维码2

zhifubaohongbao2.png