oracle for redhat as4.0 cluster 全過程

yobyin發表於2007-03-01

介紹reahat as 4 下cluster 的應用

[@more@]

DL 560作為Web伺服器接受使用者各類連線請求並對外進行相應資訊釋出;兩臺DL 580作為資料庫伺服器接受所有Web伺服器轉發而來的所有資料連線請求並做相應的資料處理。為保證系統的高可靠性及高擴充套件性,在兩臺DL 580之間構建叢集,後端則透過光纖連至MSA 1000高效能光纖陣列櫃,由光纖陣列櫃提供具體的資料儲存操作。

1.1 系統網路配置

192.168.1.251 CodDB1.ems.com CodDB1

10.0.0.1 CodDB1.ems.com ICodDb1

192.168.1.241 CodDB1-ILO.ems.com CodDB1-ILO

192.168.1.252 CodDB2.ems.com CodDB2

10.0.0.2 ICodDB2.ems.com ICodDB2

192.168.1.242 CodDB2-ILO.ems.com CodDB2-ILO

192.168.1.250 CodDB.ems.com CodDB

192.168.1.253 WebApp WebApp

2 第二章 資料庫伺服器配置

2.1 redhat linux AS 4.0 安裝

1) 安裝Redhat AS4

關閉MSA1000, 分別在兩臺伺服器下安裝Redhat EL AS4,安裝完之後,看dmesg,發現AS4已經能夠把伺服器上的HBA FCA2214驅動起來

2)安裝驅動

分別在兩臺伺服器上安裝SmartStart CD中的PSP包,在/compaq/csp/linux

3)下載Linux AS4.0 對應update2 ,並安裝

4) 升級linux,安裝以下升級包

rpm -ivh freetype-devel-2.1.9-1.i386.rpm

rpm -ivh fontconfig-devel-2.2.3-7.i386.rpm

rpm -ivh xorg-x11-devel-6.8.2-1.EL.13.20.i386.rpm

rpm -ivh libjpeg-devel-6b-33.i386.rpm

rpm -ivh libtiff-devel-3.6.1-8.i386.rpm

rpm -ivh libungif-devel-4.1.3-1.i386.rpm

rpm -ivh alsa-lib-devel-1.0.6-5.RHEL4.i386.rpm

rpm -ivh audiofile-devel-0.2.6-1.i386.rpm

rpm -ivh esound-devel-0.2.35-2.i386.rpm

rpm-ivhg-x11-deprecated-libs-devel-6.8.2-1.EL.13.20.i38

rpm -ivh libaio-devel-0.3.103-3.i386.rpm

rpm -ivh nss_db-compat-2.2-29.i386.rpm

rpm -ivh glib-devel-1.2.10-15.i386.rpm

rpm -ivh gtk+-devel-1.2.10-33.i386.rpm

rpm -ivh imlib-devel-1.9.13-23.i386.rpm

rpm -ivh ORBit-devel-0.5.17-14.i386.rpm

rpm -ivh gnome-libs-devel-1.4.1.2.90-44.1.i386.rpm

5) Oracle相容(p4198954_40_LINUX.zip

rpm -ivh compat-libcwait-2.1-1.i386.rpm

rpm -ivh compat-oracle-rhel4-1.0-5.i386.rpm

6) 建立使用者及帳號

groupadd oinstall

groupadd dba

useradd -m -g oinstall -G dba oracle

passwd oracle

7) 配置Linux的核心引數

[root@srv /]# vi /etc/sysctl.conf

# Created by Stone

kernel.shmmax = 1073741824

kernel.shmmni = 4096

kernel.shmall = 2097152

kernel.sem = 250 32000 100 128

fs.file-max = 65536

net.ipv4.ip_local_port_range = 1024 6500

[root@srv /]# sysctl -p

8) 設定Oracle對檔案的要求

[root@srv /]# vi /etc/security/limits.conf

# Created by Stone

oracle soft memlock 3145728

oracle hard memlock 3145728

9) 準備Oracle安裝目錄

[root@srv /]# mkdir -p /home/oracle/product/9.2.0

[root@srv /]# chown -R oracle:dba /home/oracle

# 安裝時orainstRoot.sh生成及執行處

[root@srv /]# mkdir /var/opt/oracle

[root@srv /]# chown -R oracle.dba /var/opt/oracle

Creating Oracle Inventory pointer file (/etc/oraInst.loc)

Changing groupname of /home/oracle/oraInventory to oinstall.

10)設定Oracle使用者的環境變數

[root@srv /]# vi /home/oracle/.bash_profile

# export PATH

# unset USERNAME

# Created by Stone

# export LD_ASSUME_KERNEL=2.4.1

export LD_ASSUME_KERNEL=2.4.19

# export DISPLAY=192.168.1.251:0.0

# export JAVA_HOME=/usr/local/java

export ORACLE_BASE=/home/oracle

export ORACLE_HOME=$ORACLE_BASE/product/9.2.0

export ORACLE_SID=codora

export ORACLE_TERM=xterm

export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK

export ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data

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

export PATH=$PATH:$ORACLE_HOME/bin:$ORACLE_HOME/OPatch

CLASSPATH=$ORACLE_HOME/jre:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib

CLASSPATH=$CLASSPATH:$ORACLE_HOME/network/jlib

export CLASSPATH

export LANG=en_US

export DBCA_RAW_CONFIG=$ORACLE_BASE/DBCA_RAW_CONFIG

unset USERNAME

2.2 oracle 資料庫的安裝及配置

1) oracle 安裝

root@srv /]# su - oracle

[root@srv /]# /xxx/Disk1/runInstaller

/home/oracle/product/9.2.0/root.sh

Running Oracle9 root.sh script...

nThe following environment variables are set as:

ORACLE_OWNER= oracle

ORACLE_HOME= /home/oracle/product/9.2.0

Enter the full pathname of the local bin directory: [/usr/local/bin]:

Copying dbhome to /usr/local/bin ...

Copying oraenv to /usr/local/bin ...

Copying coraenv to /usr/local/bin ...

nCreating /etc/oratab file...

Adding entry to /etc/oratab file...

Entries will be added to the /etc/oratab file as needed by

Database Configuration Assistant when a database is created

Finished running generic part of root.sh script.

Now product-specific root actions will be performed.

2) Oracle補丁安裝

[root@srv /]# unzip p4188455_10103_linux.zip

[root@srv /]# unzip p4163445_92070_LINUX.zip

[oracle@srv /unzip]# 4163445/Disk1/runInstaller -paramfile 4188455/oraparam.ini

[root@coddb1 ~]# /home/oracle/product/9.2.0/root.sh

Running Oracle9 root.sh script...

nThe following environment variables are set as:

ORACLE_OWNER= oracle

ORACLE_HOME= /home/oracle/product/9.2.0

Enter the full pathname of the local bin directory: [/usr/local/bin]:

The file "dbhome" already exists in /usr/local/bin. Overwrite it? (y/n)

[n]: y

Copying dbhome to /usr/local/bin ...

The file "oraenv" already exists in /usr/local/bin. Overwrite it? (y/n)

[n]: y

Copying oraenv to /usr/local/bin ...

The file "coraenv" already exists in /usr/local/bin. Overwrite it? (y/n)

[n]: y

Copying coraenv to /usr/local/bin ...

Adding entry to /etc/oratab file...

Entries will be added to the /etc/oratab file as needed by

Database Configuration Assistant when a database is created

Finished running generic part of root.sh script.

Now product-specific root actions will be performed.

2.3 磁碟陣列櫃MSA1000的配置

1)建立物理卷

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

[root@srv /]# pvcreate /dev/sdc

建立邏輯卷組

[root@srv /]# vgcreate -s 32M oradata /dev/sdc1

2)分配邏輯卷

# Data Files

lvcreate -L256M -ncwmlite oradata sda1

lvcreate -L256M -ndrsys oradata sda2

lvcreate -L256M -nexample oradata sda3

# /dev/sda4:Used for creating the Extended Partition which starts as /dev/sda5

lvcreate -L256M -nindx oradata sda5

lvcreate -L256M -nodm oradata sda6

lvcreate -L2G -nsystem oradata sda7

lvcreate -L256M -ntools oradata sda8

lvcreate -L1.25G -nundotbs01 oradata sda9

lvcreate -L2G -nusers oradata sda10

lvcreate -L1G -nxbd01 oradata sda11

lvcreate -L2G -ntemp oradata sda12

# udump 256M sda13

# bdump 256M sda14

# cdump 256M sda15

# Control Files

lvcreate -L1G -ncontrol01 oradata sdb1

lvcreate -L1G -ncontrol02 oradata sdb2

lvcreate -L1G -ncontrol03 oradata sdb3

# Redo Log Groups

# /dev/sdb4:Used for creating the Extended Partition which starts as /dev/sdb5

lvcreate -L256M -nredo01_1 oradata sdb5

lvcreate -L256M -nredo02_1 oradata sdb6

lvcreate -L256M -nredo03_1 oradata sdb7

# redo01_2 256M sdb8

# redo02_2 256M sdb9

# redo03_2 256M sdb10

3)建立裸裝置

[root@srv /]# vi /etc/sysconfig/rawdevices

# Data Files

/dev/raw/raw1 /dev/sda1 #mapper/oradata-cwmlite

/dev/raw/raw2 /dev/sda2 #mapper/oradata-drsys

/dev/raw/raw3 /dev/sda3 #mapper/oradata-example

/dev/raw/raw4 /dev/sda5 #mapper/oradata-indx

/dev/raw/raw5 /dev/sda6 #mapper/oradata-odm

/dev/raw/raw6 /dev/sda7 #mapper/oradata-system

/dev/raw/raw7 /dev/sda8 #mapper/oradata-tools

/dev/raw/raw8 /dev/sda9 #mapper/oradata-undotbs01

/dev/raw/raw9 /dev/sda10 #mapper/oradata-users

/dev/raw/raw10 /dev/sda11 #mapper/oradata-xbd01

/dev/raw/raw11 /dev/sda12 #mapper/oradata-temp

/dev/raw/raw12 /dev/sda13 #udump

/dev/raw/raw13 /dev/sda14 #bdump

/dev/raw/raw14 /dev/sda15 #cdump

# Control Files

/dev/raw/raw15 /dev/sdb1 #mapper/oradata-control01

/dev/raw/raw16 /dev/sdb2 #mapper/oradata-control02

/dev/raw/raw17 /dev/sdb3 #mapper/oradata-control03

# Redo Log Groups

/dev/raw/raw18 /dev/sdb5 #mapper/oradata-redo01_1

/dev/raw/raw19 /dev/sdb6 #mapper/oradata-redo02_1

/dev/raw/raw20 /dev/sdb7 #mapper/oradata-redo03_1

/dev/raw/raw21 /dev/sdb8 #redo01_2

/dev/raw/raw22 /dev/sdb9 #redo02_2

/dev/raw/raw23 /dev/sdb10 #redo03_2

4)修改裸裝置屬主

[root@srv /]# service rawdevices restart

5)修改裸裝置屬主

[root@srv /]# vi /etc/rc.local

# Created by Stone

chown oracle:oinstall /dev/raw/raw1

chown oracle:oinstall /dev/raw/raw2

chown oracle:oinstall /dev/raw/raw3

chown oracle:oinstall /dev/raw/raw4

chown oracle:oinstall /dev/raw/raw5

chown oracle:oinstall /dev/raw/raw6

chown oracle:oinstall /dev/raw/raw7

chown oracle:oinstall /dev/raw/raw8

chown oracle:oinstall /dev/raw/raw9

chown oracle:oinstall /dev/raw/raw10

chown oracle:oinstall /dev/raw/raw11

chown oracle:oinstall /dev/raw/raw12

chown oracle:oinstall /dev/raw/raw13

chown oracle:oinstall /dev/raw/raw14

chown oracle:oinstall /dev/raw/raw15

chown oracle:oinstall /dev/raw/raw16

chown oracle:oinstall /dev/raw/raw17

chown oracle:oinstall /dev/raw/raw18

chown oracle:oinstall /dev/raw/raw19

chown oracle:oinstall /dev/raw/raw20

chown oracle:oinstall /dev/raw/raw21

chown oracle:oinstall /dev/raw/raw22

chown oracle:oinstall /dev/raw/raw23

6)建立Oracle裸裝置定義檔案

[oracle@srv /]# vi $ORACLE_BASE/DBCA_RAW_CONFIG

# Data Files

cwmlite=/dev/raw/raw1

drsys=/dev/raw/raw2

example=/dev/raw/raw3

indx=/dev/raw/raw4

odm=/dev/raw/raw5

system=/dev/raw/raw6

tools=/dev/raw/raw7

undotbs01=/dev/raw/raw8

users=/dev/raw/raw9

xbd01=/dev/raw/raw10

temp=/dev/raw/raw11

udump=/dev/raw/raw12

bdump=/dev/raw/raw13

cdump=/dev/raw/raw14

# Control Files

control01=/dev/raw/raw15

control02=/dev/raw/raw16

control03=/dev/raw/raw17

# Redo Log Groups

redo01_1=/dev/raw/raw18

redo02_1=/dev/raw/raw19

redo03_1=/dev/raw/raw20

redo01_2=/dev/raw/raw21

redo02_2=/dev/raw/raw22

redo03_2=/dev/raw/raw23

2.4 redhat linux cluster 配置

1)redhat 官方網站下cluster 2.1

2)cluster 啟動oralce

編寫orad.ora

#!/bin/bash

# description: start or stop oracle

oracle_user=oracle

status() {

local base=${1##*/}

local pid

# Test syntax.

if [ "$#" = 0 ] ; then

echo $"Usage: status {program}"

return 1

fi

# First try "pidof"

pid=`pidof -o $$ -o $PPID -o %PPID -x $1 ||

pidof -o $$ -o $PPID -o %PPID -x ${base}`

if [ -n "$pid" ]; then

echo $"${base} (pid $pid) is running..."

return 0

fi

# Next try "/var/run/*.pid" files

if [ -f /var/run/${base}.pid ] ; then

read pid < /var/run/${base}.pid

if [ -n "$pid" ]; then

echo $"${base} dead but pid file exists"

return 1

fi

fi

# See if /var/lock/subsys/${base} exists

if [ -f /var/lock/subsys/${base} ]; then

echo $"${base} dead but subsys locked"

return 2

fi

echo $"${base} is stopped"

return 3

}

start(){

# echo -n "starting oracle: "

su - "$oracle_user"<

lsnrctl start

sqlplus /nolog <

connect /as sysdba

startup

EOS

EOO

}

stop(){

# echo -n "stoping oracle: "

su - "$oracle_user"<

lsnrctl stop

sqlplus /nolog <

connect /as sysdba

shutdown immediate

EOS

EOO

}

case "$1" in

start)

start

touch /var/lock/subsys/orad

;;

stop)

stop

rm -f /var/lock/subsys/orad

;;

status)

status oracle

;;

restart)

stop

sleep 3

start

;;

*)

echo "$0 {start|stop|status|restart}"

;;

esac

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/8013558/viewspace-901110/,如需轉載,請註明出處,否則將追究法律責任。

相關文章