Centos5.8_x86_64+ASM+ORACLE11G

 
操作系统Centos5.8_64位

安装桌面,关闭SELINUX以及关闭防火墙,

 
1 、内存以及swap分区大小,服务器2G以上内存就可以安装,尽可能给大些。

Minimum : 1 GB of RAM

Recommended : 2 GB of RAM or more

To determine the RAM size, enter the following command:

#grep MemTotal /proc/meminfo

 
Swap 分区大小设置

Between 1 GB and 2 GB  分配1.5 times the size of the RAM

Between 2 GB and 16 GB 分配Equal to the size of the RAM

More than 16 GB         分配16GB

#grep SwapTotal /proc/meminfo  确定大小

 
2 、需要安装以下软件

binutils-2.20.51.0.2-5.11.el6 (x86_64)

compat-libcap1-1.10-1 (x86_64)

compat-libstdc++-33-3.2.3-69.el6 (x86_64)

compat-libstdc++-33-3.2.3-69.el6.i686

gcc-4.4.4-13.el6 (x86_64)

gcc-c++-4.4.4-13.el6 (x86_64)

glibc-2.12-1.7.el6 (i686)

glibc-2.12-1.7.el6 (x86_64)

glibc-devel-2.12-1.7.el6 (x86_64)

glibc-devel-2.12-1.7.el6.i686

ksh

libgcc-4.4.4-13.el6 (i686)

libgcc-4.4.4-13.el6 (x86_64)

libstdc++-4.4.4-13.el6 (x86_64)

libstdc++-4.4.4-13.el6.i686

libstdc++-devel-4.4.4-13.el6 (x86_64)

libstdc++-devel-4.4.4-13.el6.i686

libaio-0.3.107-10.el6 (x86_64)

libaio-0.3.107-10.el6.i686

libaio-devel-0.3.107-10.el6 (x86_64)

libaio-devel-0.3.107-10.el6.i686

make-3.81-19.el6

sysstat-9.0.4-11.el6 (x86_64)

unixODBC*

libXp

pdksh

 
配置Yum安装

将光盘挂载到/mnt位置

[root@oracle ~]# mount /dev/cdrom /mnt

[root@oracle ~]# vi /etc/yum.repos.d/base.repo

[base]

name=base

baseurl=file:///mnt/

enabled=1

gpgcheck=0

 
执行下面语句安装

yum -y install binutils compat-* elfutils-libelf* gcc gcc-c++ glibc* kernel-headers ksh libaio* libgcc libgomp libstdc++* make sysstat libXp pdksh.x86_64 unixODBC unixODBC-devel

 
3 、注意主机名

[oracle@oracle11g ~]$ cat /etc/hosts

# Do not remove the following line, or various programs

# that require network functionality will fail.

127.0.0.1               oracle11g localhost.localdomain localhost

::1             localhost6.localdomain6 localhost6

172.16.40.30    oracle

 
4 、建立相应的用户和组

[root@oracle ~]# groupadd oinstall

[root@oracle ~]# groupadd dba

[root@oracle ~]# groupadd asmadmin

[root@oracle ~]# groupadd asmdba

[root@oracle ~]# useradd -g oinstall -G asmdba,asmadmin,dba grid

[root@oracle ~]# useradd -g oinstall -G dba,asmdba oracle

[root@oracle ~]# passwd grid

[root@oracle ~]# passwd oracle

[root@oracle ~]# id grid

uid=500(grid) gid=500(oinstall) groups=500(oinstall),501(dba),502(asmadmin),503(asmdba)

[root@oracle ~]# id oracle

uid=501(oracle) gid=500(oinstall) groups=500(oinstall),501(dba),503(asmdba)

 
5 、修改/etc/sysctl.conf文件,添加以下内容

fs.aio-max-nr = 1048576

fs.file-max = 6815744

kernel.shmall = 2097152

kernel.shmmax = 536870912     1/2 物理内存(单位M*1024*1024(注意修改这段)

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 = 1048576

 
# /sbin/sysctl -p 执行该命令,使修改生效,不用重启系统。

 
6 、在/etc/pam.d/login配置文件中添加:

session    required    pam_limits.so

 
7 、再在/etc/security/limits.conf配置文件中添加:

oracle soft nproc 2047

oracle hard nproc 16384

oracle soft nofile 1024

oracle hard nofile 65536

oracle soft stack 10240

grid soft nproc 2047

grid hard nproc 16384

grid soft nofile 1024

grid hard nofile 65536

 
 
8 、在/etc/profile配置文件中添加:

if [ $USER = "oracle" ] || [ $USER = "grid" ]; then

       if [ $SHELL = "/bin/ksh" ]; then

               ulimit -p 16384

               ulimit -n 65536

       else

               ulimit -u 16384 -n 65536

       fi

fi  

 
9 、配置gridoracle用户的环境变量

/home/grid/.bash_profile配置文件中添加:

umask 022

TMP=/tmp

TMPDIR=/tmp

PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin

ORACLE_BASE=/u02/app/grid

ORACLE_HOME=$ORACLE_BASE/11.2.0

ORACLE_SID=+ASM

PATH=$ORACLE_HOME/bin:$PATH

export ORACLE_BASE ORACLE_HOME ORACLE_SID PATH TMP TMPDIR

 
10 、在/home/oracle/.bash_profile配置文件中添加:

umask 022

TMP=/tmp

TMPDIR=/tmp

PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin

LD_LIBRARY_PATH=/usr/lib:/usr/X11R6/lib

ORACLE_BASE=/u01/app/oracle

ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1

ORACLE_SID=orcl

LD_LIBRARY_PATH=$ORACLE_HOME/jdk/jre/lib/i386:$ORACLE_HOME/jdk/jre/lib/i386/server:$ORACLE_HOME/rdbms/lib:$ORACLE_HOME/lib:$LD_LIBRARY_PATH

PATH=$ORACLE_HOME/bin:$PATH

NLS_LANG="SIMPLIFIED CHINESE_CHINA.AL32UTF8"    -- 注意这里的语言,如果错误将会导致sqlplus无法进入。

export ORACLE_BASE ORACLE_HOME ORACLE_SID LD_LIBRARY_PATH PATH NLS_LANG TMP TMPDIR

 
11 、建立相应目录

[root@oracle ~]# chown -R oracle:oinstall /u01

[root@oracle ~]# chmod -R 775 /u01

[root@oracle ~]# mkdir -p /u02/app/grid

[root@oracle ~]# chown -R oracle:oinstall /u02/

[root@oracle ~]# chmod -R 775 /u02/

 
 
至此,整个环境搭建完毕。如果可以,建议重启系统。

 
接下来,在磁盘剩余空间创建8个分区,也可以在虚拟机里面添加8个磁盘。下面红色标记的是我创建的8个分区。

 
[root@oracle11g ~]# fdisk -l

 
Disk /dev/sda: 53.6 GB, 53687091200 bytes

255 heads, 63 sectors/track, 6527 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 
   Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *           1          13      104391   83  Linux

/dev/sda2              14        2563    20482875   83  Linux

/dev/sda3            2564        3583     8193150   82  Linux swap / Solaris

/dev/sda4            3584        6527    23647680    5  Extended

/dev/sda5            3584        3827     1959898+  83  Linux

/dev/sda6            3828        4071     1959898+  83  Linux

/dev/sda7            4072        4315     1959898+  83  Linux

/dev/sda8            4316        4559     1959898+  83  Linux

/dev/sda9            4560        4803     1959898+  83  Linux

/dev/sda10           4804        5047     1959898+  83  Linux

/dev/sda11           5048        5291     1959898+  83  Linux

/dev/sda12           5292        5535     1959898+  83  Linux

 
接下来下载安装AMBLIB包,下面是下载地址

我需要下载3个包,下载之前先确认内核版本

[root@oracle11g ~]# uname -r

2.6.18-308.el5

oracleasm-support-2.1.7-1.el5.x86_64.rpm

oracleasmlib-2.0.4-1.el5.x86_64.rpm

oracleasm-2.6.18-308.el5-2.0.5-1.el5.x86_64.rpm

下载之后, rpm –ivh 安装

 
接下来配置 ASM

[root@oracle u02]# /etc/init.d/oracleasm configure

Configuring the Oracle ASM library driver.

This will configure the on-boot properties of the Oracle ASM library

driver. The following questions will determine whether the driver is

loaded on boot and what permissions it will have. The current values

will be shown in brackets ('[]'). Hitting <ENTER> without typing an

answer will keep that current value. Ctrl-C will abort.

Default user to own the driver interface []:grid

Default group to own the driver interface []:asmadmin

Start Oracle ASM library driver on boot (y/n) [n]: y

Scan for Oracle ASM disks on boot (y/n) [y]: y

Writing Oracle ASM library driver configuration: done

Initializing the Oracle ASMLib driver: [ OK ]

Scanning the system for Oracle ASMLib disks: [ OK ]

[root@oracle u02]# /usr/sbin/oracleasm init

 
接下来创建ASM 磁盘

service oracleasm createdisk VOL01 /dev/sda5

service oracleasm createdisk VOL02 /dev/sda6

service oracleasm createdisk VOL03 /dev/sda7

service oracleasm createdisk VOL04 /dev/sda8

service oracleasm createdisk VOL05 /dev/sda9

service oracleasm createdisk VOL06 /dev/sda10

service oracleasm createdisk VOL07 /dev/sda11

service oracleasm createdisk VOL08 /dev/sda12

 
接下来关闭时间服务

[root@oracle u02]# /etc/init.d/ntpd stop

[root@oracle u02]# chkconfig ntpd off

 
接下来安装 grid 软件,下载软件移动到 /home/grid 目录里面,解压,安装。

 
如果出现口令无法输入,请返回执行以下

xprop -root -remove _MOTIF_DEFAULT_BINDINGS

xprop -remove WM_LOCALE_NAME

xprop -root -remove XIM_SERVERS

 
图形化安装过程省略