Oracle 11g R2 ASM安装Grid Infrastructure

grid 软件包下载地址:
http://download.oracle.com/otn/linux/oracle11g/R2/linux_11gR2_grid.zip

安装前准备工作:
1、检查下列包是否安装,若未安装则要先安装:
binutils-2.17.50.0.6-2.el5
compat-libstdc++-33-3.2.3-61
elfutils-libelf-0.125-3.el5
elfutils-libelf-devel-0.125
glibc-2.5-12
glibc-common-2.5-12
glibc-devel-2.5-12
gcc-4.1.1-52
gcc-c++-4.1.1-52
libaio-0.3.106
libaio-devel-0.3.106
libgcc-4.1.1-52
libstdc++-4.1.1
libstdc++-devel-4.1.1-52.e15
make-3.81-1.1
sysstat-7.0.0
unixODBC-2.2.11
unixODBC-devel-2.2.11

检查发现以下软件包未安装:
libaio-devel-0.3.106-5.i386.rpm
sysstat-7.0.2-3.el5_5.1.i386.rpm
unixODBC-2.2.11-7.1.i386.rpm
unixODBC-devel-2.2.11-7.1.i386.rpm
安装软件包
rpm -ivh libaio-devel*.rpm sysstat-7.0.2-3*.rpm unixODBC-2.2.11-7.1.i386.rpm unixODBC-devel-2.2.11-7.1.i386.rpm

2> 检查内存与虚拟内存
[root@node1 opt]# free
             total       used       free     shared    buffers     cached
Mem:        681540     415396     266144          0       4612     310660
-/+ buffers/cache:     100124     581416
Swap:      2048276         84    2048192

3> 检查磁盘空间
[root@node1 opt]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda3              18G  5.3G   12G  33% /
/dev/sda1             190M   12M  169M   7% /boot
tmpfs                 333M     0  333M   0% /dev/shm

3、创建用户以及目录
[root@node1 /]# groupadd -g 500 oinstall
[root@node1 /]# groupadd -g 501 dba
[root@node1 /]# groupadd -g 502 oper
[root@node1 /]# groupadd -g 600 asmadmin
[root@node1 /]# groupadd -g 601 asmoper
[root@node1 /]# groupadd -g 602 asmdba
[root@node1 /]# useradd -g oinstall -G dba,asmdba,oper oracle
[root@node1 /]# useradd -g oinstall -G asmadmin,asmdba,asmoper,dba grid
[root@node1 /]# mkdir -p /u01/app/oracle/product/grid
[root@node1 /]# mkdir -p /u01/app/oracle/product/db
[root@node1 /]# chown -R grid:oinstall /u01
[root@node1 /]# chown -R oracle:oinstall /u01/app/oracle/product/db
[root@node1 /]# chmod -R 775 /u01
[root@node1 /]# passwd oracle
Changing password for user oracle.
New UNIX password:                                   //oracle11
BAD PASSWORD: it is based on a dictionary word
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
[root@node1 /]# passwd grid
Changing password for user grid.
New UNIX password:                                   //grid11
BAD PASSWORD: it is based on a dictionary word
Retype new UNIX password:
passwd: all authentication tokens updated successfully

配置 grid 用户环境变量:
[root@node1 /]# vi /home/grid/.bash_profile
export ORACLE_SID=+ASM
export ORACLE_BASE=/u01/app/grid
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/grid
export ORACLE_TERM=xterm
export TMP=/tmp
export TMPDIR=$TMP
PATH=$PATH:$HOME/bin
export PATH=/usr/sbin:$PATH:$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
[root@node1 /]# source /home/grid/.bash_profile       

配置oracle 用户环境变量:
[root@node1 /]# vi /home/oracle/.bash_profile

export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export ORACLE_SID=ora11g
export ORACLE_OWNER=oracle
export ORACLE_TERM=vt100
export PATH=$PATH:$ORACLE_HOME/bin:$HOME/bin
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/Apache/Apache/bin:$PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/usr/local/lib
export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
CLASSPATH=$CLASSPATH:$ORACLE_HOME/network/jlib
export CLASSPATH
[root@node1 /]#source /home/oracle/.bash_profile

修改系统内核参数:
[root@node1 opt]# vi /etc/sysctl.conf
kernel.shmall = 2097152
kernel.shmmax = 536870912
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.aio-max-nr = 1048576
fs.file-max = 65536
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 1048576
net.core.rmem_max = 1048576
net.core.wmem_default = 262144
net.core.wmem_max = 262144
[root@node1 /]# sysctl -p

设定用户限制
# vi /etc/security/limits.conf
#ORACLE SETTING
grid soft nproc 2047
grid hard nproc 16384
grid soft nofile 1024
grid hard nofile 65536
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536

用户界面安全设置
[root@node1 opt]# vi /etc/pam.d/login
session    required     /lib/security/pam_limits.so
session    required     pam_limits.so

vi /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
 umask 022
fi

物理添加磁盘后,将磁盘分区
root@node1 /]# fdisk -l

Disk /dev/sda: 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/sda1   *           1          25      200781   83  Linux
/dev/sda2              26         280     2048287+  82  Linux swap / Solaris
/dev/sda3             281        2610    18715725   83  Linux

Disk /dev/sdb: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdb doesn't contain a valid partition table
[root@node1 /]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.


The number of cylinders for this disk is set to 1044.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1044, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-1044, default 1044): +2000M

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (245-1044, default 245):
Using default value 245
Last cylinder or +size or +sizeM or +sizeK (245-1044, default 1044): +2000M

Command (m for help): N
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 3
First cylinder (489-1044, default 489):
Using default value 489
Last cylinder or +size or +sizeM or +sizeK (489-1044, default 1044): +2000M

Command (m for help): N
Command action
   e   extended
   p   primary partition (1-4)
E
Selected partition 4
First cylinder (733-1044, default 733):
Using default value 733
Last cylinder or +size or +sizeM or +sizeK (733-1044, default 1044):
Using default value 1044

Command (m for help): N
First cylinder (733-1044, default 733):
Using default value 733
Last cylinder or +size or +sizeM or +sizeK (733-1044, default 1044):
Using default value 1044

Command (m for help): P

Disk /dev/sdb: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1         244     1959898+  83  Linux
/dev/sdb2             245         488     1959930   83  Linux
/dev/sdb3             489         732     1959930   83  Linux
/dev/sdb4             733        1044     2506140    5  Extended
/dev/sdb5             733        1044     2506108+  83  Linux

Command (m for help): W
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@node1 /]#

配置ASM程序包:
[root@node1 /]# /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@node1 /]#
[root@node1 /]# /etc/init.d/oracleasm createdisk VOL1 /dev/sdb
sdb   sdb1  sdb2  sdb3  sdb4  sdb5 

创建ASM磁盘:
[root@node1 /]# /etc/init.d/oracleasm createdisk VOL1 /dev/sdb1
Marking disk "VOL1" as an ASM disk:                        [  OK  ]
[root@node1 /]# /etc/init.d/oracleasm createdisk VOL2 /dev/sdb2
Marking disk "VOL2" as an ASM disk:                        [  OK  ]
[root@node1 /]# /etc/init.d/oracleasm createdisk VOL3 /dev/sdb3
Marking disk "VOL3" as an ASM disk:                        [  OK  ]
[root@node1 /]# /etc/init.d/oracleasm createdisk VOL4 /dev/sdb5
Marking disk "VOL4" as an ASM disk:                        [  OK  ]
[root@node1 /]# /etc/init.d/oracleasm listdisks;
VOL1
VOL2
VOL3
VOL4

安装 linux_11gR2_grid.zip 软件包:
[root@node1 /] unzip linux_11gR2_grid.zip
[root@node1 /]# xhost +
[root@node1 /]# su - grid
[root@node1 /]# cd /grid
[root@node1 grid]# ./runInstaller

............................

[root@node1 ~]# su - grid
[grid@node1 ~]$ srvctl status asm
ASM is running on node1
[grid@node1 ~]$ srvc
srvconfig  srvctl    
[grid@node1 ~]$ srvctl status listener
Listener LISTENER is enabled
Listener LISTENER is running on node(s): node1
[grid@node1 ~]$ ps -ef |grep +ASM
grid     11239     1  0 03:12 ?        00:00:00 asm_pmon_+ASM
grid     11241     1  0 03:12 ?        00:00:00 asm_vktm_+ASM
grid     11245     1  0 03:12 ?        00:00:00 asm_gen0_+ASM
grid     11247     1  0 03:12 ?        00:00:00 asm_diag_+ASM
grid     11249     1  0 03:12 ?        00:00:00 asm_psp0_+ASM
grid     11251     1  0 03:12 ?        00:00:00 asm_dia0_+ASM
grid     11253     1  0 03:12 ?        00:00:00 asm_mman_+ASM
grid     11255     1  0 03:12 ?        00:00:00 asm_dbw0_+ASM
grid     11257     1  0 03:12 ?        00:00:00 asm_lgwr_+ASM
grid     11259     1  0 03:12 ?        00:00:00 asm_ckpt_+ASM
grid     11261     1  0 03:12 ?        00:00:00 asm_smon_+ASM
grid     11263     1  0 03:12 ?        00:00:00 asm_rbal_+ASM
grid     11265     1  0 03:12 ?        00:00:00 asm_gmon_+ASM
grid     11267     1  0 03:12 ?        00:00:00 asm_mmon_+ASM
grid     11269     1  0 03:12 ?        00:00:00 asm_mmnl_+ASM
grid     11419 11350  0 03:33 pts/3    00:00:00 grep +ASM
[grid@node1 ~]$

你可能感兴趣的:(ASM,oracle,grid,10g,休闲,oracel)