欢迎测试同行进来留言

Redhat Linux AS4 安装 Oracle 10g (10.2)

上一篇 / 下一篇  2010-01-28 15:21:19 / 个人分类:oracle在linux5x下的安装


1、硬件需求
   1)内存>1024M
     内存     交换分区
     >1024M    2倍内存
     <2048M    1.5倍内存
     <8192M    1倍内存
     >8192M    0.75倍内存
     显示内存命令
   2)/tmp > 400M
   3)检测命令
     内存
     # grep MemTotal /proc/meminfo 
     交换分区
     # grep SwapTotal /proc/meminfo
     /tmp分区
     # df -k /tmp
     cpu信息
     # grep "model name" /proc/cpuinfo
2、软件需求
   1)操作系统
   Red Hat Enterprise Linux AS/ES 3.0 (Update 4 or later)
   Red Hat Linux 4.0
   SUSE Linux Enterprise Server 9.0
   Asianux 1.0
   Asianux 2.0
   2)内核
   Red Hat Enterprise Linux 3.0 and Asianux 1.0
  2.4.21-27.EL  
   Red Hat Enterprise Linux 4.0 and Asianux 2.0  
  2.6.9-5.EL  
   SUSE Linux Enterprise Server 9.0  
  2.6.5-7.201
   3)具体组件包
   Red Hat Enterprise Linux 3.0 and Asianux 1.0

 make-3.79.1
 gcc-3.2.3-34
 glibc-2.3.2-95.20
 compat-db-4.0.14-5
 compat-gcc-7.3-2.96.128
 compat-gcc-c++-7.3-2.96.128
 compat-libstdc++-7.3-2.96.128
 compat-libstdc++-devel-7.3-2.96.128
 openmotif21-2.1.30-8
 setarch-1.3-1
 
   Red Hat Enterprise Linux 4.0 and Asianux 2.0:
 
 binutils-2.15.92.0.2-13.EL4
 compat-db-4.1.25-9
 compat-libstdc++-296-2.96-132.7.2
 control-center-2.8.0-12
 gcc-3.4.3-22.1.EL4
 gcc-c++-3.4.3-22.1.EL44
 glibc-2.3.4-2.9
 glibc-common-2.3.4-2.9
 gnome-libs-1.4.1.2.90-44.1
 libstdc++-3.4.3-22.1
 libstdc++-devel-3.4.3-22.1
 make-3.80-5
 pdksh-5.2.14-30
 sysstat-5.0.5-1
 xscreensaver-4.18-5.rhel4.2
 setarch-1.6-1
 
    SUSE Linux Enterprise Server 9
 
 binutils-2.15.90.0.1.1-32.5
 gcc-3.3.3-43.24
 gcc-c++-3.3.3-43.24
 glibc-2.3.3-98.28
 gnome-libs-1.4.1.7-671.1
 libstdc++-3.3.3-43.24
 libstdc++-devel-3.3.3-43.24
 make-3.80-184.1
 pdksh-5.2.14-780.1
 sysstat-5.0.1-35.1
 xscreensaver-4.16-2.6
 4)命令
   操作系统型号
   # cat /etc/issue
   内核型号
   # uname -r
   查询安装包
   # rpm -q package_name
    
   RL AS4 下查询脚本
 rpm -qa binutils
 rpm -qa compat-db
 rpm -qa compat-libstdc++-33
 rpm -qa control-center
 rpm -qa gcc
 rpm -qa gcc-c++
 rpm -qa glibc
 rpm -qa glibc-common
 rpm -qa gnome-libs
 rpm -qa libstdc++
 rpm -qa libstdc++-devel
 rpm -qa make
 rpm -qa pdksh
 rpm -qa sysstat
 rpm -qa xscreensaver
 rpm -qa setarch
3、安装
   1)环境
   内存 2048M,硬盘146G
   2)分区
     /               30G
     /tmp            2G
     /var            3G
     /app            20G
     /app/oradata    60G
     /app/oraBP      20G
   3)安装
     选择所有的管理工具,开发工具,Gnome环境,Web Server,FTP Server
     除sysstat包都成功安装,
     sysstat包在4号盘上,rpm -i sysstat-5.0.5-1.i386.rpm
4、安装Oracle
   1)添加用户组
     判断用户和组是否存在
     grep dba /etc/group
     grep oinstall /etc/group
     id oracle
     id nobody
     有则不添加
     groupadd oinstall
     groupadd dba
     useradd -g oinstall -G dba oracle
     --oracle 已经存在 但不是 oinstall组,也非dba组成员
     usermod -g oinstall -G dba oracle
     useradd nobody
   2)内核参数
        Parameter Value File
 semmsl 250 /proc/sys/kernel/sem
   
 semmns 32000 
   
 semopm 100 
   
 semmni 128 
 shmall 2097152 /proc/sys/kernel/shmall
 shmmax Half the size of physical memory (in bytes) /proc/sys/kernel/shmmax
 shmmni 4096 /proc/sys/kernel/shmmni
 file-max 65536 /proc/sys/fs/file-max
 ip_local_port_range Minimum: 1024 /proc/sys/net/ipv4/ip_local_port_range
   
  Maximum: 65000 
 rmem_default 1048576 /proc/sys/net/core/rmem_default
 rmem_max 1048576 /proc/sys/net/core/rmem_max
 wmem_default 262144 /proc/sys/net/core/wmem_default
 wmem_max 262144 /proc/sys/net/core/wmem_max
   命令
        semmsl, semmns, semopm, and semmni # /sbin/sysctl -a | grep sem
 shmall, shmmax, and shmmni # /sbin/sysctl -a | grep shm
 file-max # /sbin/sysctl -a | grep file-max
 ip_local_port_range # /sbin/sysctl -a | grep ip_local_port_range
 rmem_default # /sbin/sysctl -a | grep rmem_default
 rmem_max # /sbin/sysctl -a | grep rmem_max
 wmem_default # /sbin/sysctl -a | grep wmem_default
 wmem_max # /sbin/sysctl -a | grep wmem_max
 修改配置文件/etc/sysctl.conf,增加或修改
 kernel.shmall = 2097152
 kernel.shmmax = 2147483648
 kernel.shmmni = 4096
 kernel.sem = 250 32000 100 128
 fs.file-max = 65536
 net.ipv4.ip_local_port_range = 1024 65000
 net.core.rmem_default = 1048576
 net.core.rmem_max = 1048576
 net.core.wmem_default = 262144
 net.core.wmem_max = 262144
 重新启动
 3)设置oracle用户的shell
   a)增加如下行到/etc/security/limits.conf
   oracle           soft    nproc   2047
   oracle           hard    nproc   16384
   oracle           soft    nofile  1024
   oracle           hard    nofile  65536
   b)增加下列行到/etc/pam.d/login
   session    required     /lib/security/pam_limits.so
   session    required     pam_limits.so
   c)修改Shell默认启动文件
   Bourne,Bash,Korm shell下增加下列行到/etc/profile
  
   if [ $USER = "oracle" ]; then
  if [ $SHELL = "/bin/ksh" ]; then
        ulimit -p 16384
        ulimit -n 65536
  else
        ulimit -u 16384 -n 65536
  fi
   fi
   
 C shell下,增加下列行到/etc/csh.login
 if ( $USER == "oracle" ) then
  limit maxproc 16384
  limit descrīptors 65536
 endif
 4)创建需要的目录
   mkdir /app/oracle
   chown -R oracle:oinstall /app/oracle
   chmod -R 775 /app/oracle
   chown -R oracle:oinstall /app/oradata
   chmod -R 775 /app/oradata
   chown -R oracle:oinstall /app/orabp
   chmod -R 775 /app/orabp
   这里只有一块硬盘,如果有多块硬盘,你需要将其建立一个挂接点,如u01,
   则目录为/u01/app/oracle,这里只有一个硬盘,挂接点就是/
 5)设置oracle用户环境
   a)如果在远程系统上安装oracle,在本地的X-Windows里显示,要设置
     xhost host_name
   b)用oracle登陆X-windows系统,或su - oracle
   c)查看默认Shell
     echo $SHELL
   d)bash
     vi .bash_profile
     如果设置了ORACLE_SID,ORACLE_HOME,ORACLE_BASE,删除相应行
   e)umask 022
   f)保存文件,执行
     . .bash_profile
   g)设置显示变量
     DISPLAY=localhost:0.0 ; export DISPLAY
     如果在远程显示界面,localhost就改成远程主机
   h)如果/tmp空间不够,需要设置TMP,TMPDIR变量
   $ su - root
  # mkdir /mount_point/tmp
  # chmod a+wr /mount_point/tmp
  # exit
  bash下
  $ TMP=/mount_point/tmp
  $ TMPDIR=/mount_point/tmp
  $ export TMP TMPDIR
  i)确定ORACLE_HOME,TNS_ADMIN没有设置
  $ unset ORACLE_HOME
  $ unset TNS_ADMIN
    j)检验是否设置正确
    $ umask
    $ env | more
   6)安装Oracle
     a)取得Oracle安装件
       从Oracle网站上下载,是免费的,只需要一个简单的注册即可,得到的是zip文件
       unzip 10201_database_linux32.zip
       如果是安装光盘,mount上介质
     b)运行
       runInstaller
     c)安装过程和Windows非常类似,要注意的是
       在选择dba组的时候选择oinstall
       修改一下默认目录,如安装目录,Inventory目录
       安装之前程序会检查一下系统配置,如果按照上面的设置,不会有任何问题,
       install即可
       这样安装的oracle的数据文件在默认目录下,如果要放到不同的盘上,
       可以删除数据库重建,或者安装的时候选择高级安装
       安装Net 8时,系统提示以root用户执行两个脚本,照做就可以了
5、点滴
   1)注意ORACLE_HOME变量,如果不存在,需要手工设置
     ORACLE_HOME=/app/oracle/product/10.2.0/db_1  
   2)建库命令为/app/oracle/product/10.2.0/db_1/bin/dbca &
    注意设置字符集,因为安装界面用中文没法安装,所以使用英文环境安装,
    所以不能使用默认配置,要修改默认字符集及默认语言
   3)Net 8 命令为/app/oracle/product/10.2.0/db_1/bin/netca &
   4)在其它机器上远程用Net8连接Oracle,需要打开Linux上的1521端口
     配置如下
     Applications->System Setting->Secuity Level 其它端口增加1521:tcp即可
   5)让oracle随机器启动而启动
     在.bash_profile里设置
     ORACLE_SID=orcl
     ORACLE_HOME=/app/oracle/product/10.2.0/db_1
     export ORACLE_SID
     export ORACLE_HOME
     PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
     export PATH
     修改/etc/oratab,
     orcl:/app/oracle/product/10.2.0/db_1:Y
     最后一个字母默认是N,修改为Y,否则dbstart,dbshut都不会起作用
     修改/app/oracle/product/10.2.0/db_1/dbstart中的相关行为
     ORACLE_HOME_LISTNER=/app/oracle/product/10.2.0/db_1
     然后修改/etc/rc.local,增加这样的一行
     su - oracle -c dbstart
     这样就可以了,但不能关机的时候自动关闭,所以需要手工处理
     su - oracle -c dbshut
     如果是oracle用户可以直接dbshut
    
     注:我曾经尝试过网上找到的如下方法,但系统没法启动,需要用恢复模式删掉脚本才可以,
     不知道是不是我的配置问题,如果看出我的错误请告诉我
     开机时让 RedHat Linux 自动启动Oracle,需要完成以下步骤:

  运行 $ORACLE_HOME 下的 root.sh,会生成一个文件 /etc/oratab 。
  
  编辑 /etc/oratab ,把所有的 instance 的重启动标志设置成 'Y',如:
  ora10g:/home/oracle/OraHome_1:Y
  
  做一个启动脚本 /etc/init.d/dbora ,如下所示:
  
  #!/bin/sh
  # descrīption: Oracle auto start-stop scrīpt.
  # chkconfig: - 20 80
  #
  # Set ORA_HOME to be equivalent to the $ORACLE_HOME
  # from which you wish to execute dbstart and dbshut;
  #
  # Set ORA_OWNER to the user id of the owner of the
  # Oracle database in ORA_HOME.
  ORA_HOME=/app/oracle/product/10.2.0/db_1
  ORA_OWNER=oracle
  if [ ! -f $ORA_HOME/bin/dbstart ]
  then
      echo "Oracle startup: cannot start"
      exit
  fi
  case "$1" in
      'start')
          # Start the Oracle databases:
          # The following command assumes that the oracle login
          # will not prompt the user for any values
          su - $ORA_OWNER -c $ORA_HOME/bin/dbstart
          su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl start"
          ;;
      'stop')
          # Stop the Oracle databases:
          # The following command assumes that the oracle login
          # will not prompt the user for any values
          su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl stop"
          su - $ORA_OWNER -c $ORA_HOME/bin/dbshut
          ;;
      'restart')
          $0 stop
          $0 start
          ;;
  esac


  
  赋予执行权限
  chmod 750 /etc/init.d/dbora
  
  作成以下链接:
  ln -s /etc/init.d/dbora /etc/rc0.d/K10dbora
  ln -s /etc/init.d/dbora /etc/rc3.d/S99dbora
  
  执行以下命令:
  chkconfig --level 345 dbora on
  
  这样就OK了。下次开关机的时候,Oracle也会随之启动/停止。


TAG:

 

评分:0

我来说两句

Open Toolbar