由于ASM也在使用CRS服務(wù),與RAC環(huán)境下的CRS會(huì)有沖突(瞎猜的),如果不刪除ASM就安裝clusterware的時(shí)候,會(huì)檢測(cè)出下列錯(cuò)誤
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.
在安裝之前需要?jiǎng)h除之前裝ASM中的CRS服務(wù),提示步驟為:
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
注釋最后一行后,重啟機(jī)器
h1:35:respawn:/etc/init.d/init.cssd run >/dev/null 2>&1 </dev/null
2.
檢查安裝環(huán)境,由于前面都已經(jīng)安裝ASM并且建庫(kù)了,各方面還是滿足的,但下一步有幾個(gè)環(huán)境驗(yàn)證可以再次檢查一下。
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的實(shí)例,當(dāng)然,數(shù)據(jù)是不會(huì)丟失的。
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. |
其實(shí)應(yīng)該是該目錄下的trace.log文件,可以看見ASM實(shí)例已經(jīng)刪除。
官方介紹數(shù)據(jù)不會(huì)丟失: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之前,做一個(gè)環(huán)境驗(yàn)證,否則在后續(xù)安裝CRS的時(shí)候,還是會(huì)提示報(bào)錯(cuò),欲速則不達(dá)
[oracle@asm1 cluvfy]$ ./runcluvfy.sh stage -pre crsinst -n asm1
驗(yàn)證過程中可能會(huì)出現(xiàn)常見的幾個(gè)錯(cuò)誤,比如ssh未信任(User equivalence check failed),缺失軟件包(compat-xxx)等
5.1
10g版本中,CRS使用的vote和ocr盤,還沒有合并到ASM里面,需要放在額外的2個(gè)裸設(shè)備里面。建議使用分區(qū)而不是整個(gè)盤,區(qū)別在于crs安裝錯(cuò)誤,需要用dd清空磁盤,如對(duì)整盤操作可能把全盤所有扇區(qū)都清空了。
在RHEL5上配置裸設(shè)備過程
[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" |
每次開機(jī)啟動(dòng)后,裸設(shè)備都初始化完成了
5.2
安裝過程中,需要執(zhí)行/home/oracle/product/10.2.0/crs_1/root.sh腳步,遇到一個(gè)常見的錯(cuò)誤,應(yīng)該是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,手工設(shè)定網(wǎng)卡的配置
[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 |
手工配置后,再執(zhí)行/home/oracle/product/10.2.0/crs_1/bin/vipca來配置vip的地址
5.3
重復(fù)幾次安裝的過程中,也遇見了其他的錯(cuò)誤,分享一個(gè)ocrconfig_xxxx.log的內(nèi)容:
錯(cuò)誤的過程
[ 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]…
虛擬機(jī)下裸設(shè)備的管理和真實(shí)環(huán)境差的太遠(yuǎn)了,安裝不成功不要泄氣
多用fdisk -l掃描盤是否還存在,是否能查看ocr盤的大小,比如[root@asm1 ~]# blockdev –getsize /dev/sdi1
458696
[root@asm1 ~]# blockdev –getsize /dev/raw/raw1
458696
實(shí)在不行就dd把盤清空,刪除/etc/oracle/ocr.loc重新再來
5.4
clusterware安裝完成后,驗(yàn)證安裝結(jié)果
[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成功后開始恢復(fù)數(shù)據(jù)庫(kù),執(zhí)行dbca,選擇Configure Automatic Storage Managment,選擇磁盤發(fā)現(xiàn)路徑(如:/dev/oracleasm/disks/*),恢復(fù)刪除的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.
下面開始把單機(jī)的數(shù)據(jù)庫(kù)加入到CRS服務(wù)
7.1
這里遇到一個(gè)新問題,在我的印象里,10g企業(yè)版是支持rac功能,因此僅需要修改spfile參數(shù),增加cluster_database=true
和其他的配置參數(shù)即可。
實(shí)際上卻不是這樣,配置以后啟動(dòng)數(shù)據(jù)庫(kù)時(shí),會(huì)給一個(gè)錯(cuò)誤:
ORA-00439: feature not enabled: Real Application Clusters
從單機(jī)的spfile啟動(dòng)庫(kù)后,查看v$option看Real Application Clusters的value的值,竟然是false
這里有2個(gè)解決辦法,如果本地磁盤夠大的話,建議重新裝一個(gè)ORACLE_HOME,它會(huì)識(shí)別CRS的環(huán)境,能提示Cluster安裝的選項(xiàng)。
另一個(gè)辦法不太靠譜,我采用虛擬機(jī)測(cè)試,硬盤太小,塞不下這么多東西,使用了附文五的辦法,重新編譯oracle的文件,以支持RAC屬性
$ cd $ORACLE_HOME/rdbms/lib
$ make -f ins_rdbms.mk rac_on
$ make -f ins_rdbms.mk ioracle
這樣即使從單機(jī)的spfile啟動(dòng),v$option中Real Application Clusters的value也是true
7.2
剩下的事情就簡(jiǎn)單了,修改單機(jī)的spfile:
*.cluster_database_instances=2
*.cluster_database=true
ora101.thread=1
ora101.instance_number=1
修改SID為ora101,通過sqlplus能直接把數(shù)據(jù)庫(kù)拉起來(ALTER DATABASE OPEN)
8.
用srvctl把數(shù)據(jù)庫(kù)加入RAC中:
[oracle@asm1 dbs]$ srvctl add database -d ora10 -o $ORACLE_HOME
[oracle@asm1 dbs]$ srvctl add instance -d ora10 -i ora101 -n asm1
啟動(dòng)實(shí)例
[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 上將單一實(shí)例數(shù)據(jù)庫(kù)轉(zhuǎn)換為 Oracle RAC 10g
http://www.oracle.com/technology/global/cn/pub/articles/chan_sing2rac_install.html
四、向基于 Linux 的 Oracle RAC 10g 集群添加新節(jié)點(diǎn)
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
—————— 全 文 完 ——————