Chinaunix首页 | 论坛 | 博客
  • 博客访问: 315892
  • 博文数量: 240
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 50
  • 用 户 组: 普通用户
  • 注册时间: 2016-08-04 18:14
文章分类

全部博文(240)

文章存档

2017年(8)

2014年(4)

2013年(15)

2012年(4)

2011年(14)

2010年(55)

2009年(140)

我的朋友

分类: Oracle

2009-05-16 22:51:43

 

一、vmware设置(只有VMware Server版本才支持):

 

虚拟机硬件设置(所有节点软硬件配置均相同):

 

 

 

 

Rac1

D:\VM\rac1

Rac2

D:\VM\rac2

Share storage

D:\VM\storage

共享存储分区

D:\VM\storage\ocr.vmdk                            0.5G

D:\VM\storage\ voting.vmdk                       0.5G

D:\VM\storage\ flashrecovery.vmdk            2.0G

D:\VM\storage\ datafile.vmdk                     5.0G

 

 

虚拟机配置文件设置:

 

Rac1

Rac2

config.version = "8"

virtualHW.version = "4"

scsi0.present = "TRUE"

scsi0.virtualDev = "lsilogic"

memsize = "512"

scsi0:0.present = "TRUE"

scsi0:0.fileName = "rac1.vmdk"

ide1:0.present = "TRUE"

ide1:0.fileName = "G:"

ide1:0.deviceType = "cdrom-raw"

floppy0.present = "FALSE"

Ethernet0.present = "TRUE"

Ethernet0.virtualDev = "e1000"

displayName = "rac1"

guestOS = "rhel4-64"

priority.grabbed = "normal"

priority.ungrabbed = "normal"

 

scsi0:0.redo = ""

ethernet0.addressType = "generated"

uuid.location = "56 4d a5 cf 7a 15 06 b8-04 42 9e 73 27 fc a9 74"

uuid.bios = "56 4d a5 cf 7a 15 06 b8-04 42 9e 73 27 fc a9 74"

ethernet0.generatedAddress = "00:0c:29:fc:a9:74"

ethernet0.generatedAddressOffset = "0"

 

Ethernet1.present = "TRUE"

Ethernet1.connectionType = "custom"

Ethernet1.vnet = "VMnet2"

Ethernet1.virtualDev = "e1000"

workingDir = "."

 

ethernet1.addressType = "generated"

ethernet1.generatedAddress = "00:0c:29:fc:a9:7e"

ethernet1.generatedAddressOffset = "10"

 

disk.locking = "false"

diskLib.dataCacheMaxSize = "0"

diskLib.dataCacheMaxReadAheadSize = "0"

diskLib.DataCacheMinReadAheadSize = "0"

diskLib.dataCachePageSize = "4096"

diskLib.maxUnsyncedWrites = "0"

 

scsi1.present = "TRUE"

scsi1.sharedBus="virtual"

 

scsi1:1.present = "TRUE"

scsi1:1.fileName = "D:\VM\storage\ocr.vmdk"

scsi1:1.mode = "independent-persistent"

scsi1:1.deviceType = "disk"

 

scsi1:2.present = "TRUE"

scsi1:2.fileName = "D:\VM\storage\voting.vmdk"

scsi1:2.mode = "independent-persistent"

scsi1:2.deviceType = "disk"

 

scsi1:3.present = "TRUE"

scsi1:3.fileName = "D:\VM\storage\flashrecovery.vmdk"

scsi1:3.mode = "independent-persistent"

scsi1:3.deviceType = "disk"

 

scsi1:4.present = "TRUE"

scsi1:4.fileName = "D:\VM\storage\datafile.vmdk"

scsi1:4.mode = "independent-persistent"

scsi1:4.deviceType = "disk"

 

scsi1:0.redo = ""

scsi1:1.redo = ""

scsi1:2.redo = ""

scsi1:3.redo = ""

 

scsi1.virtualDev = "lsilogic"

 

scsi1:4.redo = ""

config.version = "8"

virtualHW.version = "4"

scsi0.present = "TRUE"

scsi0.virtualDev = "lsilogic"

memsize = "512"

scsi0:0.present = "TRUE"

scsi0:0.fileName = "rac2.vmdk"

ide1:0.present = "TRUE"

ide1:0.fileName = "G:"

ide1:0.deviceType = "cdrom-raw"

floppy0.present = "FALSE"

Ethernet0.present = "TRUE"

Ethernet0.virtualDev = "e1000"

displayName = "rac2"

guestOS = "rhel4-64"

priority.grabbed = "normal"

priority.ungrabbed = "normal"

 

scsi0:0.redo = ""

ethernet0.addressType = "generated"

uuid.location = "56 4d ad 37 01 6e e4 9a-6f 0d 4d ff f0 10 a9 f8"

uuid.bios = "56 4d ad 37 01 6e e4 9a-6f 0d 4d ff f0 10 a9 f8"

ethernet0.generatedAddress = "00:0c:29:10:a9:f8"

ethernet0.generatedAddressOffset = "0"

 

Ethernet1.present = "TRUE"

Ethernet1.connectionType = "custom"

Ethernet1.vnet = "VMnet2"

Ethernet1.virtualDev = "e1000"

workingDir = "."

 

ethernet1.addressType = "generated"

ethernet1.generatedAddress = "00:0c:29:10:a9:02"

ethernet1.generatedAddressOffset = "10"

 

disk.locking = "false"

diskLib.dataCacheMaxSize = "0"

diskLib.dataCacheMaxReadAheadSize = "0"

diskLib.DataCacheMinReadAheadSize = "0"

diskLib.dataCachePageSize = "4096"

diskLib.maxUnsyncedWrites = "0"

 

scsi1.present = "TRUE"

scsi1.sharedBus="virtual"

 

scsi1:1.present = "TRUE"

scsi1:1.fileName = "D:\VM\storage\ocr.vmdk"

scsi1:1.mode = "independent-persistent"

scsi1:1.deviceType = "disk"

 

scsi1:2.present = "TRUE"

scsi1:2.fileName = "D:\VM\storage\voting.vmdk"

scsi1:2.mode = "independent-persistent"

scsi1:2.deviceType = "disk"

 

scsi1:3.present = "TRUE"

scsi1:3.fileName = "D:\VM\storage\flashrecovery.vmdk"

scsi1:3.mode = "independent-persistent"

scsi1:3.deviceType = "disk"

 

scsi1:4.present = "TRUE"

scsi1:4.fileName = "D:\VM\storage\datafile.vmdk"

scsi1:4.mode = "independent-persistent"

scsi1:4.deviceType = "disk"

 

scsi1:0.redo = ""

scsi1:1.redo = ""

scsi1:2.redo = ""

scsi1:3.redo = ""

 

scsi1.virtualDev = "lsilogic"

 

scsi1:4.redo = ""

 

 

 

二、安装操作系统:

 

管理工具包和开发包全选,其他可适当选择!

 

 

三、系统基本配置:

 

Rac1

Rac2

Eth0: 192.168.1.100 /24

Eth0: 192.168.1.101 /24

Eth1: 10.10.1.100 /24

Eth1: 10.10.1.100 /24

Hostname: rac1

Hostname: rac2

ntpdate 192.168.1.2

ntpdate 192.168.1.2

chkconfig --level 2345 kudzu off

chkconfig --level 2345 rpcgssd off

chkconfig --level 2345 smartd off

chkconfig --level 2345 anacron off

chkconfig --level 2345 rpcidmapd off

chkconfig --level 2345 isdn off

chkconfig --level 2345 cups-config-daemon off

chkconfig --level 2345 iiim off

chkconfig --level 2345 gpm off

chkconfig --level 2345 cups off

chkconfig --level 2345 wdaemon off

chkconfig --level 2345 portmap off

chkconfig --level 2345 microcode_ctl off

chkconfig --level 2345 iptables off

chkconfig --level 2345 acpid off

chkconfig --level 2345 irqbalance off

chkconfig --level 2345 rhnsd off

chkconfig --level 2345 openibd off

chkconfig --level 2345 netfs off

chkconfig --level 2345 nfslock off

chkconfig --level 2345 sendmail off

chkconfig --level 2345 cpuspeed off

chkconfig --level 2345 haldaemon off

chkconfig --level 2345 atd off

chkconfig --level 2345 pcmcia off

chkconfig --level 2345 lm_sensors off

chkconfig --level 2345 kudzu off

chkconfig --level 2345 rpcgssd off

chkconfig --level 2345 smartd off

chkconfig --level 2345 anacron off

chkconfig --level 2345 rpcidmapd off

chkconfig --level 2345 isdn off

chkconfig --level 2345 cups-config-daemon off

chkconfig --level 2345 iiim off

chkconfig --level 2345 gpm off

chkconfig --level 2345 cups off

chkconfig --level 2345 wdaemon off

chkconfig --level 2345 portmap off

chkconfig --level 2345 microcode_ctl off

chkconfig --level 2345 iptables off

chkconfig --level 2345 acpid off

chkconfig --level 2345 irqbalance off

chkconfig --level 2345 rhnsd off

chkconfig --level 2345 openibd off

chkconfig --level 2345 netfs off

chkconfig --level 2345 nfslock off

chkconfig --level 2345 sendmail off

chkconfig --level 2345 cpuspeed off

chkconfig --level 2345 haldaemon off

chkconfig --level 2345 atd off

chkconfig --level 2345 pcmcia off

chkconfig --level 2345 lm_sensors off

 

 

for service in `cat service |grep ^#|grep off$|awk '{print $1}'|sed s/#//g`;do echo service $service stop;done

for service in `cat service |grep ^#|grep off$|awk '{print $1}'|sed s/#//g`;do echo chkconfig --level 2345 $service off;done

 

 

 

四、reboot 后开始设置rac安装环境:

 

安装环境:

========================================================

Red Hat Enterprise Linux AS release 4 (Nahant Update 7)

2.6.9-78.EL x86_64 GNU/Linux

10201_clusterware_linux_x86_64.cpio.gz

10201_database_linux_x86_64.cpio.gz

========================================================

 

 

 

***************************************************************************

1、创建oracle用户:

创建 oracle 用户。 以 root 用户身份执行

 

groupadd oinstall

groupadd dba

useradd -g oinstall -G dba oracle

passwd oracle

New Password:

Re-enter new Password:

passwd: password successfully changed for oracle

**************************************************************************

2、创建 oracle 用户环境文件(注意修改SID,两台应该区分)

vi /home/oracle/.bash_profile

 

export EDITOR=vi

export ORACLE_SID=rac1

export ORACLE_BASE=/u01/app/oracle

export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1

export ORA_CRS_HOME=$ORACLE_BASE/product/10.2.0/crs_1

export LD_LIBRARY_PATH=$ORACLE_HOME/lib

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

export LANG=zh_CN.GBK

export LC_ALL="zh_CN.GBK"

export NLS_LANG='simplified chinese_china.zhs16gbk'

umask 022

***********************************************************************

3、创建文件系统目录结构:

mkdir -p /u01/app/oracle/product/10.2.0/db_1

mkdir -p /u01/app/oracle/product/10.2.0/crs_1

mkdir -p /u01/oradata/rac

chown -R oracle.oinstall /u01/app/oracle

chown -R oracle.oinstall /u01/oradata

chmod -R 755 /u01

*********************************************************************

4、提高 Oracle 用户的 shell 限制:

vi /etc/security/limits.conf

 

oracle   soft nproc    4096

oracle   hard nproc    16384

oracle   soft nofile   1024

oracle   hard nofile   65536

***********************************************************************

5vi /etc/pam.d/login

 

session required /lib/security/pam_limits.so

**********************************************************************

6、检查安装 Enterprise Linux 软件程序包。

rpm -q binutils compat-db control-center gcc gcc-c++ glibc glibc-common gnome-libs libstdc++ libstdc++-devel make pdksh sysstat xscreensaver libaio openmotif21

**********************************************************************

7vi /etc/sysctl.conf

 

kernel.shmall                = 2097152

kernel.shmmax                = 2147483648

kernel.shmmni                = 4096

kernel.sem                   = 250 32000 100 128

fs.file-max                  = 65536

net.ipv4.ip_local_port_range = 1024 65000

net.core.rmem_default        = 1048576

net.core.rmem_max            = 1048576

net.core.wmem_default        = 262144

net.core.wmem_max            = 262144

 

/sbin/sysctl -p

使得配置立即生效

**********************************************************************

8vi /etc/hosts

 

127.0.0.1 localhost

192.168.1.100 rac1

192.168.1.101 rac2

192.168.1.200 rac1-vip

192.168.1.201 rac2-vip

10.10.1.100   rac1-priv

10.10.1.101   rac2-priv

**********************************************************************

9、配置 hangcheck timer 内核模块。hangcheck timer 内核模块可监控系统的运行情况,并重新启动出现故障的 RAC 节点。它使用两个参数,即 hangcheck_tick(定义系统检查频率)和 hangcheck_margin(定义在重置 RAC 节点前的最大挂起延时)来确定节点是否出现故障。

vi /etc/modprobe.conf

 

options hangcheck-timer hangcheck_tick=30 hangcheck_margin=180

 

执行它使立即加载模块:   modprobe -v hangcheck-timer

**********************************************************************

11、为Oracle ASM 创建磁盘分区。为Oracle ASM/dev/sda/dev/sdb/dev/sdc/dev/sdd)准备一组原始磁盘

 fdisk /dev/sdb

 Command (m for help): n

Command action

   e   extended

   p   primary partition (1-4)

p

Partition number (1-4): 1

First cylinder (1-512, default 1):

Using default value 1

Last cylinder or +size or +sizeM or +sizeK (1-512, default 512):

Using default value 512

Command (m for help): w

The partition table has been altered!

Calling ioctl() to re-read partition table.

Syncing disks.

 

fdisk /dev/sdc

fdisk /dev/sdd

fdisk /dev/sde

fdisk -l

 

cat /proc/partitions

 

dd命令来初始化前两块磁盘 (OCR disk device & Voting).

dd if=/dev/zero of=/dev/sdb1 bs=8192 count=51200

dd if=/dev/zero of=/dev/sdc1 bs=8192 count=51200

 

vi /etc/sysconfig/rawdevices

添加:

/dev/raw/raw1 /dev/sdb1

/dev/raw/raw2 /dev/sdc1

/dev/raw/raw3 /dev/sdd1

/dev/raw/raw4 /dev/sde1

 

要使映射立即生效,以 root 用户身份执行以下命令:

/sbin/service rawdevices restart

 

chown oracle:dba /dev/raw/raw[1-4]

chmod 660 /dev/raw/raw[1-4]

 

ls -lat /dev/raw/raw*

**********************************************************************************

12、安装 oracleasmlib 程序包。以 root 用户身份安装 ASM RPM

 

rpm -Uvh oracleasm-support-2.0.3-1.x86_64.rpm

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

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

rpm -Uvh oracleasm-2.6.9-67.EL-2.0.3-1.x86_64.rpm

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

   1:oracleasm-2.6.9-67.EL########################################### [100%]

rpm -Uvh oracleasmlib-2.0.2-1.x86_64.rpm

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

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

rpm -qa | grep oracleasm

oracleasmlib-2.0.2-1

oracleasm-support-2.0.3-1

oracleasm-2.6.9-67.EL-2.0.3-1

*********************************************************************************

13、以 oracle 用户身份执行:

ln -sf /dev/raw/raw3 /u01/oradata/rac/asmdisk1

ln -sf /dev/raw/raw4 /u01/oradata/rac/asmdisk2

 

再以root用户身份执行:

修改 /etc/udev/permissions.d/50-udev.permissions。原始设备在引导时会重新映射。默认情况下,在引导时原始设备的拥有者将更改为 root 用户。如果拥有者不是 oracle 用户,则 ASM 在访问共享分区时会出现问题。在 /etc/udev/permissions.d/50-udev.permissions 中为原始行“raw/*:root:disk:0660添加注释,然后添加一个新行“raw/*:oracle:dba:0660

vi /etc/udev/permissions.d/50-udev.permissions

# raw devices

ram*:root:disk:0660

#raw/*:root:disk:0660

raw/*:oracle:dba:0660

*********************************************************************************

oracle用户做密钥,建立信任关系,以下由oracle用户执行,顺序和节点不能改变:

ssh-keygen -t dsa 

cd .ssh

 

rac1上:

scp id_dsa.pub rac2:/home/oracle/.ssh/authorized_keys

rac2上:

scp id_dsa.pub rac1:/home/oracle/.ssh/authorized_keys

一起:

cat id_dsa.pub >> authorized_keys

 

在每个节点上测试连接。验证当您再次运行以下命令时,系统是否不提示您输入口令。

ssh rac1 date

ssh rac2 date

ssh rac1-priv date

ssh rac2-priv date

*************************************************************************

配置 Oracle 自动存储管理 (ASM) root执行:

/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 []: dba

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

Fix permissions of Oracle ASM disks on boot (y/n) [y]: y

Writing Oracle ASM library driver configuration:           [  OK  ]

Loading module "oracleasm":                                [  OK  ]

Mounting ASMlib driver filesystem:                         [  OK  ]

Scanning system for ASM disks:                             [  OK  ]

 

/etc/init.d/oracleasm createdisk VOL1 /dev/sdd1

Marking disk "/dev/sdb1" as an ASM disk:                   [  OK  ]

 

/etc/init.d/oracleasm createdisk VOL2 /dev/sde1

Marking disk "/dev/sdc1" as an ASM disk:                   [  OK  ]

 

/etc/init.d/oracleasm scandisks

Scanning system for ASM disks:                             [  OK  ]

 

/etc/init.d/oracleasm listdisks

VOL1

VOL2

*************************************************************************************

 

 

五、安装clusterware

 

zcat 10201_clusterware_linux_x86_64.cpio.gz | cpio -idmv

cd clusterware

./runInstaller

注意:完成时如果提示eth0不能为vip时,以root用户在图形界面执行 vipca 重新配置vip.

 

 

六、安装oracle软件

 

 

七、dbca 创建 oracle 数据库

阅读(1510) | 评论(0) | 转发(0) |
0

上一篇:Linux 系统服务说明

下一篇:CACTI 安装

给主人留下些什么吧!~~