Chinaunix首页 | 论坛 | 博客
  • 博客访问: 6563133
  • 博文数量: 1005
  • 博客积分: 8199
  • 博客等级: 中将
  • 技术积分: 13071
  • 用 户 组: 普通用户
  • 注册时间: 2010-05-25 20:19
个人简介

脚踏实地、勇往直前!

文章分类

全部博文(1005)

文章存档

2020年(2)

2019年(93)

2018年(208)

2017年(81)

2016年(49)

2015年(50)

2014年(170)

2013年(52)

2012年(177)

2011年(93)

2010年(30)

分类: Oracle

2012-09-18 23:02:36

OS:Red Hat Linux As 5
DB:11.2.0.1
 
------------------------------------------Linux 安装11GR2软件部分---------------------------------------

1.下载安装软件

[root@hxl soft]# ls -1

linux_11gR2_database_1of2.zip

linux_11gR2_database_2of2.zip

linux_11gR2_grid.zip

 

2.解压压缩包

[root@hxl soft]unzip linux_11gR2_database_1of2.zip

[root@hxl soft]unzip linux_11gR2_database_2of2.zip

[root@hxl soft]unzip linux_11gR2_grid.zip

 

3.配置相应参数

vi /etc/security/limits.conf

添加如下内容:

oracle    soft    nproc   2047

oracle    hard    nproc   16384

oracle    soft    nofile  1024

oracle    hard    nofile  65536

oracle    soft    stack   10240

 

vi /etc/sysctl.conf

添加如下内容

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

 

注意64bit的系统kernel.shmmax设置建议是物理内容的一半.

参数设置完成后需要重系统,参数才能生效.

 

4.创建oracle用户和dba,oinstall

[root@hxl soft]#groupadd oinstall

[root@hxl soft]#groupadd dba

[root@hxl soft]#mkdir -p /u01/export/home

[root@hxl soft]#useradd -d /u01/export/home/oracle -g oinstall -G dba -s /bin/bash oracle -m

[root@hxl soft]#chown oracle:dba /u01/export/home/oracle /u01

[root@hxl soft]#passwd oracle

 

5.使用oracle用户登录,设置环境变量

export PS1='['`hostname`':$LOGIN:$PWD]$'

export EDITOR=vi

export ORACLE_SID=oracl

export ORACLE_BASE=/u01/app/oracle

export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib

export PATH=$ORACLE_HOME/bin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/bin:/sbin

export NLS_DATE_FORMAT="YYYY-MM-DD HH24:MI:SS"

 

6.创建环境变量中定义的目录

[oracle@hxl /]$mkdir -p $ORACLE_BASE

[oracle@hxl /]$mkdir -p $ORACLE_BASE/product/11.2.0/db_1

 

7.安装oracle软件(选择只安装软件)

进入数据库软件目录

[oracle@hxl database]$ ./runInstaller

安装过程中将检查项需要安装的包都安装上,安装包在安装介质中可以找到.

 

---------------------------------------------------安装ASMlib部分------------------------------------------

1.       查看系统内核

[grid@hxl grid_soft]$ uname -r

2.6.18-8.el5

 

1.       按照如下顺序安装asmlib

[root@hxl asmlib]# rpm -ivh oracleasm-support-2.1.7-1.el5.i386.rpm

[root@hxl asmlib]# rpm -ivh oracleasm-2.6.18-8.el5-2.0.4-1.el5.i686.rpm

[root@hxl asmlib]# rpm -ivh oracleasmlib-2.0.4-1.el5.i386.rpm

 

3. 设置ASM驱动

[root@hxl asmlib]# /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 []: oracle

Default group to own the driver interface []: oinstall

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  ]

 

4. 查看当前磁盘

[root@hxl asmlib]# 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   *         201        2610    19358325   83  Linux

/dev/sda2               1         200     1606468+  82  Linux swap / Solaris

 

Partition table entries are not in disk order

 

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

 

Disk /dev/sdc: 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

 

5. sdbsdc进行分区(具体步骤省略)

[root@hxl dev]# fdisk /dev/sdb

[root@hxl dev]# fdisk /dev/sdc

 

分区后的结果如下:

[root@hxl dev]# 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   *         201        2610    19358325   83  Linux

/dev/sda2               1         200     1606468+  82  Linux swap / Solaris

 

Partition table entries are not in disk order

 

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        1044     8385898+  83  Linux

 

Disk /dev/sdc: 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/sdc1               1        1044     8385898+  83  Linux

 

6. 我们将分别在/dev/sdb1/dev/sdc1上创建两个ASM磁盘

[root@hxl dev]#/etc/init.d/oracleasm createdisk VOL1 /dev/sdb1

[root@hxl dev]#/etc/init.d/oracleasm createdisk VOL2 /dev/sdc1

 

7.查看ASM磁盘

[root@hxl dev]# oracleasm listdisks

VOL1

VOL2

 

-------------------------------------------------安装GRID软件部分---------------------------------------

1.创建group

查看当前的group

[oracle@hxl 8670579]$ tail -10 /etc/group

slocate:x:21:

gdm:x:42:

distcache:x:94:

apache:x:48:

webalizer:x:67:

squid:x:23:

xfs:x:43:

sabayon:x:86:

oinstall:x:500:

dba:x:501:oracle

 

创建group

[root@hxl ~]#groupadd -g 502 asmadmin

[root@hxl ~]#groupadd -g 503 asmdba

[root@hxl ~]#groupadd -g 504 asmoper

 

2.创建grid用户

[root@hxl ~]# useradd -d /u01/export/home/grid -g oinstall -G asmadmin,asmdba,asmoper grid -m

[root@hxl ~]# passwd grid

 

3.使用grid用户登录,添加环境变量,然后重新登录

cd ~

vi .bash_profile

 

export PS1=[`hostname`/`whoami`]$

export EDITOR=vi

export ORACLE_SID=+ASM

export ORACLE_BASE=/u01/grid

export ORACLE_HOME=/u01/gridsoft

export PATH=$ORACLE_HOME/bin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/bin:/sbin

export NLS_DATE_FORMAT="YYYY-MM-DD HH24:MI:SS"

 

4.创建环境中定义的目录

[root@hxl ~]# mkdir -p /u01/grid

[root@hxl ~]# mkdir -p /u01/gridsoft

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

[root@hxl ~]# chown -R grid:oinstall /u01/gridsoft

 

5.修改相应参数

vi /etc/security/limits.conf

添加如下内容:

grid    soft    nproc   2047

grid    hard    nproc   16384

grid    soft    nofile  1024

grid    hard    nofile  65536

grid    soft    stack   10240

 

6.安装grid

[grid@hxl grid]$ ./runInstaller

 

选择单机安装

 

选择语言

 

创建磁盘组

 

设置密码(密码必须包含大写字母和数字)

 

指定OS

 

安装前检查,将检查错误的每项进行修复

 

指定安装目录

 

root用户执行提示的脚本

 

点击finish进行安装

 

 

若以上安装GRID的过程中创建ASM实例失败,可以通过如下步骤创建

---------------------------------------------手工创建ASM实例-----------------------------------------------

1.       grid用户下执行asmca命令

 

 

输入管理密码后,点击Specify Disk Group

 

输入磁盘组名,然后选择磁盘,这里选择External(None),由外部提供冗余.

 

点击Create ASM,开始创建ASM实例

 

创建完成后有如下提示框,表示创建完成

 

同时显示,创建好的磁盘组情况

 

登录ASM实例

[grid@hxl ~]$ echo $ORACLE_SID

+ASM

[grid@hxl ~]$ sqlplus /nolog

 

SQL*Plus: Release 11.2.0.1.0 Production on Wed Sep 19 06:44:01 2012

 

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

 

SQL> connect / as sysasm

Connected.

SQL> show parameters asm;

 

NAME                                 TYPE        VALUE

------------------------------------ ----------- ------------------------------

asm_diskgroups                       string

asm_diskstring                       string

asm_power_limit                      integer     1

asm_preferred_read_failure_groups    string

 

SQL> select INSTANCE_NAME,host_name,status from v$instance;

 

INSTANCE_NAME        HOST_NAME  STATUS

-------------------- ---------- ------------

+ASM                 hxl.com    STARTED

 

 

------------------------------------------DBCA创建数据库---------------------------------------

1.使用oracle登录运行dbca创建数据库(具体步骤省略)

 

注意存储类型选择ASM的时候,找不到grid用户下创建的ASM磁盘,这个时候需要oracle用户添加到asmca组中.

usermod -G asmdba,dba oracle

 

创建完数据库后,以前我们都是在oracle用户下配置监听器的,但11GR2以后是在GRID用户下配置监听的.

 

-- The End --

阅读(7133) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~