szhswl
          宋針還的個人空間
          <2025年6月>
          25262728293031
          1234567
          891011121314
          15161718192021
          22232425262728
          293012345

              blog是收集資料并且作為技術交流的平臺,發(fā)布一些本人常用資料或開發(fā)經(jīng)驗,希望能和大家一起討論、進步。

          訪問統(tǒng)計 free hit counter

          留言簿(6)

          我參與的團隊

          隨筆檔案(8)

          文章分類(149)

          新聞分類(1)

          相冊

          收藏夾(21)

          友情鏈接

          我的鏈接

          搜索

          •  

          積分與排名

          • 積分 - 150757
          • 排名 - 413

          最新評論

          閱讀排行榜

          評論排行榜

          在linux上單機模擬Oracle 10g RAC集群(OCFS+ASM)

          本想做個安裝記錄,把遇到的錯誤和解決辦法寫下來,以備以后操作時參考,但在寫的過程中陰錯陽差地對付著把系統(tǒng)裝上了,所以就當個安裝說明吧,不過其中還有個錯誤(在下面有記錄),感覺應該對使用有影響,所以以后還要想辦法修正。這個就當個初稿吧。
          一、簡介
          熟悉 Oracle 真正應用集群 (RAC) 10g 技術的最有效方法之一是訪問一個實際的 Oracle RAC 10g 集群。沒有什么方法比直接體驗它們能夠更好地理解其好處的了 — 包括容錯、安全性、負載均衡和可伸縮性。
          Oracle RAC 的核心是共享磁盤子系統(tǒng)。集群中的所有節(jié)點必須能夠訪問集群中所有節(jié)點的所有數(shù)據(jù)、重做日志文件、控制文件和參數(shù)文件。數(shù)據(jù)磁盤必須在全局范圍內(nèi)可用,以便允許所有節(jié)點訪問數(shù)據(jù)庫。每個節(jié)點擁有自己的重做日志和控制文件,但是其他節(jié)點必須能夠訪問這些文件,以便在系統(tǒng)故障時恢復該節(jié)點。
          希望本文能對一些手頭上只有一臺PC而沒有真正的雙機環(huán)境的朋友提供一個參考。
          二、本文實踐環(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ù)庫 oracle10.2.0.
          2、服務器分區(qū)方案
          RAC節(jié)點名    實例名   數(shù)據(jù)庫名   $ORACLE_BASE    文件系統(tǒng)
          dbrac        orcl1       orcl    /home/oracle       ASM
          Oracle CRS 共享文件
          文件類型                文件名       分區(qū)       掛載點 文件系統(tǒng)
          oracle集群注冊表 /u01/orcl/orcfile /dev/hda11   /u01    OCFS
          CRS表決磁盤      /u01/orcl/cssfile /dev/hda11   /u01    OCFS
          3、所涉及軟件
          1)oracle 10g 數(shù)據(jù)庫軟件
          10201_database_linux32.zip (從otn.oracle.com下載)
          2)oracle 10g 集群服務軟件
          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ū)動程序
          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)站下載
          三、基礎操作
          1、安裝linux
          安裝過程中一些需要注意的地方:
          1)磁盤分區(qū):swap分區(qū)大小建議是內(nèi)存的2倍,這里是1024MB,劃出一些系統(tǒng)必要的分區(qū)根分區(qū)/,var分區(qū)/var,usr分區(qū)/usr, home分區(qū)/home,臨時文件分區(qū)/tmp。注意:這里不要把所有的硬盤空間劃分進操作系統(tǒng),留下一半給后面安裝oarcle集群磁盤使用,本文示例
          2)文件系統(tǒng) 容量 掛載點
          /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兩項,為了節(jié)省空間其他可以不要
          4)防火墻:最好不要
          5)網(wǎng)絡設置:eth0
          取消選中 [Configure using DHCP] 復選項
          選中 [Activate on boot]
          IP 地址:10.15.0.14
          網(wǎng)絡掩碼: 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)技術,這是一個令人心動的高可用性、多機無縫切換的解決方案,但在單機模擬環(huán)境中僅僅是個形式而已,為了以后的順利安裝,不得不配置它
          確保RAC節(jié)點名沒有出現(xiàn)在回送地址中
          根據(jù)網(wǎng)上的安裝方案是這樣做的,但我試了幾次都有問題,總報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、調(diào)整內(nèi)核網(wǎng)絡設置參數(shù)
          編輯/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、創(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)上的說明,感覺這么多參數(shù)實在是沒必要
          6、創(chuàng)建CRS分區(qū)和數(shù)據(jù)文件分區(qū)
          1)先建立CRS分區(qū)掛載點
          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個區(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)每次重新啟動的時候都能自動加載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é)點以進行遠程訪問
          在 RAC 節(jié)點上運行 Oracle Universal Installer 時,它將使用 rsh 、rcp或scp命令將 Oracle 軟件復制到 RAC 集群中的所有其他節(jié)點。雖然是單機模擬,但仍然要配置,無法跳過,從oracle 10g開始已經(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
          復制公匙到其他節(jié)點(這里是單機)
          [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]$
          無需密碼即可登陸表示密匙已經(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
          否則同樣會報ssh不能連接的錯誤,可以通過在主機的圖型界面里的命令窗口中運行檢查是否有錯.(參看http://blog.itpub.net/post/126/4684)

          9、安裝和配置 OCFS2
          OCFS2是Oracle 集群文件系統(tǒng) (OCFS2),由 Oracle 開發(fā),用于消除數(shù)據(jù)庫管理員和系統(tǒng)管理員管理原始設備這一負擔,它提供了與通常的文件系統(tǒng)相同的功能和用法。盡量不要在OCFS文件系統(tǒng)上使用linux二進制文件系統(tǒng)操作命令
          在目前的版本1種支持以下文件類型:
          Oracle 數(shù)據(jù)庫文件
          聯(lián)機重做日志文件
          歸檔重做日志文件
          控制文件
          服務器參數(shù)文件 (SPFILE)
          Oracle 集群注冊表 (OCR) 文件
          CRS 表決磁盤。

          安裝和配置
          1)上傳rpm包
          2)執(zhí)行rpm -ivh ocfs*.rpm 開始安裝
          3)生成并配置/etc/ocfs.conf文件
          root@dbrac ocfs]# ocfsconsole &
          4)使用 ocfsconsole GUI 工具執(zhí)行以下步驟:
          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
          這樣繼續(xù)上面的操作,會彈出node configureation窗口,這樣就可以設置了
          按add,在add node窗口里填寫
          name dbrac
          ip address: 10.15.0.14
          ip port:7777(default)
          然后點擊apply,再點[cluster]-[propagate configuration]
          然后點[Tasks]-[Format]來格式化剛才創(chuàng)建的盤,此處使用/dev/hda11
          格式化好以后,點左上角的mount到開始建的/u01,
          驗證所有節(jié)點上的所有值正確之后,請退出應用程序
          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)重新啟動系統(tǒng)并確認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屬主不對,還要修改一下
          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 數(shù)據(jù)庫 10g 中引入了 ASM,使管理員不必再管理單個文件和驅(qū)動器,ASM 被內(nèi)置到 Oracle 內(nèi)核中,通過它,數(shù)據(jù)庫管理員可以全天候管理單個實例以及集群實例的上千個磁盤驅(qū)動器。本文將使用ASM來自動存儲和管理所有 Oracle 物理數(shù)據(jù)庫文件(數(shù)據(jù)、聯(lián)機重做日志、控制文件、歸檔重做日志)。
          oracle不推薦使用裸設備,因此這里使用前面創(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三個軟件包到/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 共享數(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磁盤的卷標
          列出ASM磁盤的命令是/etc/init.d/oracleasm listdisks
          刪除ASM磁盤得命令是/etc/init.d/oracleasm deltedisk ORADATA(注意:此處大寫)
          /etc/init.d/oraclerasm scandisk命令用于其它節(jié)點上掃描并識別新卷,由于此處是單機,所以這里不需要執(zhí)行。
          五、安裝oracle 10g集群服務軟件
          從這里開始,建議所有的安裝過程全部使用英文界面安裝,在簡體中文環(huán)境下安裝會有問題,如果安裝操作系統(tǒng)的時候選擇了默認語言為簡體中文,請更改/etc/sysconfig/i18n文件中LANG的值,然后重新登陸系統(tǒng)。
          LANG="en_US.UTF-8"
          在附錄本文會給出全中文環(huán)境數(shù)據(jù)庫安裝解決方案
          1)上傳10201_clusterware_linux32.zip到/home/oracle/install/rac目錄中并解壓縮;
          unzip 10201_clusterware_linux32.zip
          2)在安裝過程中oracle 10g集群服務軟件會在CRS分區(qū)創(chuàng)建2個文件,分別是/u01/orcl/ocrfile和/u01/orcl/cssfile,相當重要,不能跳過;檢查/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 &開始安裝;
          屏幕名稱
          回應
          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”用戶帳戶打開一個新的控制臺窗口。轉(zhuǎn)到/home/oracle/product/10.1.0/crs_1目錄,運行root.sh。 返回 OUI 并確認此對話框窗口。

          5)核實CRS安裝
          a)檢查集群節(jié)點
          [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數(shù)據(jù)庫軟件
          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開始安裝
          屏幕名稱
          回應
          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”用戶帳戶打開一個新的控制臺窗口。轉(zhuǎn)到/home/oracle/product/10.1.0/db_1目錄,運行root.sh程序。
          當 VIPCA 出現(xiàn)時,請回應如下所示的屏幕提示:
          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)的時候選擇了默認語言支持是簡體中文,請在執(zhí)行root.sh之前先取消root中文環(huán)境設置,命令export LANG=zh_CN.EUC
          End of installation
          安裝結束時,退出 OUI
          我在安裝過程中沒有自動出現(xiàn)vipca,直接運行也不成,但重起后可以運行了,不知道什么原因。
          問題2。


          七、創(chuàng)建 TNS 監(jiān)聽器進程
          DBCA 需要在 RAC 集群的所有節(jié)點上配置并運行 Oracle TNS 監(jiān)聽器進程,然后它才能創(chuàng)建集群化數(shù)據(jù)庫。
          $export LANG=zh_CN.EUC
          $ netca &
          屏幕名稱
          回應
          Select the Type of Oracle
          Net Services Configuration
          選擇 Cluster Configuration
          Select the nodes to configure
          選擇節(jié)點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。
          只產(chǎn)生了listener一個,沒有生成listener_dbrac,而且listener里有一行信息覺得有錯,注釋了以后在安裝數(shù)據(jù)庫時才通過。
          問題3。

          測試
          [oracle@dbrac oracle]$ ps -ef | grep lsnr | grep -v 'grep' | grep -v 'ocfs' | awk '{print $9}'
          LISTENER_DBRAC
          八、創(chuàng)建oracle集群數(shù)據(jù)庫
          1)在執(zhí)行 DBCA 前,請確保為 $ORACLE_BASE/product/10.1.0/db_1 環(huán)境正確設置了 $ORACLE_HOME 和 $PATH。
          2)在試圖開始創(chuàng)建集群化數(shù)據(jù)庫之前,還應確保已安裝的所有服務(Oracle TNS 監(jiān)聽器、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創(chuàng)建ASM,在彈出的Create Disk Group窗口中,Disk Group Name: orcl_data;選擇“Select Member Disks”窗口中的ASM 卷ORCL:ORADATA,并確保狀態(tài)為PROVISIONED,最后單擊ok完成,如果不能格式化,請選擇redundancy為external
          Database File Locations
          選擇使用默認值Oracle Managed Files
          Database Area: +ORCL_DATA
          Recovery Configuration
          選擇默認Flash Recovery Area,如果要使用傳統(tǒng)歸檔方式,請選擇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不認一開始建立的分區(qū)。所以只好使用cluster文件系統(tǒng),也就是使用本地硬盤了.
          問題4。
          3)完成DBCA后,一個單節(jié)點集群的oracle數(shù)據(jù)庫服務器已經(jīng)成功創(chuàng)建了
          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是否已經(jī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ù)庫
          在裝有oracle 10g 客戶端的pc上執(zhí)行下面的命令進行連接測試,客戶端需要配置TNS,配置的時候把服務名指定為orcltest,數(shù)據(jù)庫服務器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
          已連接。

          在服務器上執(zhí)行下面的命令
          [oracle@dbrac oracle]$ srvctl status database -d orcl
          例程 orcl1 正在節(jié)點 dbrac 上運行

          [oracle@dbrac oracle]$ srvctl status nodeapps -n dbrac
          VIP 正在運行的節(jié)點: dbrac
          GSD 正在運行的節(jié)點: dbrac
          監(jiān)聽程序正在節(jié)點上運行: dbrac
          ONS 守護程序正在節(jié)點上運行:dbrac
          [oracle@dbrac oracle]$ srvctl status asm -n dbrac
          ASM 例程 +ASM1 正在節(jié)點 dbrac 上運行。

          顯示數(shù)據(jù)庫配置
          [oracle@dbrac oracle]$ srvctl config database -d orcl
          dbrac orcl1 /home/oracle/product/10.1.0/db_1
          scrctl命令還有很多測試功能,這里不再一一介紹

          十、啟動和停止集群
          這里很重要,和一般的非集群數(shù)據(jù)庫的啟動和關閉有點不同.
          1)停止 Oracle RAC 10g 環(huán)境
          先停止 Oracle 實例。當此實例(和相關服務)關閉后,關閉 ASM 實例。最后,關閉節(jié)點應用程序(虛擬 IP、GSD、TNS 監(jiān)聽器和 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 環(huán)境
          第一步是啟動節(jié)點應用程序(虛擬 IP、GSD、TNS 監(jiān)聽器和 ONS)。當成功啟動節(jié)點應用程序后,啟動 ASM 實例。最后,啟動 Oracle 實例(和相關服務)以及企業(yè)管理器數(shù)據(jù)庫控制臺。
          $ 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

          本文轉(zhuǎn)自:http://www.linuxmine.com/3508.html


          ---------------------------------------------------------------------------------------------------------------------------------
          說人之短,乃護己之短。夸己之長,乃忌人之長。皆由存心不厚,識量太狹耳。能去此弊,可以進德,可以遠怨。
          http://www.aygfsteel.com/szhswl
          ------------------------------------------------------------------------------------------------------ ----------------- ---------
          posted on 2007-12-05 13:28 宋針還 閱讀(782) 評論(0)  編輯  收藏 所屬分類: ORACLE
          主站蜘蛛池模板: 北海市| 海晏县| 罗甸县| 漠河县| 香港| 普格县| 新干县| 正安县| 湟中县| 阿拉善盟| 绥宁县| 遵义市| 平南县| 通江县| 山西省| 阳高县| 阳城县| 北辰区| 马关县| 江达县| 贵德县| 灌阳县| 沾化县| 磐石市| 缙云县| 商洛市| 高密市| 吴桥县| 清远市| 云和县| 炉霍县| 广宗县| 九江市| 盐源县| 通渭县| 客服| 霍邱县| 福鼎市| 泽普县| 宁晋县| 牙克石市|