Oracle DataBase单实例使用ASM案例(2)--Oracle 11g之环境准备
系统环境:
操作系统:RedHat EL5(64)
Oracle 软件:Oracle 11gR2、Oracle GI
对于Oracle 11g使用ASM作为存储系统,必须要构建Oracle GI的环境。
1、配置系统环境
1)建立用户和组(需要建立grid用户)
[root@node1 ~]# groupadd -g 200 oinstall
[root@node1 ~]# groupadd -g 201 dba
[root@node1 ~]# groupadd -g 202 oper
[root@node1 ~]# groupadd -g 203 asmadmin
[root@node1 ~]# groupadd -g 204 asmoper
[root@node1 ~]# groupadd -g 205 asmdba
[root@node1 ~]# useradd -u 200 -g oinstall -G dba,asmdba,oper oracle
[oracle@node1 ~]$ id oracle
uid=200(oracle) gid=200(oinstall) groups=200(oinstall),201(dba),202(oper),205(asmdba)
[root@node1 ~]# useradd -u 201 -g oinstall -G asmadmin,asmdba,asmoper,oper,dba grid
2)建立相应的安装目录
[root@node1 ~]# mkdir -p /u01/app/oraInventory
[root@node1 ~]# chown -R grid:oinstall /u01/app/oraInventory/
[root@node1 ~]# chmod -R 775 /u01/app/oraInventory/
[root@node1 ~]# mkdir -p /u01/11.2.0/grid
[root@node1 ~]# chown -R grid:oinstall /u01/11.2.0/grid/
[root@node1 ~]# chmod -R 775 /u01/11.2.0/grid/
[root@node1 ~]# mkdir -p /u01/app/oraInventory/
[root@node1 ~]# mkdir -p /u01/app/oracle
[root@node1 ~]# mkdir -p /u01/app/oracle/cfgtoollogs
[root@node1 ~]# mkdir -p /u01/app/oracle/product/11.2.0/db_1
[root@node1 ~]# chown -R oracle:oinstall /u01/app/oracle
[root@node1 ~]# chmod -R 775 /u01/app/oracle
3)设置用户环境变量
oracle 用户:
export EDITOR=vi
export ORACLE_SID=prod
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export PATH=$ORACLE_HOME/bin:/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin
umask 022
grid用户:
export EDITOR=vi
export ORACLE_SID=+ASM
export ORACLE_BASE=/u01/app/oracle
export GRID_HOME=/u01/11.2.0/grid
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export THREADS_FLAG=native
export PATH=$ORACLE_HOME/bin:/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin
umask 022
4)配置系统内核参数
[root@node1 ~]# /etc/sysctl.conf
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 536870912
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
[root@node1 ~]# cat /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
grid soft stack 10240
[root@node1 ~]# cat /etc/pam.d/login
session required /lib/security/pam_limits.so
[root@node1 ~]#/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
5)安装所需的软件包
配置yum环境:
[root@node1 yum.repos.d]#cd /etc/yum.repos.d
[root@node1 yum.repos.d]# cat yum.repo
[Base]
name=Red Hat Enterprise Linux
baseurl=file:///media/Server
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
挂载RH EL5安装ISO,安装以下软件包:
libaio-0.3.106-5
libaio-devel-0.3.106-5
libaio-0.3.106-5
sysstat-7.0.2-3.el5
unix2dos-2.2-26.2.3.el5
unixODBC-2.2.11-7.1
unixODBC-kde-2.2.11-7.1
unix2dos-2.2-26.2.3.el5
dos2unix-3.1-27.2.el5
unixODBC-devel-2.2.11-7.1
6)网络环境
[root@bjsrv ~]#cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost
192.168.8.128 bjsrv
2、配置ASM存储环境
1)建立磁盘分区
[root@node1 ~]#fdisk -l
Disk /dev/sdc: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdc1 1 487 3911796 83 Linux
/dev/sdc2 488 974 3911827+ 83 Linux
/dev/sdc3 975 2610 13141170 5 Extended
/dev/sdc5 975 1461 3911796 83 Linux
/dev/sdc6 1462 1948 3911796 83 Linux
/dev/sdc7 1949 2192 1959898+ 83 Linux
/dev/sdc8 2193 2436 1959898+ 83 Linux
/dev/sdc9 2437 2610 1397623+ 83 Linux
2)安装ASM软件包
(Linux、Windows需要安装ASM软件包,可以在Oracle OTN下载,注意和Linux系统内核匹配)
http://www.oracle.com/technetwork/topics/linux/asmlib/index-101839.html
[root@bjsrv ~]#uname -a
Linux bjsrv 2.6.18-194.el5 #1 SMP Tue Mar 16 21:52:39 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux
[root@bjsrv asm]#ls -l
-rwxr--r-- 1 oracle oinstall 137486 May 26 04:01 oracleasm-2.6.18-194.el5-2.0.5-1.el5.x86_64.rpm
-rwxr--r-- 1 oracle oinstall 14176 May 26 03:48 oracleasmlib-2.0.4-1.el5.x86_64.rpm
-rwxr--r-- 1 oracle oinstall 90225 May 26 03:48 oracleasm-support-2.1.8-1.el5.x86_64.rpm
[root@bjsrv asm]#rpm -vih oracleasm-support-2.1.8-1.el5.x86_64.rpm
warning: oracleasm-support-2.1.8-1.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing... ########################################### [100%]
1:oracleasm-support ########################################### [100%]
[root@bjsrv asm]#rpm -vih oracleasm-2.6.18-194.el5-2.0.5-1.el5.x86_64.rpm
warning: oracleasm-2.6.18-194.el5-2.0.5-1.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing... ########################################### [100%]
1:oracleasm-2.6.18-194.el########################################### [100%]
[root@bjsrv asm]#rpm -ivh oracleasmlib-2.0.4-1.el5.x86_64.rpm
warning: oracleasmlib-2.0.4-1.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing... ########################################### [100%]
1:oracleasmlib ########################################### [100%]
3)配置ASM
[root@bjsrv asm]#service 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
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) [y]:
Scan for Oracle ASM disks on boot (y/n) [y]:
Writing Oracle ASM library driver configuration: done
Initializing the Oracle ASMLib driver: [ OK ]
Scanning the system for Oracle ASMLib disks: [ OK ]
4)创建ASM磁盘
[root@bjsrv asm]#service oracleasm createdisk ASM_DSK1 /dev/sdc1
Marking disk "ASM_DSK1" as an ASM disk: [ OK ]
[root@bjsrv asm]#service oracleasm createdisk ASM_DSK2 /dev/sdc2
Marking disk "ASM_DSK2" as an ASM disk: [ OK ]
[root@bjsrv asm]#service oracleasm createdisk ASM_DSK3 /dev/sdc5
Marking disk "ASM_DSK3" as an ASM disk: [ OK ]
[root@bjsrv asm]#service oracleasm createdisk ASM_DSK4 /dev/sdc6
Marking disk "ASM_DSK4" as an ASM disk: [ OK ]
[root@bjsrv asm]#service oracleasm listdisks
ASM_DSK1
ASM_DSK2
ASM_DSK3
ASM_DSK4
[root@bjsrv asm]#
@至此,系统环境基本准备完毕