笔记本黑屏重启后正常:10g单一实例数据库转化为RAC

来源:百度文库 编辑:偶看新闻 时间:2024/05/08 16:19:36

10g单一实例数据库转化为RAC

张刚发表于:2010-06-13(周日) 16:12:31 | 分类:有关计算机 | 评论:0 | 浏览:324

接上次的步骤继续往下

由于ASM也在使用CRS服务,与RAC环境下的CRS会有冲突(瞎猜的),如果不删除ASM就安装clusterware的时候,会检测出下列错误
Checking local Cluster Synchronization Services (CSS) status …

Actual Result: One or more of the selected nodes in the cluster has local CSS configured on it.
Check complete. The overall result of this check is: Failed <<<<

Problem: One or more of the selected nodes in the cluster has local CSS configured on it.

Recommendation: Cluster Synchronization Services (CSS) provide services for single-instance Automatic Storage Management (ASM) in addition to being part of the Oracle Clusterware stack. When configured stand-alone outside of the Oracle Clusterware, it is sometimes referred to as “local” CSS.

Because you are installing Oracle Clusterware on a set of nodes that already have local CSS configured, you must shut down any ASM instances and any databases using ASM and deconfigure local CSS on those nodes before proceeding with the Oracle Clusterware installation. You can deconfigure local CSS by running ‘localconfig delete’ as the root user from OH/bin. After the Oracle Clusterware installation and configuration is complete, CSS will be started and configured to run from the Oracle Clusterware Home. You may then restart any ASM instances and any databases that use ASM.

1.

在安装之前需要删除之前装ASM中的CRS服务,提示步骤为:
Shut down the database instance, the ASM instance, and the listener.
Remove the CSS auto-start line from the /etc/inittab file to enable you to shut down and uninstall CSS.

[root@asm1 ~]# vi /etc/inittab
注释最后一行后,重启机器
h1:35:respawn:/etc/init.d/init.cssd run >/dev/null 2>&1

2.

检查安装环境,由于前面都已经安装ASM并且建库了,各方面还是满足的,但下一步有几个环境验证可以再次检查一下。

3.

If any cluster member node has had previous versions of Oracle clusterware (Cluster Ready Services or Oracle Clusterware) installed, then ensure that you remove the file ocr.loc on any node that has been labeled previously as a cluster node. The file ocr.loc is in/etc/oracle on Linux.

[root@asm1 oracle]# mv ocr.loc ocr.bak

按照提示删除ASM的实例,当然,数据是不会丢失的。

4.

log in as the oracle user, and run DBCA in silent mode to deconfigure ASM. To run DBCA in silent mode, navigate to the directory $ORACLE_HOME/bin and use the following command syntax on the local node:

[oracle@asm1 ~]$ dbca -silent -deleteASM Look at the log file "/home/oracle/product/10.2.0/db_1/cfgtoollogs/dbca/silent.log" for further details.

其实应该是该目录下的trace.log文件,可以看见ASM实例已经删除。
官方介绍数据不会丢失:You can de-install the single-instance ASM without losing data.

5.

Install Oracle Clusterware on all nodes you intend to have as cluster members
开始安装clusterware之前,做一个环境验证,否则在后续安装CRS的时候,还是会提示报错,欲速则不达
[oracle@asm1 cluvfy]$ ./runcluvfy.sh stage -pre crsinst -n asm1
验证过程中可能会出现常见的几个错误,比如ssh未信任(User equivalence check failed),缺失软件包(compat-xxx)等

5.1

10g版本中,CRS使用的vote和ocr盘,还没有合并到ASM里面,需要放在额外的2个裸设备里面。建议使用分区而不是整个盘,区别在于crs安装错误,需要用dd清空磁盘,如对整盘操作可能把全盘所有扇区都清空了。

在RHEL5上配置裸设备过程

[root@asm1 ~]# cat /etc/udev/rules.d/60-raw.rules ... #ocr ACTION=="add", KERNEL=="/dev/sdi1", RUN+="/bin/raw /dev/raw/raw1 %N" ACTION=="add", ENV{MAJOR}=="8", ENV{MINOR}=="129", RUN+="/bin/raw /dev/raw/raw1 %M %m" #vote ACTION=="add", KERNEL=="/dev/sdj1", RUN+="/bin/raw /dev/raw/raw2 %N" ACTION=="add", ENV{MAJOR}=="8", ENV{MINOR}=="145", RUN+="/bin/raw /dev/raw/raw2 %M %m"    KERNEL=="raw1",OWNER="oracle",GROUP="oinstall",MODE="640" KERNEL=="raw2",OWNER="oracle",GROUP="oinstall",MODE="640"

每次开机启动后,裸设备都初始化完成了

5.2

安装过程中,需要执行/home/oracle/product/10.2.0/crs_1/root.sh脚步,遇到一个常见的错误,应该是bug:
Running vipca(silent) for configuring nodeapps
/home/oracle/product/10.2.0/crs_1/jdk/jre//bin/java: error while loading shared libraries: libpthread.so.0: cannot open shared object file: No such file or directory
参考附文二中的处理办法:
在/home/oracle/product/10.2.0/crs_1/bin/vipca和srvctl中分别增加一行unset LD_ASSUME_KERNEL,手工设定网卡的配置

[root@asm1 bin]# ./oifcfg iflist eth0  192.168.56.0 eth1  192.168.0.0 [root@asm1 bin]# ./oifcfg setif -global eth1/192.168.0.0:public [root@asm1 bin]# ./oifcfg setif -global eth0/192.168.56.0:cluster_interconnect [root@asm1 bin]# ./oifcfg getif eth1  192.168.0.0  global  public eth0  192.168.56.0  global  cluster_interconnect

手工配置后,再执行/home/oracle/product/10.2.0/crs_1/bin/vipca来配置vip的地址

5.3

重复几次安装的过程中,也遇见了其他的错误,分享一个ocrconfig_xxxx.log的内容:
错误的过程
[ OCRRAW][1587408]propriogid:1: INVALID FORMAT
[ OCRRAW][1587408]propriowv: Vote information on disk 0 [/dev/raw/raw1] is adjusted from [0/0] to [2/2]
[ OCRRAW][1587408]propriniconfig:No 92 configuration
[ OCRAPI][1587408]a_init:6a: Backend init successful
[ OCRCONF][1587408]Initialized DATABASE keys in OCR
[ OCRCONF][1587408]csetskgfrblock0: clsfmt returned with error [4].
[ OCRCONF][1587408]Failure in setting block0 [-1]
[ OCRCONF][1587408]OCR block 0 is not set !
[ OCRCONF][1587408]Exiting [status=failed]…

正确的过程
[ OCRRAW][1169168]propriogid:1: INVALID FORMAT
[ OCRRAW][1169168]propriowv: Vote information on disk 0 [/dev/raw/raw1] is adjusted from [0/0] to [2/2]
[ OCRRAW][1169168]propriniconfig:No 92 configuration
[ OCRAPI][1169168]a_init:6a: Backend init successful
[ OCRCONF][1169168]Initialized DATABASE keys in OCR
[ OCRCONF][1169168]Successfully set skgfr block 0
[ OCRCONF][1169168]Exiting [status=success]…

虚拟机下裸设备的管理和真实环境差的太远了,安装不成功不要泄气 多用fdisk -l扫描盘是否还存在,是否能查看ocr盘的大小,比如
[root@asm1 ~]# blockdev –getsize /dev/sdi1
458696
[root@asm1 ~]# blockdev –getsize /dev/raw/raw1
458696
实在不行就dd把盘清空,删除/etc/oracle/ocr.loc重新再来

5.4

clusterware安装完成后,验证安装结果

[oracle@asm1 bin]$ ./crs_stat -t Name           Type           Target    State     Host ------------------------------------------------------------ ora.asm1.gsd   application    ONLINE    ONLINE    asm1 ora.asm1.ons   application    ONLINE    ONLINE    asm1 ora.asm1.vip   application    ONLINE    ONLINE    asm1

6.

安装clusterware成功后开始恢复数据库,执行dbca,选择Configure Automatic Storage Managment,选择磁盘发现路径(如:/dev/oracleasm/disks/*),恢复删除的ASM信息,由于原来的配置文件如spfile,口令文件都在,也可以手工挂盘

[oracle@asm1 dbs]$ export ORACLE_SID=+ASM [oracle@asm1 dbs]$ sqlplus "/as sysdba"    SQL> alter diskgroup data7 mount;    Diskgroup altered.

6.1

添加ASM到CRS中
[oracle@asm1 bin]$ srvctl add asm -n asm1 -i +ASM -o $ORACLE_HOME
[oracle@asm1 bin]$ srvctl start asm -n asm1
[oracle@asm1 bin]$ crs_stat -t
Name Type Target State Host
————————————————————
ora….ASM.asm application ONLINE ONLINE asm1
ora.asm1.gsd application ONLINE ONLINE asm1
ora.asm1.ons application ONLINE ONLINE asm1
ora.asm1.vip application ONLINE ONLINE asm1

7.

下面开始把单机的数据库加入到CRS服务

7.1

这里遇到一个新问题,在我的印象里,10g企业版是支持rac功能,因此仅需要修改spfile参数,增加cluster_database=true
和其他的配置参数即可。

实际上却不是这样,配置以后启动数据库时,会给一个错误:
ORA-00439: feature not enabled: Real Application Clusters

从单机的spfile启动库后,查看v$option看Real Application Clusters的value的值,竟然是false

这里有2个解决办法,如果本地磁盘够大的话,建议重新装一个ORACLE_HOME,它会识别CRS的环境,能提示Cluster安装的选项。

另一个办法不太靠谱,我采用虚拟机测试,硬盘太小,塞不下这么多东西,使用了附文五的办法,重新编译oracle的文件,以支持RAC属性

$ cd $ORACLE_HOME/rdbms/lib
$ make -f ins_rdbms.mk rac_on
$ make -f ins_rdbms.mk ioracle

这样即使从单机的spfile启动,v$option中Real Application Clusters的value也是true

7.2

剩下的事情就简单了,修改单机的spfile:
*.cluster_database_instances=2
*.cluster_database=true
ora101.thread=1
ora101.instance_number=1

修改SID为ora101,通过sqlplus能直接把数据库拉起来(ALTER DATABASE OPEN)

8.

用srvctl把数据库加入RAC中:
[oracle@asm1 dbs]$ srvctl add database -d ora10 -o $ORACLE_HOME
[oracle@asm1 dbs]$ srvctl add instance -d ora10 -i ora101 -n asm1
启动实例
[oracle@asm1 dbs]$ srvctl start instance -d ora10 -i ora101

附文:

一、D.3.6 Converting Single-Instance ASM to Cluster ASM

http://download-uk.oracle.com/docs/cd/B19306_01/install.102/b14203/cvrt2rac.htm#BABJDAJG

二、Build Your Own Oracle RAC Cluster on Oracle Enterprise Linux and iSCSI (Continued)

http://www.oracle.com/technology/pub/articles/hunter_rac10gr2_iscsi_3.html

三、在 RHEL3 上将单一实例数据库转换为 Oracle RAC 10g

http://www.oracle.com/technology/global/cn/pub/articles/chan_sing2rac_install.html

四、向基于 Linux 的 Oracle RAC 10g 集群添加新节点

http://www.oracle.com/technology/global/cn/pub/articles/vallath-nodes.html

五、ORA-00439: feature not enabled: Real Application Clusters & ORA-01078
http://surachartopun.com/2008/11/ora-00439-feature-not-enabled-real.html

—————— 全 文 完 ——————

  除非注明,张刚的博客文章均为原创,转载请以链接形式标明本文地址

 

  本文地址:http://www.zhanggang.net/y2010/38094.html