本想做個(gè)安裝記錄,把遇到的錯(cuò)誤和解決辦法寫下來(lái),以備以后操作時(shí)參考,但在寫的過(guò)程中陰錯(cuò)陽(yáng)差地對(duì)付著把系統(tǒng)裝上了,所以就當(dāng)個(gè)安裝說(shuō)明吧,不過(guò)其中還有個(gè)錯(cuò)誤(在下面有記錄),感覺(jué)應(yīng)該對(duì)使用有影響,所以以后還要想辦法修正。這個(gè)就當(dāng)個(gè)初稿吧。
一、簡(jiǎn)介
熟悉 Oracle 真正應(yīng)用集群 (RAC) 10g 技術(shù)的最有效方法之一是訪問(wèn)一個(gè)實(shí)際的 Oracle RAC 10g 集群。沒(méi)有什么方法比直接體驗(yàn)它們能夠更好地理解其好處的了 — 包括容錯(cuò)、安全性、負(fù)載均衡和可伸縮性。
Oracle RAC 的核心是共享磁盤子系統(tǒng)。集群中的所有節(jié)點(diǎn)必須能夠訪問(wèn)集群中所有節(jié)點(diǎn)的所有數(shù)據(jù)、重做日志文件、控制文件和參數(shù)文件。數(shù)據(jù)磁盤必須在全局范圍內(nèi)可用,以便允許所有節(jié)點(diǎn)訪問(wèn)數(shù)據(jù)庫(kù)。每個(gè)節(jié)點(diǎn)擁有自己的重做日志和控制文件,但是其他節(jié)點(diǎn)必須能夠訪問(wèn)這些文件,以便在系統(tǒng)故障時(shí)恢復(fù)該節(jié)點(diǎn)。
希望本文能對(duì)一些手頭上只有一臺(tái)PC而沒(méi)有真正的雙機(jī)環(huán)境的朋友提供一個(gè)參考。
二、本文實(shí)踐環(huán)境
1、PC主要配置:
Dell OptiPlex 170L Series
Intel(R) Pentium(R) 4 CPU 2.80GHz
DISK drive 80G
網(wǎng)卡 一塊
內(nèi)存 DDR 512MB
顯示卡:intel 865
操作系統(tǒng):Redhat Enterprise Linux 4 u2
數(shù)據(jù)庫(kù) oracle10.2.0.
2、服務(wù)器分區(qū)方案
RAC節(jié)點(diǎn)名 實(shí)例名 數(shù)據(jù)庫(kù)名 $ORACLE_BASE 文件系統(tǒng)
dbrac orcl1 orcl /home/oracle ASM
Oracle CRS 共享文件
文件類型 文件名 分區(qū) 掛載點(diǎn) 文件系統(tǒng)
oracle集群注冊(cè)表 /u01/orcl/orcfile /dev/hda11 /u01 OCFS
CRS表決磁盤 /u01/orcl/cssfile /dev/hda11 /u01 OCFS
3、所涉及軟件
1)oracle 10g 數(shù)據(jù)庫(kù)軟件
10201_database_linux32.zip (從otn.oracle.com下載)
2)oracle 10g 集群服務(wù)軟件
10201_clusterware_linux32.zip (從otn.oracle.com下載)
3)OCFS文件系統(tǒng)支持
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驅(qū)動(dòng)程序
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官方網(wǎng)站下載
三、基礎(chǔ)操作
1、安裝linux
安裝過(guò)程中一些需要注意的地方:
1)磁盤分區(qū):swap分區(qū)大小建議是內(nèi)存的2倍,這里是1024MB,劃出一些系統(tǒng)必要的分區(qū)根分區(qū)/,var分區(qū)/var,usr分區(qū)/usr, home分區(qū)/home,臨時(shí)文件分區(qū)/tmp。注意:這里不要把所有的硬盤空間劃分進(jìn)操作系統(tǒng),留下一半給后面安裝oarcle集群磁盤使用,本文示例
2)文件系統(tǒng) 容量 掛載點(diǎn)
/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兩項(xiàng),為了節(jié)省空間其他可以不要
4)防火墻:最好不要
5)網(wǎng)絡(luò)設(shè)置:eth0
取消選中 [Configure using DHCP] 復(fù)選項(xiàng)
選中 [Activate on boot]
IP 地址:10.15.0.14
網(wǎng)絡(luò)掩碼: 255.255.255.0
6)主機(jī)名:dbrac
2、.安裝完成后檢查必需的 RPM
3、必須安裝以下程序包(或更高版本):(我安裝時(shí)都裝了,所以也沒(méi)有檢查以下的包)
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
四、設(shè)置
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
此處設(shè)置相當(dāng)重要,不能跳過(guò),一定按照此設(shè)置,IP和主機(jī)別名可以自己定
oracle 10g RAC中 使用了虛擬IP(VIP)技術(shù),這是一個(gè)令人心動(dòng)的高可用性、多機(jī)無(wú)縫切換的解決方案,但在單機(jī)模擬環(huán)境中僅僅是個(gè)形式而已,為了以后的順利安裝,不得不配置它
確保RAC節(jié)點(diǎn)名沒(méi)有出現(xiàn)在回送地址中
根據(jù)網(wǎng)上的安裝方案是這樣做的,但我試了幾次都有問(wèn)題,總報(bào)dbrac已被選用,所以我用的是如下的設(shè)置
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、調(diào)整內(nèi)核網(wǎng)絡(luò)設(shè)置參數(shù)
編輯/etc/sysctl.conf,增加下面的設(shè)置:
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、添加模塊選項(xiàng):
將下列行添加到 /etc/modprobe.conf 中:
options sbp2 sbp2_exclusive_login=0
4、創(chuàng)建“oracle”用戶和目錄
$su -
#groupadd dba
#useradd -g dba oracle
#passwd oracle
5、編輯.bash_profile文件,增加oracle環(huán)境變量
$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
這里也主要用的網(wǎng)上的說(shuō)明,感覺(jué)這么多參數(shù)實(shí)在是沒(méi)必要
6、創(chuàng)建CRS分區(qū)和數(shù)據(jù)文件分區(qū)
1)先建立CRS分區(qū)掛載點(diǎn)
mkdir /u01
chown oracle:dba /u01
2)接著創(chuàng)建CRS分區(qū)和共享數(shù)據(jù)文件分區(qū)
fdisk /dev/hda
CRS分區(qū)只要500M就夠了,剩下的全部劃分給數(shù)據(jù)文件分區(qū),這里為數(shù)據(jù)文件只分了1個(gè)區(qū)/dev/hda12
CRS分區(qū)為/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 內(nèi)核模塊
在/etc/modprobe.conf中增加下面一行
options hangcheck-timer hangcheck_tick=30 hangcheck_margin=180
為了確保系統(tǒng)每次重新啟動(dòng)的時(shí)候都能自動(dòng)加載hangcheck-timer 模塊,需要在/etc/rc.local文件中增加下面一行
echo "modprobe hangcheck-timer" >>/etc/rc.local
重啟系統(tǒng)并檢查hangcheck-timer模塊是否已經(jīng)加載
[root@dbrac root]# lsmod | grep hangcheck-timer
hangcheck_timer 3289 0
8、配置 RAC 節(jié)點(diǎn)以進(jìn)行遠(yuǎn)程訪問(wèn)
在 RAC 節(jié)點(diǎn)上運(yùn)行 Oracle Universal Installer 時(shí),它將使用 rsh 、rcp或scp命令將 Oracle 軟件復(fù)制到 RAC 集群中的所有其他節(jié)點(diǎn)。雖然是單機(jī)模擬,但仍然要配置,無(wú)法跳過(guò),從oracle 10g開(kāi)始已經(jīng)支持ssh協(xié)議,本文將首先嘗試使用它
使用oracle用戶創(chuàng)建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
復(fù)制公匙到其他節(jié)點(diǎn)(這里是單機(jī))
[oracle@dbrac oracle]$ cp -v .ssh/id_dsa.pub .ssh/authorized_keys
測(cè)試密匙是否生效
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]$
無(wú)需密碼即可登陸表示密匙已經(jīng)生效
記住也要試一下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
否則同樣會(huì)報(bào)ssh不能連接的錯(cuò)誤,可以通過(guò)在主機(jī)的圖型界面里的命令窗口中運(yùn)行檢查是否有錯(cuò).(參看
http://blog.itpub.net/post/126/4684)
9、安裝和配置 OCFS2
OCFS2是Oracle 集群文件系統(tǒng) (OCFS2),由 Oracle 開(kāi)發(fā),用于消除數(shù)據(jù)庫(kù)管理員和系統(tǒng)管理員管理原始設(shè)備這一負(fù)擔(dān),它提供了與通常的文件系統(tǒng)相同的功能和用法。盡量不要在OCFS文件系統(tǒng)上使用linux二進(jìn)制文件系統(tǒng)操作命令
在目前的版本1種支持以下文件類型:
Oracle 數(shù)據(jù)庫(kù)文件
聯(lián)機(jī)重做日志文件
歸檔重做日志文件
控制文件
服務(wù)器參數(shù)文件 (SPFILE)
Oracle 集群注冊(cè)表 (OCR) 文件
CRS 表決磁盤。
安裝和配置
1)上傳rpm包
2)執(zhí)行rpm -ivh ocfs*.rpm 開(kāi)始安裝
3)生成并配置/etc/ocfs.conf文件
root@dbrac ocfs]# ocfsconsole &
4)使用 ocfsconsole GUI 工具執(zhí)行以下步驟:
5)選擇 [cluster]-[configure nodes]時(shí)會(huì)報(bào)"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."錯(cuò)誤.
ocfs2會(huì)自動(dòng)o2cb load關(guān)閉窗口
但也把用下面辦法設(shè)成開(kāi)機(jī)時(shí)自動(dòng)起動(dòng)
# /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時(shí)會(huì)顯示
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
這樣繼續(xù)上面的操作,會(huì)彈出node configureation窗口,這樣就可以設(shè)置了
按add,在add node窗口里填寫
name dbrac
ip address: 10.15.0.14
ip port:7777(default)
然后點(diǎn)擊apply,再點(diǎn)[cluster]-[propagate configuration]
然后點(diǎn)[Tasks]-[Format]來(lái)格式化剛才創(chuàng)建的盤,此處使用/dev/hda11
格式化好以后,點(diǎn)左上角的mount到開(kāi)始建的/u01,
驗(yàn)證所有節(jié)點(diǎn)上的所有值正確之后,請(qǐng)退出應(yīng)用程序
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)重新啟動(dòng)系統(tǒng)并確認(rèn)ocfs模塊已經(jīng)正確加載
[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分區(qū)已經(jīng)正確安裝
[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)
這里發(fā)現(xiàn)/u01屬主不對(duì),還要修改一下
chown -R oracle:dba /u01
注ocfs2操作請(qǐng)查閱手冊(cè)(
http://oss.oracle.com/projects/o ... fs2_users_guide.pdf)進(jìn)行配置
在fstab里,要把_netdev換成_netdev,datavolume (參看
http://oss.oracle.com/pipermail/ocfs2-users/2005-July/000140.html)
在/etc/selinux/config 里設(shè)置"SELINUX=disabled" (參看
http://oss.oracle.com/pipermail/ ... October/000250.html)
10、安裝并配置自動(dòng)存儲(chǔ)管理和磁盤
Oracle 數(shù)據(jù)庫(kù) 10g 中引入了 ASM,使管理員不必再管理單個(gè)文件和驅(qū)動(dòng)器,ASM 被內(nèi)置到 Oracle 內(nèi)核中,通過(guò)它,數(shù)據(jù)庫(kù)管理員可以全天候管理單個(gè)實(shí)例以及集群實(shí)例的上千個(gè)磁盤驅(qū)動(dòng)器。本文將使用ASM來(lái)自動(dòng)存儲(chǔ)和管理所有 Oracle 物理數(shù)據(jù)庫(kù)文件(數(shù)據(jù)、聯(lián)機(jī)重做日志、控制文件、歸檔重做日志)。
oracle不推薦使用裸設(shè)備,因此這里使用前面創(chuàng)建的/dev/hda12分區(qū)
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三個(gè)軟件包到/home/oracle/install/rac/asm目錄中, 開(kāi)始安裝:
[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 共享數(shù)據(jù)文件創(chuàng)建 ASM 磁盤
[root@dbrac asmlib]# /etc/init.d/oracleasm createdisk oradata /dev/hda12
Marking disk "/dev/hda9" as an ASM disk [ OK ]
其中oradata是ASM磁盤的卷標(biāo)
列出ASM磁盤的命令是/etc/init.d/oracleasm listdisks
刪除ASM磁盤得命令是/etc/init.d/oracleasm deltedisk ORADATA(注意:此處大寫)
/etc/init.d/oraclerasm scandisk命令用于其它節(jié)點(diǎn)上掃描并識(shí)別新卷,由于此處是單機(jī),所以這里不需要執(zhí)行。
五、安裝oracle 10g集群服務(wù)軟件
從這里開(kāi)始,建議所有的安裝過(guò)程全部使用英文界面安裝,在簡(jiǎn)體中文環(huán)境下安裝會(huì)有問(wèn)題,如果安裝操作系統(tǒng)的時(shí)候選擇了默認(rèn)語(yǔ)言為簡(jiǎn)體中文,請(qǐng)更改/etc/sysconfig/i18n文件中LANG的值,然后重新登陸系統(tǒng)。
LANG="en_US.UTF-8"
在附錄本文會(huì)給出全中文環(huán)境數(shù)據(jù)庫(kù)安裝解決方案
1)上傳10201_clusterware_linux32.zip到/home/oracle/install/rac目錄中并解壓縮;
unzip 10201_clusterware_linux32.zip
2)在安裝過(guò)程中oracle 10g集群服務(wù)軟件會(huì)在CRS分區(qū)創(chuàng)建2個(gè)文件,分別是/u01/orcl/ocrfile和/u01/orcl/cssfile,相當(dāng)重要,不能跳過(guò);檢查/tmp目錄是否有足夠的空間,必須保證/tmp目錄有500M以上空余空間;
3)更改oracle用戶環(huán)境變量;
unset ORA_CRS_HOME
$ unset ORACLE_HOME
$ unset ORA_NLS33
$ unset TNS_ADMIN
4)轉(zhuǎn)到安裝源文件目錄/home/oracle/install/rac/Disk1目錄,執(zhí)行./runInstaller &開(kāi)始安裝;
屏幕名稱
回應(yīng)
Welcome Screen
單擊 Next
Specify Inventory directory and credentials
接受默認(rèn)值
Root Script Window - Run orainstRoot.sh
以“root”用戶帳戶打開(kāi)一個(gè)新的控制臺(tái)窗口。改變目錄到/home/oracle/oraInventory 目錄,運(yùn)行 orainstRoot.sh。 返回 OUI 并確認(rèn)此對(duì)話框窗口。
Specify File Locations
Source 目錄使用默認(rèn)值;Name: OraCrs10g_home1;Location:/home/oracle/product/10.1.0/crs_1
Language Selection
請(qǐng)使用English,可以加入簡(jiǎn)體中文支持
Cluster Configuration
Cluster Name: crs;
Public Node Name:dbrac Private Node Name:int-dbrac
Specify Network Interface Usage
使用默認(rèn)
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”用戶帳戶打開(kāi)一個(gè)新的控制臺(tái)窗口。轉(zhuǎn)到/home/oracle/product/10.1.0/crs_1目錄,運(yùn)行root.sh。 返回 OUI 并確認(rèn)此對(duì)話框窗口。
5)核實(shí)CRS安裝
a)檢查集群節(jié)點(diǎn)
[oracle@dbrac oracle]$ product/10.1.0/crs_1/bin/olsnodes -n
dbrac 1
a)檢查CRS自啟動(dòng)腳本
[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
我在這個(gè)安裝過(guò)程中出了第一個(gè)過(guò)不去的錯(cuò)誤
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
這個(gè)沒(méi)有解決,在此記下來(lái),這可能是導(dǎo)致我下面操作出錯(cuò)的根本,下次安裝測(cè)試時(shí)想辦法解決這個(gè)問(wèn)題。
問(wèn)題1。
六、安裝 Oracle 10g數(shù)據(jù)庫(kù)軟件
1)上傳10201_database_linux32.zip至/home/oracle/install目錄并解壓
unzip 10201_database_linux32.zip
2)更改oracle用戶環(huán)境變量
unset ORA_CRS_HOME
$ unset ORACLE_HOME
$ unset ORA_NLS33
$ unset TNS_ADMIN
3)執(zhí)行./runInstaller開(kāi)始安裝
屏幕名稱
回應(yīng)
Welcome Screen
選擇高級(jí)安裝
Specify File Locations
Name: OraDb10g_home1
Location:/home/oracle/product/10.1.0/db_1
Specify Hardware Cluster Installation Mode
默認(rèn)dbrac
Select Installation Type
選擇Enterprise Edition 選項(xiàng)
Select Database Configuration
選擇Do not create a starter database (必須選這個(gè))
Root Script Window - Run root.sh
以“root”用戶帳戶打開(kāi)一個(gè)新的控制臺(tái)窗口。轉(zhuǎn)到/home/oracle/product/10.1.0/db_1目錄,運(yùn)行root.sh程序。
當(dāng) VIPCA 出現(xiàn)時(shí),請(qǐng)回應(yīng)如下所示的屏幕提示:
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
注意:如果在安裝操作系統(tǒng)的時(shí)候選擇了默認(rèn)語(yǔ)言支持是簡(jiǎn)體中文,請(qǐng)?jiān)趫?zhí)行root.sh之前先取消root中文環(huán)境設(shè)置,命令export LANG=zh_CN.EUC
End of installation
安裝結(jié)束時(shí),退出 OUI
我在安裝過(guò)程中沒(méi)有自動(dòng)出現(xiàn)vipca,直接運(yùn)行也不成,但重起后可以運(yùn)行了,不知道什么原因。
問(wèn)題2。
七、創(chuàng)建 TNS 監(jiān)聽(tīng)器進(jìn)程
DBCA 需要在 RAC 集群的所有節(jié)點(diǎn)上配置并運(yùn)行 Oracle TNS 監(jiān)聽(tīng)器進(jìn)程,然后它才能創(chuàng)建集群化數(shù)據(jù)庫(kù)。
$export LANG=zh_CN.EUC
$ netca &
屏幕名稱
回應(yīng)
Select the Type of Oracle
Net Services Configuration
選擇 Cluster Configuration
Select the nodes to configure
選擇節(jié)點(diǎn)dbrac
Listener Configuration - Next 6 Screens
接下來(lái)全部選擇默認(rèn),然后返回到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。
只產(chǎn)生了listener一個(gè),沒(méi)有生成listener_dbrac,而且listener里有一行信息覺(jué)得有錯(cuò),注釋了以后在安裝數(shù)據(jù)庫(kù)時(shí)才通過(guò)。
問(wèn)題3。
測(cè)試
[oracle@dbrac oracle]$ ps -ef | grep lsnr | grep -v 'grep' | grep -v 'ocfs' | awk '{print $9}'
LISTENER_DBRAC
八、創(chuàng)建oracle集群數(shù)據(jù)庫(kù)
1)在執(zhí)行 DBCA 前,請(qǐng)確保為 $ORACLE_BASE/product/10.1.0/db_1 環(huán)境正確設(shè)置了 $ORACLE_HOME 和 $PATH。
2)在試圖開(kāi)始創(chuàng)建集群化數(shù)據(jù)庫(kù)之前,還應(yīng)確保已安裝的所有服務(wù)(Oracle TNS 監(jiān)聽(tīng)器、CRS 進(jìn)程等)正在運(yùn)行。
屏幕名稱
回應(yīng)
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
保留默認(rèn)
Database Credentials
選擇 Use the Same Password for All Accounts,并輸入兩次密碼
Storage Options
選擇使用 ASM
Create ASM Instance
推薦選擇spfile
ASM Disk Groups
單擊 Create New創(chuàng)建ASM,在彈出的Create Disk Group窗口中,Disk Group Name: orcl_data;選擇“Select Member Disks”窗口中的ASM 卷ORCL:ORADATA,并確保狀態(tài)為PROVISIONED,最后單擊ok完成,如果不能格式化,請(qǐng)選擇redundancy為external
Database File Locations
選擇使用默認(rèn)值Oracle Managed Files
Database Area: +ORCL_DATA
Recovery Configuration
選擇默認(rèn)Flash Recovery Area,如果要使用傳統(tǒng)歸檔方式,請(qǐng)選擇Enable Archiving
Database Content
本文為了加快安裝速度,去掉了所有組件支持,僅保留了Enterprise Manager Repository
Database Services
單擊 Add,輸入 orcltest 作為“Service Name”。
TAF Policy選Basic
Initialization Parameters
保留默認(rèn)
Database Storage
保留默認(rèn)
Creation Options
選擇默認(rèn)
End of Database Creation
退出DBCA
我在安裝時(shí)asm不認(rèn)一開(kāi)始建立的分區(qū)。所以只好使用cluster文件系統(tǒng),也就是使用本地硬盤了.
問(wèn)題4。
3)完成DBCA后,一個(gè)單節(jié)點(diǎn)集群的oracle數(shù)據(jù)庫(kù)服務(wù)器已經(jīng)成功創(chuàng)建了
4)核實(shí)orcltest服務(wù)
SQL>; show parameter service
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
service_names string orcl, orcltest
如果value只有一個(gè)值orcl,則需要手工添加orcltest
SQL>; alter system set service_names ='orcl, orcltest' scope=spfile;
九、測(cè)試集群
先檢查VIP是否已經(jīng)啟動(dòng)
[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
從外部客戶端連接集群化數(shù)據(jù)庫(kù)
在裝有oracle 10g 客戶端的pc上執(zhí)行下面的命令進(jìn)行連接測(cè)試,客戶端需要配置TNS,配置的時(shí)候把服務(wù)名指定為orcltest,數(shù)據(jù)庫(kù)服務(wù)器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
已連接。
在服務(wù)器上執(zhí)行下面的命令
[oracle@dbrac oracle]$ srvctl status database -d orcl
例程 orcl1 正在節(jié)點(diǎn) dbrac 上運(yùn)行
[oracle@dbrac oracle]$ srvctl status nodeapps -n dbrac
VIP 正在運(yùn)行的節(jié)點(diǎn): dbrac
GSD 正在運(yùn)行的節(jié)點(diǎn): dbrac
監(jiān)聽(tīng)程序正在節(jié)點(diǎn)上運(yùn)行: dbrac
ONS 守護(hù)程序正在節(jié)點(diǎn)上運(yùn)行:dbrac
[oracle@dbrac oracle]$ srvctl status asm -n dbrac
ASM 例程 +ASM1 正在節(jié)點(diǎn) dbrac 上運(yùn)行。
顯示數(shù)據(jù)庫(kù)配置
[oracle@dbrac oracle]$ srvctl config database -d orcl
dbrac orcl1 /home/oracle/product/10.1.0/db_1
scrctl命令還有很多測(cè)試功能,這里不再一一介紹
十、啟動(dòng)和停止集群
這里很重要,和一般的非集群數(shù)據(jù)庫(kù)的啟動(dòng)和關(guān)閉有點(diǎn)不同.
1)停止 Oracle RAC 10g 環(huán)境
先停止 Oracle 實(shí)例。當(dāng)此實(shí)例(和相關(guān)服務(wù))關(guān)閉后,關(guān)閉 ASM 實(shí)例。最后,關(guān)閉節(jié)點(diǎn)應(yīng)用程序(虛擬 IP、GSD、TNS 監(jiān)聽(tīng)器和 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)啟動(dòng) Oracle RAC 10g 環(huán)境
第一步是啟動(dòng)節(jié)點(diǎn)應(yīng)用程序(虛擬 IP、GSD、TNS 監(jiān)聽(tīng)器和 ONS)。當(dāng)成功啟動(dòng)節(jié)點(diǎn)應(yīng)用程序后,啟動(dòng) ASM 實(shí)例。最后,啟動(dòng) Oracle 實(shí)例(和相關(guān)服務(wù))以及企業(yè)管理器數(shù)據(jù)庫(kù)控制臺(tái)。
$ 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 啟動(dòng)/停止所有實(shí)例
$ srvctl start database -d orcl
$ srvctl stop database -d orcl
本文轉(zhuǎn)自:
http://www.linuxmine.com/3508.html
---------------------------------------------------------------------------------------------------------------------------------
說(shuō)人之短,乃護(hù)己之短。夸己之長(zhǎng),乃忌人之長(zhǎng)。皆由存心不厚,識(shí)量太狹耳。能去此弊,可以進(jìn)德,可以遠(yuǎn)怨。
------------------------------------------------------------------------------------------------------ ----------------- ---------