灌溉梦想,记录脚步
« »
2010 年 05 月 27 日技术合集

oracle 10g rac 安装图解

规划:所用linux系统以虚拟化方式安装在esx上,配置有内网的yum源,各分配有16G存储,下面为简单拓扑图


一,下载软件
1,地址:http://www.oracle.com/technology/software/products/database/oracle10g/htdocs/10201linx8664soft.html
10201_database_linux_x86_64.cpio.gz
10201_clusterware_linux_x86_64.cpio.gz

2,地址:http://www.oracle.com/technology/software/tech/linux/asmlib/rhel5.html
oracleasm-2.6.18-164.el5-2.0.5-1.el5.x86_64.rpm
oracleasmlib-2.0.4-1.el5.x86_64.rpm
oracleasm-support-2.1.3-1.el5.x86_64.rpm

二,安装环境
1,系统:centos 5.4 x86_64
2,外部存储:linux下的iscsi
3, iscsi服务器配置

#下载iSCSI Enterprise Target
wget http://nchc.dl.sourceforge.net/sourceforge/iscsitarget/iscsitarget-0.4.17.tar.gz
 
#解压缩
tar -zxvf iscsitarget-0.4.17.tar.gz
cd iscsitarget-0.4.17
 
#编译、安装
make
make install
 
#配置服务
chkconfig --level 2345 iscsi-target on
service iscsi-target start
 
#配置第一个iSCSI设备
#在/opt/下生成64G大的空洞设备文件
#请将opt修改为实际的目录,并根据实际情况设置设备文件大小
#生成空洞文件速度很快的,且在真正使用之前不占用磁盘实际空间
dd if=/dev/zero of=/opt/iscsi.[配置文件中Target的名称].img bs=1G count=64 seek=64
 
#cout是从什么开始,一般设置为0
#生成256G的例子
dd if=/dev/zero of=/opt/iscsi/iqn.2009-04.com.haoyuan-inc:storage.disk.oracle.01.img bs=1G count=0 seek=256
 
vim /etc/ietd.conf
#编辑Target名称,例如:iqn.2009-04.com.haoyuan-inc:storage.disk.share.01
#编辑LUN段内容,例如:Lun 0 Path=/opt/iscsi.iqn.2009-04.com.haoyuan-inc:storage.disk.share.01.image,Type=fileio
#不要设置XXXUser,允许任何人访问
 
#重启iscsi-target
service iscsi-target restart

三,安装准备

1,检查必须软件

yum install jdk binutils elfutils-libelf elfutils-libelf-devel glibc glibc-common glibc-devel gcc gcc-c++ libaio libaio-devel libgcc libstdc++ libstdc++-devel make sysstat unixODBC unixODBC-devel libXp libXp-devel
#其中jdk是我在yum服务器中添加的

2,修改内核参数

编辑/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 = 262144
net.core.rmem_max = 262144
net.core.wmem_default = 262144
net.core.wmem_max = 262144
 
#生效
/sbin/sysctl -p

3,修改系统shell限制

vi /etc/security/limits.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536

4,配置 Hangcheck 计时器所有 RHEL 版本:
cat /etc/rc.d/rc.local EOF
/sbin/insmod hangcheck-timer hangcheck_tick=30 hangcheck_margin=180
EOF

5,添加相应用户和组

 
/usr/sbin/groupadd oinstall
/usr/sbin/groupadd dba
/usr/sbin/useradd -m -g oinstall -G dba oracle
passwd oracle

6,配置网络

每个机器需要两块网卡,一个设置为公共IP,一个设置为私有IP,另外另需配置一虚拟IP,
虚拟IP不用手工添加到系统,只需预先定义好,一般是和公共IP在同一子网。

cat /etc/hosts
 
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1               HY_472 localhost.localdomain localhost
::1             localhost6.localdomain6 localhost6
# public address
10.0.40.11 rac1
10.0.40.12 rac2
# private address
10.0.10.11 rac1-priv
10.0.10.12 rac2-priv
# virtual address
10.0.40.111 rac1-vip
10.0.40.112 rac2-vip

7,配置ssh
rac1

su oracle
$mkdir ~/.ssh
$chmod 755 ~/.ssh
$/usr/bin/ssh-keygen -t rsa
$/usr/bin/ssh-keygen -t dsa

rac2

su oracle
$mkdir ~/.ssh
$chmod 755 ~/.ssh
$/usr/bin/ssh-keygen -t rsa
$/usr/bin/ssh-keygen -t dsa

rac1

$cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
$cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
$ssh oracle@rac2 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
$ssh oracle@rac2 cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
$chmod 644 ~/.ssh/authorized_keys

rac2

$cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
$cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
$ssh oracle@rac1 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
$ssh oracle@rac1 cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
$chmod 644 ~/.ssh/authorized_keys

#建立等效性
rac1,rac2

$ssh rac1
$ssh rac1-priv
$ssh rac2
$ssh rac2-priv

8,配置时间同步
rac1、rac2
#vi /etc/crontab
17 18 * * * /usr/sbin/ntpdate repo.haoyuan-inc.com > /dev/null
9,修改系统版本
rac1,rac2

vi /etc/redhat-release
#将CentOS release 5 (Final)  修改成redhat 4

四、配置ASM

1,安装所需软件

rac1、rac2

rpm -ivh oracleasm-2.6.18-164.el5-2.0.5-1.el5.x86_64.rpm
oracleasmlib-2.0.4-1.el5.x86_64.rpm
oracleasm-support-2.1.3-1.el5.x86_64.rpm

2,挂载iscsi硬盘

rac1、rac2
yum install -y --nogpgcheck iscsi-initiator-utils
chkconfig --level 2345 iscsi on
chkconfig --level 2345 iscsid on
service iscsi start
service iscsid start
 
iscsiadm --mode discovery --type sendtargets --portal 10.0.40.51
iscsiadm -m node -T iqn.20-05.com.forzw:storage.disk.oracle.01 -p 10.0.40.51 -l
 
vi /etc/rc.local
iscsiadm -m node -T iqn.20-05.com.forzw:storage.disk.oracle.01 -p 10.0.40.51 -l

3,配置ASM

rac1,rac2

/etc/init.d/oracleasm configure
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
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  ]
 
/etc/init.d/oracleasm enable
Writing Oracle ASM library driver configuration: done
Initializing the Oracle ASMLib driver: [  OK  ]
Scanning the system for Oracle ASMLib disks: [  OK  ]

rac1

fdisk /dev/sdb
Disk /dev/sdb: 67.1 GB, 67108864000 bytes
64 heads, 32 sectors/track, 64000 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
 
Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1        1000     1023984   83  Linux
/dev/sdb2            1001        2000     1024000   83  Linux
/dev/sdb3            2001       12000    10240000   83  Linux
/dev/sdb4           12001       64000    53248000   83  Linux
 
/etc/init.d/oracleasm createdisk VOL1 /dev/sdb3
/etc/init.d/oracleasm listdisks
VOL1

rac2

/etc/init.d/oracleasm scandisks

五,安装配置RAC

1,创建安装目录
rac1,rac2

mkdir -p /u01/app/oracle/product/10.2.0/db_1
mkdir -p /u01/app/oracle/product/10.2.0/crs
chown -R oracle:oinstall /u01
chmod -R 775 /u01

2,设置环境变量
rac1

$vi .bash_profile
 
# .bash_profile
# User specific aliases and functions
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
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
export ORACLE_SID=bccb1
export ORACLE_TERM=xterm
export NLS_LANG=AMERICAN_AMERICA.UTF8
export ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/usr/local/lib
PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin:$ORA_CRS_HOME/bin:/sbin
export PATH

rac2

$vi .bash_profile
 
# .bash_profile
# User specific aliases and functions
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
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
export ORACLE_SID=bccb2
export ORACLE_TERM=xterm
export NLS_LANG=AMERICAN_AMERICA.UTF8
export ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/usr/local/lib
PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin:$ORA_CRS_HOME/bin:/sbin
export PATH

3,配置voting disk

rac1,rac2

mkdir -p /u02/oracrs/
chown -R oracle:oinstall /u02/oracrs/
chmod -R 775 /u02/oracrs/
 
raw /dev/raw/raw1 /dev/sdb1
raw /dev/raw/raw2 /dev/sdb2
 
vi /etc/sysconfig/rawdevices
/dev/raw/raw1 /dev/sdb1
/dev/raw/raw2 /dev/sdb2
 
chown root:oinstall /dev/raw/raw1
chmod 640 /dev/raw/raw1
chown oracle:dba /dev/raw/raw2
chmod 660 /dev/raw/raw2
 
vi /etc/rc.local
 
raw /dev/raw/raw1 /dev/sdb1
raw /dev/raw/raw2 /dev/sdb2
 
chown root:oinstall /dev/raw/raw1
chmod 640 /dev/raw/raw1
chown oracle:dba /dev/raw/raw2
chmod 660 /dev/raw/raw2
 
$ln -s /dev/raw/raw1 /u02/oracrs/ocr.crs
$ln -s /dev/raw/raw2 /u02/oracrs/vote.crs

4,安装rac

rac1(安装只在一台机器上进行)
gzip –d 10201_clusterware_linux_x86_64.cpio.gz
cpio –idmv < 10201_clusterware_linux_x86_64.cpio
chown -R oracle:oinstall clusterware

statx
 
xhost+
su oracle
$cd ~
$source .bash_profile
$mkdir -p /u01/app/oracle/oraInventory
$cd clusterware
$./runInstall

@弹出安装界面

@指定Inventory目录,由于已经环境变量,这里会默认选择

@改变crs安装路径,这里选择已经设置在环境变量中的crs目录

@安装条件检查

@群集名称默认设置为crs,添加节点,注意要和hosts文件种一致

@配置网络接口类型

@配置ocr位置

@配置Voting Disk位置

@安装概要

@安装过程

@执行脚本,依次执行,且先执行本机,等脚本完成后,再在节点上执行,权限为root用户

@在rac2上执行root.sh时候会出现错误,这里跳到文章最后的“问题四“去按照步骤解决问题,之后回来点OK,即完成。

六,安装oracle 10g

rac1(安装只在一台机器上进行)

cpio –idmv &lt; 10201_database_linux_x86_64.cpio
chown -R oracle:oinstall database
 
statx
 
xhost+
su oracle
$cd ~
$source .bash_profile
$mkdir -p /u01/app/oracle/oraInventory
$cd database
$./runInstall

@弹出欢迎界面

@选择安装类型,选择企业版

@选择安装位置,这里会自动填写变量中定义目录

@选中所有节点

@安装条件检查

@创建启动数据库

@选择通用数据库

@指定全局数据库名称和sid,并选上示例

@选择数据库管理选项

@选择数据库数据存储方式,这里选择ASM

@弹出警告,点击OK继续

@配置备份,这里选择无备份

@选择ASM存储,由于只设置了一个卷,选择冗余方式为扩展

@配置密码

@安装概要

@安装过程

@配置助手过程

@弹出界面

@配置成功

@安装结束

##########################安装过程中遇到问题解决办法#############################

问题一:
连接被拒绝
PRKC-1044 – FAILED TO CHECK REMOTE COMMAND EXECUTION…
在节点上执行
ssh (本地和其他节点hostname)

问题二:

提示虚拟ip被占用
不应该事先绑定虚拟ip

问题三:
提示SEVERE: Remote ‘AttachHome’ failed on nodes
查看node的oralnventory目录权限
后执行”/u01/crs/oracle/product/10.2.0/crs_1/oui/bin/runInstaller -attachHome -noClusterEnabled ORACLE_HOME=/u01/crs/oracle/product/10.2.0/crs_1 ORACLE_HOME_NAME=OraCrs10g_home CLUSTER_NODES=HY_471,HY_472 CRS=true “INVENTORY_LOCATION=/u01/oracle/oraInventory” LOCAL_NODE=HY_472“

问题四:
在节点上执行root.sh结束时候提示“Running vipca(silent) for configuring nodeapps
/u01/app/oracle/product/10.2.0/crs/jdk/jre//bin/java: error while loading shared libraries: libpthread.so.0: “等

解决方法:
rac2

cd /u01/app/oracle/product/10.2.0/crs/bin/
 ./oifcfg iflist
eth0  10.0.40.0
eth1  10.0.10.0
 ./oifcfg setif -global eth0/10.0.40.0:public
./oifcfg setif -global eth1/10.0.10.0:cluster_interconnect
./oifcfg iflist
eth0  10.0.40.0
eth1  10.0.10.0
./oifcfg getif
eth0  10.0.40.0  global  public
eth1  10.0.10.0  global  cluster_interconnect

/crs/bin下,文件名分别为vipca和srvctl。首先编辑vipca文件,找到如下内容:

Remove this workaround when the bug 3937317 is fixed
arch=`uname -m`
if [ "$arch" = "i686" -o "$arch" = "ia64" ]
then
LD_ASSUME_KERNEL=2.4.19
export LD_ASSUME_KERNEL
fi
#End workaround
#在fi 后新添加一行:
unset LD_ASSUME_KERNEL
然后编辑srvctl文件,找到如下内容:
LD_ASSUME_KERNEL=2.4.19
export LD_ASSUME_KERNEL
#同样在其后新增加一行:
unset LD_ASSUME_KERNEL

之后在rac2上执行vipca命令,按图形一步步做。
注意:若是节点名称是大写,这一步很难成功。

cd /u01/app/oracle/product/10.2.0/crs/bin/
 ./vipca

@弹出欢迎界面

@选择网络接口

@填写IP,它会自动不全,如果失误填写错误,在“问题五“中有解决办法。

@接上图,会给出确认画面,点击”finish”弹出自动配置界面,结束后即完成。

问题五:

执行vipca时候,误填写错误ip,解决办法

./srvctl modify nodeapps -n rac1 -A 10.0.40.111/255.255.255.0/eth0
./srvctl modify nodeapps -n rac2 -A 10.0.40.112/255.255.255.0/eth0

问题六:
ora-12523 tns listener could not find instance appropriate for the client

./crs_stat -t
Name           Type           Target    State     Host
------------------------------------------------------------
ora....SM1.asm application    ONLINE    ONLINE    rac1
ora....C1.lsnr application    ONLINE    ONLINE    rac1
ora.rac1.gsd   application    ONLINE    ONLINE    rac1
ora.rac1.ons   application    ONLINE    ONLINE    rac1
ora.rac1.vip   application    ONLINE    ONLINE    rac1
ora....SM2.asm application    ONLINE    ONLINE    rac2
ora....C2.lsnr application    ONLINE    ONLINE    rac2
ora.rac2.gsd   application    ONLINE    ONLINE    rac2
ora.rac2.ons   application    ONLINE    ONLINE    rac2
ora.rac2.vip   application    ONLINE    ONLINE    rac2

asm服务正常,但是连接被拒绝,但可能是网络故障,在手工关闭防火墙后解决问题

日志信息 »

该日志于2010-05-27 15:36由 kevin 发表在技术合集分类下, 你可以发表评论。除了可以将这个日志以保留源地址及作者的情况下引用到你的网站或博客,还可以通过RSS 2.0订阅这个日志的所有评论。

4条评论

  1. louis说道:

    good and up!

  2. 博吧说道:

    谢谢分享

发表评论 »