Oracle11gR2+ASM安装详细操作(一)

题记:关于oracle和ASM的安装配置应该算是老生常谈了,由于11gR2的安装配置方法和之前版本的有很大的区别,所以我特地抽了时间做了这个实验,也顺便将整个安装过程分享出来给大家,希望能给各位提供帮助,请多多指教!
 

1. 准备工作

企业建站必须是能够以充分展现企业形象为主要目的,是企业文化与产品对外扩展宣传的重要窗口,一个合格的网站不仅仅能为公司带来巨大的互联网上的收集和信息发布平台,创新互联公司面向各种领域:成都自上料搅拌车网站设计成都全网营销解决方案、网站设计等建站排名服务。


(1)      操作系统版本

[root@AS5 ~]# uname -a

Linux AS5 2.6.18-164.el5 #1 SMP Tue Aug 18 15:51:54 EDT 2009 i686 i686 i386 GNU/Linux

(2)      Yum仓库创建

[root@AS5 ~]# mount -o remount /dev/hdc /mnt                  

[root@AS5 ~]# cat /etc/yum.repos.d/rhel-debuginfo.repo        

[rhel-debuginfo]                                              

name=Red Hat Enterprise Linux $releasever - $basearch - Debug 

baseurl=file:///mnt/Server                                    

enabled=1                                                     

gpgcheck=0                                                    

[root@AS5 ~]# yum clean all

Loaded plugins: rhnplugin, security

Cleaning up Everything

[root@AS5 ~]# yum grouplist

(3)      硬盘、内存等信息

[root@AS5 ~]# df -H

Filesystem            Size  Used Avail Use% Mounted on

/dev/sda3              17G  2.7G   14G 17% /

/dev/sda1             104M   12M   87M 12% /boot

tmpfs                 1.1G     0  1.1G  0% /dev/shm

/dev/hdc              3.1G  3.1G     0 100% /mnt

[root@AS5 ~]# free -m

            total      used      free    shared   buffers    cached

Mem:      1010       239       771    0        15       184

-/+ buffers/cache:        39       971

Swap:       2000       0      2000

(4)      网络配置

[root@AS5 ~]# ifconfig eth0

eth0     Link encap:Ethernet HWaddr 00:0C:29:C7:70:76 

         inet addr:172.24.0.200 Bcast:172.24.0.255 Mask:255.255.255.0

         inet6 addr: fe80::20c:29ff:fec7:7076/64 Scope:Link

         UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

         RX packets:1343052 errors:31 dropped:31 overruns:0 frame.:0

         TX packets:113486 errors:0 dropped:0 overruns:0 carrier:0

         collisions:0 txqueuelen:1000

         RX bytes:2019886062 (1.8 GiB) TX bytes:11644712 (11.1 MiB)

         Interrupt:75 Base address:0x2000

[root@AS5 ~]# hostname

AS5

[root@AS5 ~]# cat /etc/sysconfig/network

NETWORKING=yes

NETWORKING_IPV6=no

HOSTNAME=AS5

GATEWAY=172.24.0.1

[root@AS5 ~]# cat /etc/hosts

# Do not remove the following line, or various programs

# that require network functionality will fail.

127.0.0.1       localhost.localdomain localhost AS5

::1         localhost6.localdomain6 localhost6

172.24.0.200 AS5

(5)      安装必要的软件包

oracle要求的必要软件包如下:

binutils-2.17.50.0.6

compat-libstdc++-33-3.2.3

elfutils-libelf-0.125

elfutils-libelf-devel-0.125

elfutils-libelf-devel-static-0.125

gcc-4.1.2

gcc-c++-4.1.2

glibc-2.5-24

glibc-common-2.5

glibc-devel-2.5

glibc-headers-2.5

kernel-headers-2.6.18

ksh-20060214

libaio-0.3.106

libaio-devel-0.3.106

libgcc-4.1.2

libgomp-4.1.2

libstdc++-4.1.2

libstdc++-devel-4.1.2

make-3.81

sysstat-7.0.2

unixODBC-2.2.11

unixODBC-devel-2.2.11

安装方法:(安装时我添加了这两个包:libXp pdksh

[root@AS5 ~]# yum  –y install binutils compat-* elfutils-libelf* gcc gcc-c++ glibc* kernel-headers ksh libaio* libgcc libgomp libstdc++* make sysstat unixODBC* libXp pdksh

(6)      建立用户及组

[root@AS5 ~]# groupadd oinstall

[root@AS5 ~]# groupadd dba

[root@AS5 ~]# groupadd asmadmin

[root@AS5 ~]# groupadd asmdba

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

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

[root@AS5 ~]# passwd grid

[root@AS5 ~]# passwd oracle

[root@AS5 ~]# id grid

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

[root@AS5 ~]# id oracle

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

(7)      配置内核参数及其他配置选项

/etc/sysctl.conf配置文件中添加如下:

#===================oracle11gr2=====================

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@AS5 ~]# sysctl -p

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

#====================oracle11gr2======================

oracle soft nproc 2047

oracle hard nproc 16384

oracle soft nofile 1024

oracle hard nofile 65536

grid soft nproc 2047

grid hard nproc 16384

grid soft nofile 1024

grid hard nofile 65536

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

#=================oracle11gr2=====================

session required pam_limits.so

/etc/profile配置文件中添加:

#===================oracle11gr2=====================

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

(8)      建立相应目录

[root@AS5 ~]# mkdir -p /u01/app/oracle

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

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

(9)      配置gridoracle用户的环境变量

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

#========================oracle11gr2—grid ============================

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

#stty erase ^h

~oracle/.bash_profile配置文件中添加:

#======================oracle11gr2=========================

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

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=American_America.ZHS16GBK

export ORACLE_BASE ORACLE_HOME ORACLE_SID LD_LIBRARY_PATH PATH NLS_LANG TMP TMPDIR

stty erase ^h

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

2.安装ASM存储(grid

说明:如果数据库文件直接存储在文件系统中,这一步可以略过。

(1)      系统现在有空闲的分区

[root@AS5 install]# fdisk -l /dev/sdb

Disk /dev/sdb: 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/sdb1              1       2610   20964793+  5 Extended

/dev/sdb5              1        366    2939832  83 Linux

/dev/sdb6            367        732    2939863+ 83 Linux

/dev/sdb7            733       1098    2939863+ 83 Linux

/dev/sdb8           1099       1342    1959898+ 83 Linux

[root@AS5 u02]# chown grid:asmadmin /dev/sdb?

[root@AS5 u02]# ls -l /dev/sdb?

brw-r----- 1 grid asmadmin 8, 17 Jul 15 18:25 /dev/sdb1

brw-r----- 1 grid asmadmin 8, 21 Jul 15 18:24 /dev/sdb5

brw-r----- 1 grid asmadmin 8, 22 Jul 15 18:25 /dev/sdb6

brw-r----- 1 grid asmadmin 8, 23 Jul 15 18:24 /dev/sdb7

brw-r----- 1 grid asmadmin 8, 24 Jul 15 18:25 /dev/sdb8

(2)      安装AMBlib

[root@AS5 u02]# rpm -ivh oracleasm-support-2.1.3-1.el5.i386.rpm

Preparing...               ########################################### [100%]

  1:oracleasm-support     ########################################### [100%]

[root@AS5 u02]# rpm -ivh oracleasm-2.6.18-164.el5-2.0.5-1.el5.i686.rpm

warning: ora005_oracleasm-2.6.18-164.el5-2.0.5-1.el5.i686.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159

Preparing...               ########################################### [100%]

  1:oracleasm-2.6.18-164.el########################################### [100%]

[root@AS5 u02]# rpm -ivh oracleasmlib-2.0.4-1.el5.i386.rpm

Preparing...               ########################################### [100%]

  1:oracleasmlib          ########################################### [100%]

(3)      配置ASM

[root@AS5 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 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@AS5 u02]# /usr/sbin/oracleasm init

(4)      创建ASM磁盘

[root@AS5 u02]# service oracleasm createdisk VOL01 /dev/sdb5

Marking disk "VOL01" as an ASM disk: [ OK ]

[root@AS5 u02]# service oracleasm createdisk VOL02 /dev/sdb6

Marking disk "VOL02" as an ASM disk: [ OK ]

[root@AS5 u02]# service oracleasm createdisk VOL03 /dev/sdb7

Marking disk "VOL03" as an ASM disk: [ OK ]

[root@AS5 u02]# service oracleasm createdisk VOL04 /dev/sdb8

Marking disk "VOL04" as an ASM disk: [ OK ]

[root@AS5 u02]# oracleasm scandisks

Reloading disk partitions: done

Cleaning any stale ASM disks...

Scanning system for ASM disks...

[root@AS5 u02]# oracleasm listdisks

VOL01

VOL02

VOL03

VOL04

(5)      关闭时间服务

[root@AS5 u02]# service ntpd stop

Shutting down ntpd: [FAILED]

[root@AS5 u02]# chkconfig ntpd off

[root@AS5 u02]# mv /etc/ntp.conf /etc/ntp.conf_bak

 


当前名称:Oracle11gR2+ASM安装详细操作(一)
标题来源:http://myzitong.com/article/jheccp.html