szhswl
宋针还的个人空间
在linux上单机模拟Oracle 10g RAC集群(OCFS+ASM)

本想做个安装记录,把遇到的错误和解决办法写下来,以备以后操作时参考,但在写的过程中阴错阳差地对付着把系统装上了,所以就当个安装说明吧,不过其中还有个错误(在下面有记录),感觉应该对使用有影响,所以以后还要想办法修正。这个就当个初稿吧。
一、简介
熟悉 Oracle 真正应用集群 (RAC) 10g 技术的最有效方法之一是访问一个实际的 Oracle RAC 10g 集群。没有什么方法比直接体验它们能够更好地理解其好处的了 — 包括容错、安全性、负载均衡和可伸缩性。
Oracle RAC 的核心是共享磁盘子系统。集群中的所有节点必须能够访问集群中所有节点的所有数据、重做日志文件、控制文件和参数文件。数据磁盘必须在全局范围内可用,以便允许所有节点访问数据库。每个节点拥有自己的重做日志和控制文件,但是其他节点必须能够访问这些文件,以便在系统故障时恢复该节点。
希望本文能对一些手头上只有一台PC而没有真正的双机环境的朋友提供一个参考。
二、本文实践环境
1、PC主要配置:
Dell OptiPlex 170L Series
Intel(R) Pentium(R) 4 CPU 2.80GHz
DISK drive 80G
网卡 一块
内存 DDR 512MB
显示卡:intel 865
操作系统:Redhat Enterprise Linux 4 u2
数据库 oracle10.2.0.
2、服务器分区方案
RAC节点名    实例名   数据库名   $ORACLE_BASE    文件系统
dbrac        orcl1       orcl    /home/oracle       ASM
Oracle CRS 共享文件
文件类型                文件名       分区       挂载点 文件系统
oracle集群注册表 /u01/orcl/orcfile /dev/hda11   /u01    OCFS
CRS表决磁盘      /u01/orcl/cssfile /dev/hda11   /u01    OCFS
3、所涉及软件
1)oracle 10g 数据库软件
10201_database_linux32.zip (从otn.oracle.com下载)
2)oracle 10g 集群服务软件
10201_clusterware_linux32.zip (从otn.oracle.com下载)
3)OCFS文件系统支持
ocfs2-2.6.9-22.EL-1.2.1-1.i686.rpm (http://oss.oracle.com/projects/o ... EL-1.2.1-1.i686.rpm)
ocfs2-tools-1.2.1-1.i386.rpm (http://oss.oracle.com/projects/o ... ls-1.2.1-1.i386.rpm)
ocfs2console-1.2.1-1.i386.rpm (http://oss.oracle.com/projects/o ... le-1.2.1-1.i386.rpm)
4)ASMlib驱动程序
oracleasm-2.6.9-22.EL-2.0.2-1.i686.rpm  (http://www.oracle.com/technology ... EL-2.0.2-1.i686.rpm)
oracleasm-support-2.0.2-1.i386.rpm  (http://www.oracle.com/technology ... rt-2.0.2-1.i386.rpm)
oracleasmlib-2.0.2-1.i386.rpm  (http://www.oracle.com/technology ... ib-2.0.2-1.i386.rpm)
以上软件包均可以从oracle官方网站下载
三、基础操作
1、安装linux
安装过程中一些需要注意的地方:
1)磁盘分区:swap分区大小建议是内存的2倍,这里是1024MB,划出一些系统必要的分区根分区/,var分区/var,usr分区/usr, home分区/home,临时文件分区/tmp。注意:这里不要把所有的硬盘空间划分进操作系统,留下一半给后面安装oarcle集群磁盘使用,本文示例
2)文件系统 容量 挂载点
/dev/hda8     2000M  /
/dev/hda1      100M  /boot
/dev/hda2    10000M  /data
/dev/hda5     8000M  /home
/dev/hda7     2000M  /opt
/dev/hda9     1000M  /tmp
/dev/hda3     8000M  /usr
/dev/hda6     4000M  /var
3)组件选取:一定要选上delvelopment tools和X-windows两项,为了节省空间其他可以不要
4)防火墙:最好不要
5)网络设置:eth0
取消选中 [Configure using DHCP] 复选项
选中 [Activate on boot]
IP 地址:10.15.0.14
网络掩码: 255.255.255.0
6)主机名:dbrac
2、.安装完成后检查必需的 RPM
3、必须安装以下程序包(或更高版本):(我安装时都装了,所以也没有检查以下的包)
make-3.79.1
gcc-3.2.3-34
glibc-2.3.2-95.20
glibc-devel-2.3.2-95.20
glibc-headers-2.3.2-95.20
glibc-kernheaders-2.4-8.34
cpp-3.2.3-34
compat-db-4.0.14-5
compat-gcc-7.3-2.96.128
compat-gcc-c++-7.3-2.96.128
compat-libstdc++-7.3-2.96.128
compat-libstdc++-devel-7.3-2.96.128
openmotif-2.2.2-16
setarch-1.3-1
四、设置
1、更改/etc/hosts
vi /etc/hosts
127.0.0.1 localhost.localdomain localhost
10.15.0.14 dbrac int-dbrac
10.15.0.13 vip-dbrac
此处设置相当重要,不能跳过,一定按照此设置,IP和主机别名可以自己定
oracle 10g RAC中 使用了虚拟IP(VIP)技术,这是一个令人心动的高可用性、多机无缝切换的解决方案,但在单机模拟环境中仅仅是个形式而已,为了以后的顺利安装,不得不配置它
确保RAC节点名没有出现在回送地址中
根据网上的安装方案是这样做的,但我试了几次都有问题,总报dbrac已被选用,所以我用的是如下的设置
127.0.0.1 localhost.localdomain localhost
10.15.0.14 dbrac
10.15.0.15 int-dbrac
10.15.0.13 vip-dbrac
我配置了eth0:1为10.15.0.15
2、调整内核网络设置参数
编辑/etc/sysctl.conf,增加下面的设置:
vi /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
Note: You need reboot system or execute "sysctl -p" command to apply above settings.

Edit the /etc/pam.d/login file and add following line:
session required /lib/security/pam_limits.so

Edit the /etc/security/limits.conf file and add following lines:
oracle    soft  nproc  2047
oracle    hard  nproc  16384
oracle    soft  nofile  1024
oracle    hard  nofile  65536

3、添加模块选项:
将下列行添加到 /etc/modprobe.conf 中:
options sbp2 sbp2_exclusive_login=0
4、创建“oracle”用户和目录
$su -
#groupadd dba
#useradd -g dba oracle
#passwd oracle
5、编辑.bash_profile文件,增加oracle环境变量
$vi .bash_profile
ORACLE_BASE=/data/oracle;export ORACLE_BASE
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
export ORA_CRS_HOME=$ORACLE_BASE/product/10.2.0/crs_1
export ORACLE_SID=orcl1
export NLS_LANG='SIMPLIFIED CHINESE_CHINA.ZHS16GBK'
PATH=$ORACLE_HOME/bin:/bin:/sbin:/usr/bin:/usr/ccs/bin:/usr/local/bin:/usr/ucb;export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/network/lib:$ORACLE_HOME/oracm/lib:/usr/local/lib:/usr/lib;export LD_LIBRARY_PATH
export ORACLE_TERM=xterm
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib:$ORACLE_HOME/rdbms/jlib:$ORACLE_HOME/network/jlib
export THREADS_FLAG=native
export TEMP=/tmp
export TMPDIR=/tmp
这里也主要用的网上的说明,感觉这么多参数实在是没必要
6、创建CRS分区和数据文件分区
1)先建立CRS分区挂载点
mkdir /u01
chown oracle:dba /u01
2)接着创建CRS分区和共享数据文件分区
fdisk /dev/hda
CRS分区只要500M就够了,剩下的全部划分给数据文件分区,这里为数据文件只分了1个区/dev/hda12
CRS分区为/dev/hda11
[root@dbrac /]# fdisk /dev/hda

The number of cylinders for this disk is set to 9726.
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)

Command (m for help): p

Disk /dev/hda: 80.0 GB, 80000000000 bytes
255 heads, 63 sectors/track, 9726 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/hda1   *           1          13      104391   83  Linux
/dev/hda2              14        1288    10241437+  83  Linux
/dev/hda3            1289        2308     8193150   83  Linux
/dev/hda4            2309        9726    59585085    5  Extended
/dev/hda5            2309        3328     8193118+  83  Linux
/dev/hda6            3329        3838     4096543+  83  Linux
/dev/hda7            3839        4093     2048256   83  Linux
/dev/hda8            4094        4348     2048256   83  Linux
/dev/hda9            4349        4475     1020096   82  Linux swap
/dev/hda10           4476        4602     1020096   83  Linux
Command (m for help): n
First cylinder (4603-9726, default 4603):
Using default value 4603
Last cylinder or +size or +sizeM or +sizeK (4603-9726, default 9726): +500M

Command (m for help): n
First cylinder (4665-9726, default 4665):
Using default value 4665
Last cylinder or +size or +sizeM or +sizeK (4665-9726, default 9726):
Using default value 9726

Command (m for help): p

Disk /dev/hda: 80.0 GB, 80000000000 bytes
255 heads, 63 sectors/track, 9726 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/hda1   *           1          13      104391   83  Linux
/dev/hda2              14        1288    10241437+  83  Linux
/dev/hda3            1289        2308     8193150   83  Linux
/dev/hda4            2309        9726    59585085    5  Extended
/dev/hda5            2309        3328     8193118+  83  Linux
/dev/hda6            3329        3838     4096543+  83  Linux
/dev/hda7            3839        4093     2048256   83  Linux
/dev/hda8            4094        4348     2048256   83  Linux
/dev/hda9            4349        4475     1020096   82  Linux swap
/dev/hda10           4476        4602     1020096   83  Linux
/dev/hda11           4603        4664      497983+  83  Linux
/dev/hda12           4665        9726    40660483+  83  Linux

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

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.

7、配置 hangcheck-timer 内核模块
在/etc/modprobe.conf中增加下面一行
options hangcheck-timer hangcheck_tick=30 hangcheck_margin=180
为了确保系统每次重新启动的时候都能自动加载hangcheck-timer 模块,需要在/etc/rc.local文件中增加下面一行
echo "modprobe hangcheck-timer" >>/etc/rc.local
重启系统并检查hangcheck-timer模块是否已经加载
[root@dbrac root]# lsmod | grep hangcheck-timer
hangcheck_timer         3289  0

8、配置 RAC 节点以进行远程访问
在 RAC 节点上运行 Oracle Universal Installer 时,它将使用 rsh 、rcp或scp命令将 Oracle 软件复制到 RAC 集群中的所有其他节点。虽然是单机模拟,但仍然要配置,无法跳过,从oracle 10g开始已经支持ssh协议,本文将首先尝试使用它
使用oracle用户创建ssh公共密匙:
[oracle@dbrac ~]$ ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/home/oracle/.ssh/id_dsa):
Created directory '/home/oracle/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/oracle/.ssh/id_dsa.
Your public key has been saved in /home/oracle/.ssh/id_dsa.pub.
The key fingerprint is:
41:76:93:b9:74:ea:51:a5:2e:f3:bf:90:55:64:b0:84 oracle@dbrac
复制公匙到其他节点(这里是单机)
[oracle@dbrac oracle]$ cp -v .ssh/id_dsa.pub .ssh/authorized_keys
测试密匙是否生效
ssh dbrac
The authenticity of host 'dbrac (10.15.0.14)' can't be established.
RSA key fingerprint is 3d:ad:f8:14:f1:06:02:6d:66:09:94:7e:b5:fc:8c:dc.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'dbrac,10.15.0.14' (RSA) to the list of known hosts.
[oracle@dbrac oracle]$
无需密码即可登陆表示密匙已经生效
记住也要试一下ssh int-dbrac
[oracle@dbrac ~]$ ssh int-dbrac
The authenticity of host 'int-dbrac (10.15.0.15)' can't be established.
RSA key fingerprint is 3d:ad:f8:14:f1:06:02:6d:66:09:94:7e:b5:fc:8c:dc.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'int-dbrac,10.15.0.15' (RSA) to the list of known hosts.
Last login: Tue Jun 27 18:28:00 2006 from dbrac
并且Add following lines to ~/.ssh/config file
Host *
ForwardX11 no
否则同样会报ssh不能连接的错误,可以通过在主机的图型界面里的命令窗口中运行检查是否有错.(参看http://blog.itpub.net/post/126/4684)

9、安装和配置 OCFS2
OCFS2是Oracle 集群文件系统 (OCFS2),由 Oracle 开发,用于消除数据库管理员和系统管理员管理原始设备这一负担,它提供了与通常的文件系统相同的功能和用法。尽量不要在OCFS文件系统上使用linux二进制文件系统操作命令
在目前的版本1种支持以下文件类型:
Oracle 数据库文件
联机重做日志文件
归档重做日志文件
控制文件
服务器参数文件 (SPFILE)
Oracle 集群注册表 (OCR) 文件
CRS 表决磁盘。

安装和配置
1)上传rpm包
2)执行rpm -ivh ocfs*.rpm 开始安装
3)生成并配置/etc/ocfs.conf文件
root@dbrac ocfs]# ocfsconsole &
4)使用 ocfsconsole GUI 工具执行以下步骤:
5)选择 [cluster]-[configure nodes]时会报"The cluster stack has been started. It needs to be running for any clustering functionality to happen. Please r
un "/etc/init.d/o2cb enable" to have it started upon bootup."错误.
ocfs2会自动o2cb load关闭窗口
但也把用下面办法设成开机时自动起动
# /etc/init.d/o2cb configure
Configuring the O2CB driver.
This will configure the on-boot properties of the O2CB driver.
The following questions will determine whether the driver is loaded on
boot. The current values will be shown in brackets ('[]'). Hitting
<ENTER> without typing an answer will keep that current value. Ctrl-C
will abort.
Load O2CB driver on boot (y/n) [n]: y
Cluster to start on boot (Enter "none" to clear) []: ocfs2
Writing O2CB configuration: OK

用命令/etc/init.d/o2cb status时会显示
Module "configfs": Loaded
Filesystem "configfs": Mounted
Module "ocfs2_nodemanager": Loaded
Module "ocfs2_dlm": Loaded
Module "ocfs2_dlmfs": Loaded
Filesystem "ocfs2_dlmfs": Mounted
Checking cluster ocfs2: Offline
这样继续上面的操作,会弹出node configureation窗口,这样就可以设置了
按add,在add node窗口里填写
name dbrac
ip address: 10.15.0.14
ip port:7777(default)
然后点击apply,再点[cluster]-[propagate configuration]
然后点[Tasks]-[Format]来格式化刚才创建的盘,此处使用/dev/hda11
格式化好以后,点左上角的mount到开始建的/u01,
验证所有节点上的所有值正确之后,请退出应用程序
6)检查/etc/ocfs.conf
[root@dbrac ~]# more /etc/ocfs2/cluster.conf
node:
        ip_port = 7777
        ip_address = 10.15.0.14
        number = 0
        name = dbrac
        cluster = ocfs2

cluster:
        node_count = 1
        name = ocfs2
7)将以下条目添加到/etc/fstab 文件中
/dev/hda8 /u01 ocfs _netdev 0 0
8)重新启动系统并确认ocfs模块已经正确加载
[root@dbrac ~]# lsmod | grep ocfs2
ocfs2                 373700  1
debugfs                10504  2 ocfs2
ocfs2_dlmfs            25864  1
ocfs2_dlm             209672  2 ocfs2,ocfs2_dlmfs
ocfs2_nodemanager     178384  6 ocfs2,ocfs2_dlmfs,ocfs2_dlm
configfs               26764  2 ocfs2_nodemanager
jbd                    71385  2 ocfs2,ext3
9)并检查CRS分区已经正确安装
[root@dbrac ~]# mount | grep ocfs2
ocfs2_dlmfs on /dlm type ocfs2_dlmfs (rw)
/dev/hda11 on /u01 type ocfs2 (rw,_netdev,datavolume,nointr,heartbeat=local)
这里发现/u01属主不对,还要修改一下
chown -R oracle:dba /u01
注ocfs2操作请查阅手册(http://oss.oracle.com/projects/o ... fs2_users_guide.pdf)进行配置
在fstab里,要把_netdev换成_netdev,datavolume (参看http://oss.oracle.com/pipermail/ocfs2-users/2005-July/000140.html)
在/etc/selinux/config 里设置"SELINUX=disabled" (参看http://oss.oracle.com/pipermail/ ... October/000250.html)

10、安装并配置自动存储管理和磁盘
Oracle 数据库 10g 中引入了 ASM,使管理员不必再管理单个文件和驱动器,ASM 被内置到 Oracle 内核中,通过它,数据库管理员可以全天候管理单个实例以及集群实例的上千个磁盘驱动器。本文将使用ASM来自动存储和管理所有 Oracle 物理数据库文件(数据、联机重做日志、控制文件、归档重做日志)。
oracle不推荐使用裸设备,因此这里使用前面创建的/dev/hda12分区
1)上传oracleasm-2.4.21-EL-1.0.3-1.i686.rpm,oracleasmlib-1.0.0-1.i386.rpm, oracleasm-support-1.0.3-1.i386.rpm三个软件包到/home/oracle/install/rac/asm目录中, 开始安装:
[oracle@dbrac asmlib]$ su -
Password:
[root@dbrac root]# cd /home/oracle/install/rac/asmlib
[root@dbrac asmlib]# rpm -ivh oracleasm*.rpm
Preparing... ########################################### [100%]
1 oracleasm-support ########################################### [ 33%]
2 oracleasm-2.4.21-EL ########################################### [ 67%]
3 oracleasmlib ########################################### [100%]
2)配置并加载 ASMLib 程序包
[root@dbrac 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 <ENTER>; 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 ]
为 Oracle 共享数据文件创建 ASM 磁盘
[root@dbrac asmlib]# /etc/init.d/oracleasm createdisk oradata /dev/hda12
Marking disk "/dev/hda9" as an ASM disk [ OK ]
其中oradata是ASM磁盘的卷标
列出ASM磁盘的命令是/etc/init.d/oracleasm listdisks
删除ASM磁盘得命令是/etc/init.d/oracleasm deltedisk ORADATA(注意:此处大写)
/etc/init.d/oraclerasm scandisk命令用于其它节点上扫描并识别新卷,由于此处是单机,所以这里不需要执行。
五、安装oracle 10g集群服务软件
从这里开始,建议所有的安装过程全部使用英文界面安装,在简体中文环境下安装会有问题,如果安装操作系统的时候选择了默认语言为简体中文,请更改/etc/sysconfig/i18n文件中LANG的值,然后重新登陆系统。
LANG="en_US.UTF-8"
在附录本文会给出全中文环境数据库安装解决方案
1)上传10201_clusterware_linux32.zip到/home/oracle/install/rac目录中并解压缩;
unzip 10201_clusterware_linux32.zip
2)在安装过程中oracle 10g集群服务软件会在CRS分区创建2个文件,分别是/u01/orcl/ocrfile和/u01/orcl/cssfile,相当重要,不能跳过;检查/tmp目录是否有足够的空间,必须保证/tmp目录有500M以上空余空间;
3)更改oracle用户环境变量;
unset ORA_CRS_HOME
$ unset ORACLE_HOME
$ unset ORA_NLS33
$ unset TNS_ADMIN
4)转到安装源文件目录/home/oracle/install/rac/Disk1目录,执行./runInstaller &开始安装;
屏幕名称
回应
Welcome Screen
单击 Next
Specify Inventory directory and credentials
接受默认值
Root Script Window - Run orainstRoot.sh
以“root”用户帐户打开一个新的控制台窗口。改变目录到/home/oracle/oraInventory 目录,运行 orainstRoot.sh。 返回 OUI 并确认此对话框窗口。
Specify File Locations
Source 目录使用默认值;Name: OraCrs10g_home1;Location:/home/oracle/product/10.1.0/crs_1
Language Selection
请使用English,可以加入简体中文支持
Cluster Configuration
Cluster Name: crs;
Public Node Name:dbrac Private Node Name:int-dbrac
Specify Network Interface Usage
使用默认
Specify Oracle Cluster Registry (OCR) Location:
   a. Select "OCR Configuration"
   b. Specify OCR Location: /ocfs/prod1/ocr1
   c. Specify OCR Mirror Location: /ocfs/prod1/ocr2
Specify Voting Disk Location:
   a. Select "Voting Disk Configuration"
   b. Voting Disk Location: /ocfs/prod1/vdisk1
   c. Additional Voting Disk 1 Location: /ocfs/prod1/vdisk2
   d. Additional Voting Disk 2 Location: /ocfs/prod1/vdisk3
Root Script Window - Run orainstRoot.sh        参看(http://www.dbasupport.com/oracle/ora10g/RAC_9i_to_10g02.shtml)
以“root”用户帐户打开一个新的控制台窗口。转到/home/oracle/product/10.1.0/crs_1目录,运行root.sh。 返回 OUI 并确认此对话框窗口。

5)核实CRS安装
a)检查集群节点
[oracle@dbrac oracle]$ product/10.1.0/crs_1/bin/olsnodes -n
dbrac 1
a)检查CRS自启动脚本
[oracle@dbrac oracle]$ ll /etc/init.d/init.*
-r-xr-xr-x 1 root root 1204 May 10 16:54 /etc/init.d/init.crs
-r-xr-xr-x 1 root root 5489 May 10 16:54 /etc/init.d/init.crsd
-r-xr-xr-x 1 root root 18598 May 10 16:54 /etc/init.d/init.cssd
-r-xr-xr-x 1 root root 4550 May 10 16:54 /etc/init.d/init.evmd
我在这个安装过程中出了第一个过不去的错误
Checking existence of VIP node application (required)

Check failed.
Check failed on nodes:
        dbrac

Checking existence of ONS node application (optional)
Check ignored.

Checking existence of GSD node application (optional)

Check ignored.


Post-check for cluster services setup was unsuccessful on all the nodes.

Command = /data/oracle/product/10.1.0/db_1/bin/cluvfy has failed
这个没有解决,在此记下来,这可能是导致我下面操作出错的根本,下次安装测试时想办法解决这个问题。
问题1。

六、安装 Oracle 10g数据库软件
1)上传10201_database_linux32.zip至/home/oracle/install目录并解压
unzip 10201_database_linux32.zip
2)更改oracle用户环境变量
unset ORA_CRS_HOME
$ unset ORACLE_HOME
$ unset ORA_NLS33
$ unset TNS_ADMIN

3)执行./runInstaller开始安装
屏幕名称
回应
Welcome Screen
选择高级安装
Specify File Locations
Name: OraDb10g_home1
Location:/home/oracle/product/10.1.0/db_1
Specify Hardware Cluster Installation Mode
默认dbrac
Select Installation Type
选择Enterprise Edition 选项
Select Database Configuration
选择Do not create a starter database (必须选这个)
Root Script Window - Run root.sh
以“root”用户帐户打开一个新的控制台窗口。转到/home/oracle/product/10.1.0/db_1目录,运行root.sh程序。
当 VIPCA 出现时,请回应如下所示的屏幕提示:
Welcome: 单击 Next
Network interfaces:选择接口 - eth0
Virtual IPs for cluster notes:
Node Name:dbrac
IP Alias Name:vip-dbrac
IP Address:10.15.0.13
Subnet Mask: 255.255.255.0
注意:如果在安装操作系统的时候选择了默认语言支持是简体中文,请在执行root.sh之前先取消root中文环境设置,命令export LANG=zh_CN.EUC
End of installation
安装结束时,退出 OUI
我在安装过程中没有自动出现vipca,直接运行也不成,但重起后可以运行了,不知道什么原因。
问题2。


七、创建 TNS 监听器进程
DBCA 需要在 RAC 集群的所有节点上配置并运行 Oracle TNS 监听器进程,然后它才能创建集群化数据库。
$export LANG=zh_CN.EUC
$ netca &
屏幕名称
回应
Select the Type of Oracle
Net Services Configuration
选择 Cluster Configuration
Select the nodes to configure
选择节点dbrac
Listener Configuration - Next 6 Screens
接下来全部选择默认,然后返回到Select the Type of Oracle Net Services Configuration
Type of Configuration
选择 Naming Methods configuration。
Naming Methods Configuration
Selected Naming Methods: Local Naming
Type of Configuration
单击 Finish 退出 NETCA。
只产生了listener一个,没有生成listener_dbrac,而且listener里有一行信息觉得有错,注释了以后在安装数据库时才通过。
问题3。

测试
[oracle@dbrac oracle]$ ps -ef | grep lsnr | grep -v 'grep' | grep -v 'ocfs' | awk '{print $9}'
LISTENER_DBRAC
八、创建oracle集群数据库
1)在执行 DBCA 前,请确保为 $ORACLE_BASE/product/10.1.0/db_1 环境正确设置了 $ORACLE_HOME 和 $PATH。
2)在试图开始创建集群化数据库之前,还应确保已安装的所有服务(Oracle TNS 监听器、CRS 进程等)正在运行。
屏幕名称
回应
Welcome Screen
选择 Oracle Real Application Clusters database。
Operations
选择 Create a Database
Node Selection
选择dbrac
Database Templates
选择 Custom Database
Database Identification
Global Database Name: orcl
SID Prefix: orcl
Management Option
保留默认
Database Credentials
选择 Use the Same Password for All Accounts,并输入两次密码
Storage Options
选择使用 ASM
Create ASM Instance
推荐选择spfile
ASM Disk Groups
单击 Create New创建ASM,在弹出的Create Disk Group窗口中,Disk Group Name: orcl_data;选择“Select Member Disks”窗口中的ASM 卷ORCL:ORADATA,并确保状态为PROVISIONED,最后单击ok完成,如果不能格式化,请选择redundancy为external
Database File Locations
选择使用默认值Oracle Managed Files
Database Area: +ORCL_DATA
Recovery Configuration
选择默认Flash Recovery Area,如果要使用传统归档方式,请选择Enable Archiving
Database Content
本文为了加快安装速度,去掉了所有组件支持,仅保留了Enterprise Manager Repository
Database Services
单击 Add,输入 orcltest 作为“Service Name”。
TAF Policy选Basic
Initialization Parameters
保留默认
Database Storage
保留默认
Creation Options
选择默认
End of Database Creation
退出DBCA
我在安装时asm不认一开始建立的分区。所以只好使用cluster文件系统,也就是使用本地硬盘了.
问题4。
3)完成DBCA后,一个单节点集群的oracle数据库服务器已经成功创建了
4)核实orcltest服务
SQL>; show parameter service
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
service_names string orcl, orcltest
如果value只有一个值orcl,则需要手工添加orcltest
SQL>; alter system set service_names ='orcl, orcltest' scope=spfile;
九、测试集群
先检查VIP是否已经启动
[oracle@dbrac oracle]$ ifconfig eth0:1
eth0:1 Link encap:Ethernet HWaddr 00:0D:61:EB:01:66
inet addr:192.168.22.244 Bcast:192.168.22.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:11 Base address:0xc000
从外部客户端连接集群化数据库
在装有oracle 10g 客户端的pc上执行下面的命令进行连接测试,客户端需要配置TNS,配置的时候把服务名指定为orcltest,数据库服务器IP使用VIP(192.168.22.244)
C:\Documents and Settings\Administrator>;sqlplus /nolog
SQL*Plus: Release 10.1.0.2.0 - Production on 星期三 5月 11 13:24:34 2005
Copyright (c) 1982, 2004, Oracle. All rights reserved.
SQL>; connect sys/racrac@orcltest as sysdba
已连接。

在服务器上执行下面的命令
[oracle@dbrac oracle]$ srvctl status database -d orcl
例程 orcl1 正在节点 dbrac 上运行

[oracle@dbrac oracle]$ srvctl status nodeapps -n dbrac
VIP 正在运行的节点: dbrac
GSD 正在运行的节点: dbrac
监听程序正在节点上运行: dbrac
ONS 守护程序正在节点上运行:dbrac
[oracle@dbrac oracle]$ srvctl status asm -n dbrac
ASM 例程 +ASM1 正在节点 dbrac 上运行。

显示数据库配置
[oracle@dbrac oracle]$ srvctl config database -d orcl
dbrac orcl1 /home/oracle/product/10.1.0/db_1
scrctl命令还有很多测试功能,这里不再一一介绍

十、启动和停止集群
这里很重要,和一般的非集群数据库的启动和关闭有点不同.
1)停止 Oracle RAC 10g 环境
先停止 Oracle 实例。当此实例(和相关服务)关闭后,关闭 ASM 实例。最后,关闭节点应用程序(虚拟 IP、GSD、TNS 监听器和 ONS)。
$ export ORACLE_SID=orcl1
$ emctl stop dbconsole
$ srvctl stop instance -d orcl -i orcl1
$ srvctl stop asm -n dbrac
$ srvctl stop nodeapps -n dbrac
2)启动 Oracle RAC 10g 环境
第一步是启动节点应用程序(虚拟 IP、GSD、TNS 监听器和 ONS)。当成功启动节点应用程序后,启动 ASM 实例。最后,启动 Oracle 实例(和相关服务)以及企业管理器数据库控制台。
$ export ORACLE_SID=orcl1
$ srvctl start nodeapps -n dbrac
$ srvctl start asm -n dbrac
$ srvctl start instance -d orcl -i orcl1
$ emctl start dbconsole
3)使用 SRVCTL 启动/停止所有实例
$ srvctl start database -d orcl
$ srvctl stop database -d orcl

本文转自:http://www.linuxmine.com/3508.html


---------------------------------------------------------------------------------------------------------------------------------
说人之短,乃护己之短。夸己之长,乃忌人之长。皆由存心不厚,识量太狭耳。能去此弊,可以进德,可以远怨。
http://www.blogjava.net/szhswl
------------------------------------------------------------------------------------------------------ ----------------- ---------
posted on 2007-12-05 13:28 宋针还 阅读(758) 评论(0)  编辑  收藏 所属分类: ORACLE

只有注册用户登录后才能发表评论。


网站导航: