日期:2014-05-16  浏览次数:20725 次

单用户安装Oracle 11g 单机ASM

一、安装准备

      环境:RedHat 5.6 64位   Oracle 11.2.0.3

      初始化安装环境(用脚本完成):     

#!/bin/bash
if [ ! $1 ] || [ ! $2 ] 
then  
   echo "execute error,please input sid and oracle basic home path"
   exit
fi

yum install -y binutils* compat-libstdc++* elfutils-libelf* elfutils-libelf-devel* elfutils-libelf-devel-static* gcc* gcc-c++* glibc* glibc-common* glibc-devel* glibc-headers* kernel-headers* ksh* libaio* libaio-devel* libgcc* libgomp* libstdc++* libstdc++-devel* make* numactl-devel* sysstat* unixODBC* openmotif* compat-lib* compat-gcc*

/usr/sbin/groupadd -g 501 oinstall
/usr/sbin/groupadd -g 502 dba
/usr/sbin/groupadd -g 503 asmadmin
/usr/sbin/groupadd -g 504 asmdba
/usr/sbin/useradd -g oinstall -G dba,asmadmin,asmdba oracle
echo oracle | passwd oracle --stdin


mkdir -p $2/oracle/app/oraInventory
mkdir -p $2/oracle/app/grid
mkdir -p $2/oracle/app/oracle
chown -R oracle:oinstall $2/oracle/app/
chown -R oracle:oinstall $2/oracle/app/oraInventory
chown -R oracle:oinstall $2/oracle/app/grid
chown -R oracle:oinstall $2/oracle/app/oracle
chmod -R 775 $2/oracle/app/
chmod -R 775 $2/oracle/app/oraInventory
chmod -R 775 $2/oracle/app/oracle
chmod -R 775 $2/oracle/app/grid

cat > /home/oracle/.bash_grid_profile <<EOF
export PATH=$PATH:$HOME/bin
export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_SID=+ASM
export ORACLE_BASE=$2/oracle/app/oracle
export ORACLE_HOME=$2/oracle/app/grid/product/11.2.0
export CVUQDISK_GRP=oinstall
export NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS"
export THREADS_FLAG=native
export PATH=$2/oracle/app/grid/product/11.2.0/bin:$PATH
EOF


cat > /home/oracle/.bash_profile <<EOF
export PATH=$PATH:$HOME/bin
export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_BASE=$2/oracle/app/oracle
export ORACLE_HOME=$2/oracle/app/oracle/product/11.2.0
export ORACLE_SID=$1
export ORACLE_TERM=xterm
export PATH=$ORACLE_HOME/bin:/usr/sbin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
export NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS"
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
EOF




cat >> /etc/security/limits.conf <<EOF
oracle     soft    nproc   2047
oracle     hard    nproc   16384
oracle     soft    nofile  1024
oracle     hard    nofile  65536
EOF


echo "session required  pam_limits.so ">> /etc/pam.d/login

cat >> /etc/profile <<EOF
if [ $USER = "oracle" ]; then
         if [ $SHELL = "/bin/ksh" ]; then
                 ulimit -p 16384
                 ulimit -n 65536
         else
                 ulimit -u 16384 -n 65536
         fi
fi
EOF

cat >>/etc/sysctl.conf <<EOF
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 4294967295
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048586
EOF

sysctl -p

  将软件解压到/opt/soft/目录,给予oracle用户读权限。

  以下安装都是用oracle一个用户完成,没有单独配置grid用户。


二、用udev配置asm磁盘

    /dev/sdb、/dev/sdc、/dev/sdd 分别为三块硬盘。

  用scsi_id获取块设备的唯一标示符:

  [root@oratest ~]# /sbin/scsi_id -g -u -s /block/sdb

  36000c2945fbd119dfeb6f164fdcfa54e

  [root@oratest ~]# /sbin/scsi_id -g -u -s /block/sdc

  36000c297080ea12caa33925bb579012a

  [root@oratest ~]# /sbin/scsi_id -g -u -s /block/sdd

  36000c299eb521cb7b35a1ea392fff524

  创建udev配置文件:
  [root@oratest ~]# vi /etc/udev/rules.d/99-oracle-asmdevices.rules

  KERNEL=="sd*