溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

發(fā)布時間:2020-08-11 09:36:04 來源:ITPUB博客 閱讀:316 作者:雙魚的地下書院 欄目:關(guān)系型數(shù)據(jù)庫


【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝





1.1    簡介    


1.1.1    ASMLib    

1.1.2    什么是 udev    

1.1.3    Why ASMLIB and why not

1.2    在 RHEL 6.4 上安裝 Oracle 11gR2 + ASM --使用udev

1.2.1    檢查硬件    

1.2.2    安裝軟件包檢查    

1.2.3    修改主機名    

1.2.4    網(wǎng)絡(luò)配置    

1.2.5    磁盤準備    

1.2.6    配置目錄、用戶等    

1.2.7    使用udev管理磁盤    

1.2.8    系統(tǒng)內(nèi)核參數(shù)修改    

1.2.9    為 Linux 系統(tǒng)配置本地 YUM 源    

1.2.10    安裝grid    

1.2.11    使用netmgr建立監(jiān)聽    

1.2.12    開始搭建 Oracle 數(shù)據(jù)庫    

1.2.13    使用 netmgr 建立監(jiān)聽--Oracle用戶不需要創(chuàng)建    

1.2.14    使用 dbca 創(chuàng)建數(shù)據(jù)庫    

1.2.15    配置ORACLE自動啟動    

1.2.16    驗證    

1.3    啟動crs    

1.4    報錯:

1.4.1    Oracle 11gR2 RAC ohasd failed to start 解決方法    

1.4.2    CRS-4639: Could not contact Oracle High Availability Services    

1.4.3    ORA-29701: unable to connect to Cluster Synchronization Service    

1.4.4    asm 實例無法加載diskgroups,ORA-15110: no diskgroups mounted    

1.4.5    在啟動DB時報錯ORA-27154 ORA-27300 ORA-27301 ORA-27302    

1.4.6    ORA-29786: SIHA attribute GET failed    

1.4.7    11gR2手動創(chuàng)建ASM實例ORA-29786錯誤解決方法    

1.4.8    ORACLE dbca 找不到asm disks

1.4.9    ora-15077,ASM磁盤組不能掛載    



Readme

看到群上還有人糾結(jié)ASM的安裝,我很痛心,不過想想自己當時安裝的時候花了將近一周的時間才安裝好,主要是白天上班,又沒有網(wǎng)絡(luò),所以只好晚上安裝了,自己開始安裝的時候是11.2.0.1.0,這個版本安裝有很多bug,雖然安裝成功了但是很痛苦,后來參加OCP培訓,老師給了11.2.0.3.0版本,安裝的時候很順利,沒有報錯了。

第一次安裝的時候,涉及到ASMlib,udev神馬的一堆,學習Oracle沒有好的導師痛苦呀,最后經(jīng)過大量百度,自己摸索才把這一推問題解決了。大家看這篇博文的時候注意文檔的層次結(jié)構(gòu),很郁悶,發(fā)表博文不能很好的把文章結(jié)構(gòu)發(fā)出來。。。文章最后收錄了一些安裝過程中可能會出現(xiàn)的一些問題,供大家參考,如果有什么意見請大家留言或加QQ,謝謝大家的來訪。

  1. 簡介

    1. ASMLib

在Red Hat Enterprise Linux (RHEL)6以前,Oracle均是使用ASMLib這個內(nèi)核支持庫配置ASM。ASMLIB是一種基于Linux module,專門為Oracle Automatic Storage Management特性設(shè)計的內(nèi)核支持庫(kernel support library)。但是,在2011年5月,甲骨文發(fā)表了一份Oracle數(shù)據(jù)庫ASMLib的聲明,聲明中稱甲骨文將不再提供Red Hat Enterprise Linux (RHEL)6的ASMLib和相關(guān)更新。

甲骨文在這份聲明中表示,ASMLib更新將通過Unbreakable Linux Network (ULN)來發(fā)布,并僅對Oracle Linux客戶開放。ULN雖然為甲骨文和紅帽的客戶服務(wù),但如果客戶想要使用ASMlib,就必須使用Oracle的kernel來替換掉紅帽的。

這份聲明詳見Oracle Metalink文檔:

Oracle ASMLib Software Update Policy for Red Hat Enterprise Linux Supported by Red Hat [ID 1089399.1]

Software Update Policy for ASMLib running on future releases of Red Hat Enterprise Linux Red Hat Enterprise Linux 6 (RHEL6)For RHEL6 or Oracle Linux 6, Oracle will only provide ASMLib software and updates when configuredUnbreakable Enterprise Kernel (UEK). Oracle will not provide ASMLib packages for kernels distributedby Red Hat as part of RHEL 6 or the Red Hat compatible kernel in Oracle Linux 6. ASMLib updates will be delivered via Unbreakable Linux Network(ULN) which is available to customers with Oracle Linux support. ULN works with both Oracle Linux or Red Hat Linux installations, but ASMlib usage will require replacing any Red Hat kernel with UEK

因此,在Red Hat Enterprise Linux (RHEL)6上使用ASMLib已不再現(xiàn)實,另外ASMLib也有一定的缺點,詳見文檔說明:

http://www.oracledatabase12g.com/archives/why-asmlib-and-why-not.html

因此,目前在Red Hat Enterprise Linux (RHEL)6上使用Oracle+ASM,已不再使用ASMLib,而是采用udev設(shè)備文件來配置ASM。


  1. 什么是 udev

udev 是Linux2.6 內(nèi)核里的一個功能,它替代了原來的devfs,成為當前Linux 默認的設(shè)備管理工具。udev 以守護進程的形式運行,通過偵聽內(nèi)核發(fā)出來的uevent 來管理/dev目錄下的設(shè)備文件。不像之前的設(shè)備管理工具,udev 在用戶空間(user space) 運行,而不在內(nèi)核空間(kernel space) 運行。


  1. Why ASMLIB and why not?

ASMLIB是一種基于Linux module,專門為Oracle Automatic Storage Management特性設(shè)計的內(nèi)核支持庫(kernel support library)

長久以來我們對ASMLIB的認識并不全面,這里我們來具體了解一下使用ASMLIB的優(yōu)缺點。

理論上我們可以從ASMLIB API中得到的以下益處:

  • 總是使用direct,async IO
  • 解決了永久性設(shè)備名的問題,即便在重啟后設(shè)備名已經(jīng)改變的情況下
  • 解決了文件權(quán)限、擁有者的問題
  • 減少了I/O期間從用戶模式到內(nèi)核模式的上下文切換,從而可能降低cpu使用率
  • 減少了文件句柄的使用量
  • ASMLIB API提供了傳遞如I/O優(yōu)先級等元信息到存儲設(shè)備的可能

雖然從理論上我們可以從ASMLIB中得到性能收益,但實踐過程中這種優(yōu)勢是幾乎可以忽略的,沒有任何性能報告顯示ASMLIB對比Linux上原生態(tài)的udev設(shè)備管理服務(wù)有任何性能上的優(yōu)勢。在Oracle官方論壇上有一篇討論ASMLIB性能收益的帖子,你可以從中看到"asmlib wouldn't necessarily give you much of an io performance benefit, it's mainly for ease of management as it will find/discover the right devices for you, the io effect of asmlib is large the same as doing async io to raw devices."的評論,實際上使用ASMLIB和直接使用裸設(shè)備(raw device)在性能上沒有什么差別。

ASMLIB可能帶來的缺點:

  • 對于多路徑設(shè)備(multipathing)需要在/etc/sysconfig/oracleasm-_dev_oracleasm配置文件中設(shè)置ORACLEASM_SCANORDERORACLEASM_SCANEXCLUDE,以便ASMLIB能找到正確的設(shè)備文件,具體可以參考Metalink Note
  • 因為ASM INSTANCE使用ASMLIB提供的asm disk,所以增加了額外的層面
  • 每次Linux Kernel更新,都需要替換新的ASMLIB
  • 增加了因人為錯誤造成宕機downtime的可能
  • 使用ASMLIB意味著要花費更多時間去創(chuàng)建和維護
  • 因為ASMLIB的存在,可能引入更多的bug,這是我們最不想看到的
  • 使用ASMLIB創(chuàng)建的disk,其disk header并不會和普通的asm disk header有什么不同,僅僅是在頭部多出了ASMLIB的屬性空間。

結(jié)論:我個人的觀點是盡可能不要使用ASMLIB,當然這不是DBA個人所能決定的事情。另一方面這取決于個人習慣,rhel 4的早期發(fā)行版本中沒有提供udev這樣的設(shè)備管理服務(wù),這導致在rhel 4中大量的ASM+RAC組合的系統(tǒng)使用ASMLIB , 經(jīng)網(wǎng)友指出udev 作為kernel 2.6的新特性被引入,在rhel4的初始版本中就已經(jīng)加入了udev綁定服務(wù),但是在rhel4時代實際udev的使用并不廣泛(In Linux 2.6, a new feature was introduced to simplify device management and hot plug capabilities. This feature is called udev and is a standard package in RHEL4 or OracleEnterprise Linux 4 (OEL4) as well as Novell's SLES9 and SLES10.)。如果是在RHEL/OEL 5中那么你已經(jīng)有充分的理由利用udev而放棄ASMLIB。

Reference:ASMLIB Performance vs UdevRAC+ASM 3 years in production Stories to shareHow To Setup ASM & ASMLIB On Native Linux Multipath Mapper disks? [ID 602952.1]ASMLib and Linux block devices


  1. 在 RHEL 6.4 上安裝 Oracle 11gR2 + ASM --使用udev

實驗環(huán)境

OS: Oracle Linux Server release 6.4 x64 RHEL6.4

Database: Oracle Database 11gR2 x64 (11.2.0.1.0)

VMware: VMware Workstation 10.0.0 build-812388

軟件:

  1. xmanager-passive
  2. XSHELL


    1. 檢查硬件

    在正式安裝開始前,請先檢查你的軟硬件條件是否滿足安裝需要。

    硬件上可以使用命令查看內(nèi)存情況和 CPU 特性:

    #more /proc/meminfo

    #more /proc/cpuinfo

    其中內(nèi)存的要求是不低于 1G

    下面的不是必須的,可選使用

    #df –k /dev/shm 檢查共享內(nèi)存

    #df –k /tmp 檢查臨時磁盤空間

    #more /proc/version 檢查操作系統(tǒng)版本

    #uname –r 檢查內(nèi)核版本


    內(nèi)存

    # grep MemTotal /proc/meminfo

    交換空間

    # grep SwapTotal /proc/meminfo

    磁盤空間

    # df -ah

    # free

    #free -m



    Minimum: 1 GB of RAM


    Recommended: 2 GB of RAM or more

    ?

    To determine the RAM size, enter the following command:

    # grep MemTotal /proc/meminfo


    swap檢查



    Between 1 GB and 2 GB 1.5 times the size of the RAM

    Between 2 GB and 16 GB Equal to the size of the RAM

    More than 16 GB 16 GB

    # grep SwapTotal /proc/meminfo


    To determine the available RAM and swap space, enter the following command:


    # free -m



    ?The following tables describe the disk space requirements for software files and data files for each installation type on Linux x86:

    Installation Type Requirement for Software Files (GB)

    Enterprise Edition 3.95

    Standard Edition 3.88


    Installation Type Disk Space for Data Files (GB)

    Enterprise Edition 1.7

    Standard Edition 1.5


    [root@yutian ~]# cat /proc/version

    Linux version 2.6.18-164.el5 (mockbuild@x86-002.build.bos.redhat.com) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-46)) #1 SMP Tue Aug 18 15:51:54 EDT 2009

    [root@yutian ~]# lsb_release -id

    Distributor ID: RedHatEnterpriseServer

    Description: Red Hat Enterprise Linux Server release 5.4 (Tikanga)

    [root@yutian ~]#

    1. 安裝軟件包檢查


    可以統(tǒng)一檢查:

    rpm -q binutils \

    compat-libstdc++-33 \

    elfutils-libelf \

    gcc \

    gcc-c++ \

    glibc \

    glibc-common \

    glibc-devel \

    glibc-headers \

    ksh \

    libaio \

    libaio-devel \

    libgomp \

    libgcc \

    libstdc++ \

    libstdc++-devel \

    make \

    sysstat \

    unixODBC \

    unixODBC-devel \

    numactl-devel


    我們可以看到?jīng)]有安裝過的包會已is not installed 出現(xiàn):

    [root@rhel6_lhr ~]# rpm -q binutils \

    > compat-libstdc++-33 \

    > elfutils-libelf \

    > gcc \

    > gcc-c++ \

    > glibc \

    > glibc-common \

    > glibc-devel \

    > glibc-headers \

    > ksh \

    > libaio \

    > libaio-devel \

    > libgomp \

    > libgcc \

    > libstdc++ \

    > libstdc++-devel \

    > make \

    > sysstat \

    > unixODBC \

    > unixODBC-devel \

    > numactl-devel

    binutils-2.20.51.0.2-5.36.el6.x86_64

    compat-libstdc++-33-3.2.3-69.el6.x86_64

    compat-libstdc++-33-3.2.3-69.el6.i686

    elfutils-libelf-0.152-1.el6.x86_64

    gcc-4.4.7-4.el6.x86_64

    gcc-c++-4.4.7-4.el6.x86_64

    glibc-2.12-1.132.el6.x86_64

    glibc-common-2.12-1.132.el6.x86_64

    glibc-devel-2.12-1.132.el6.x86_64

    glibc-headers-2.12-1.132.el6.x86_64

    package ksh is not installed

    libaio-0.3.107-10.el6.x86_64

    libaio-devel-0.3.107-10.el6.x86_64

    libaio-devel-0.3.107-10.el6.i686

    libgomp-4.4.7-4.el6.x86_64

    libgcc-4.4.7-4.el6.x86_64

    libstdc++-4.4.7-4.el6.x86_64

    libstdc++-devel-4.4.7-4.el6.x86_64

    libstdc++-devel-4.4.7-4.el6.i686

    make-3.81-20.el6.x86_64

    sysstat-9.0.4-22.el6.x86_64

    unixODBC-2.2.14-12.el6_3.x86_64

    unixODBC-2.2.14-12.el6_3.i686

    unixODBC-devel-2.2.14-12.el6_3.i686

    unixODBC-devel-2.2.14-12.el6_3.x86_64

    package numactl-devel is not installed

    [root@rhel6_lhr ~]#


    如果部分包不存在

    可以批量更新安裝,但如果依賴關(guān)系缺失,可能需要多執(zhí)行兩遍

    或者手工調(diào)整







  3. 檢查下列包是否安裝,若未安裝則要先安裝:


    rpm -qa | grep binutils-

    rpm -qa | grep compat-libstdc++-

    rpm -qa | grep elfutils-libelf-

    rpm -qa | grep elfutils-libelf-devel-

    rpm -qa | grep glibc-

    rpm -qa | grep glibc-common-

    rpm -qa | grep glibc-devel-

    rpm -qa | grep gcc-

    rpm -qa | grep gcc-c++-

    rpm -qa | grep libaio- 

    rpm -qa | grep libaio-devel-

    rpm -qa | grep libgcc- 

    rpm -qa | grep libstdc++-

    rpm -qa | grep libstdc++-devel- 

    rpm -qa | grep make- 

    rpm -qa | grep sysstat-

    rpm -qa | grep unixODBC-

    rpm -qa | grep unixODBC-devel-


    binutils-2.17.50.0.6-2.el5 

    compat-libstdc++-33-3.2.3-61 

    elfutils-libelf-0.125-3.el5

    elfutils-libelf-devel-0.125

    glibc-2.5-12

    glibc-common-2.5-12 

    glibc-devel-2.5-12 

    gcc-4.1.1-52 

    gcc-c++-4.1.1-52

    libaio-0.3.106 

    libaio-devel-0.3.106 

    libgcc-4.1.1-52 

    libstdc++-4.1.1 

    libstdc++-devel-4.1.1-52.e15 

    make-3.81-1.1 

    sysstat-7.0.0 

    unixODBC-2.2.11 

    unixODBC-devel-2.2.11


    # rpm -qa | grep make gcc glibc compat openmotif21 setarch 等等


    建議你用 rpm –q packagename 逐個檢查,因為是官方要求,所以為了不在安裝時出現(xiàn)不必要的麻煩,還是確認都全部安裝為好。

    雖然我是全新安裝的系統(tǒng)也存在 3 個包沒安裝:Libaio-devel numactl-devel sysstat

     掛載 Linux 5 光盤,查找包的完整路徑名稱:

    [root@localhost ~]# mkdir /media/cdrom ; mount /dev/cdrom /media/cdrom

    [root@localhost ~]# ll /media/cdrom/Server/ |grep libaio-devel

    [root@localhost ~]# ll /media/cdrom/Server/ |grep numactl-devel

    [root@localhost ~]# ll /media/cdrom/Server/ |grep sysstat

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    安裝 RPM 包:

    [root@localhost ~]# rpm -ivh /media/cdrom/Server/libaio-devel-0.3.106-3.2.i386.rpm

    [root@localhost ~]# rpm -ivh /media/cdrom/Server/numactl-devel-0.9.8-7.el5.i386.rpm

    [root@localhost ~]# rpm -ivh /media/cdrom/Server/sysstat-7.0.2-3.el5.i386.rpm



    rpm -ivh compat-libstdc++-33-3.2.3-69.el6.i686.rpm --force --nodeps

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    [root@localhost RHEL_6.5 x86_64 Disc 1]# pwd

    /media/RHEL_6.5 x86_64 Disc 1

    [root@localhost RHEL_6.5 x86_64 Disc 1]#





    另外,為了支持 ODBC 建議順便安裝下面兩個包:

    unixODBC-2.2.11 (32 bit) or later

    unixODBC-devel-2.2.11 (32 bit) or later


    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝



    1. 修改主機名

    永久生效:

    [root@zijuan /]# vim /etc/sysconfig/network

    NETWORKING=yes

    NETWORKING_IPV6=yes

    HOSTNAME=zijuan


    HOSTNAME=zijuan表示主機設(shè)置為zijuan.

    注意:修改主機名后,需要重啟系統(tǒng)后生效,或者切換個用戶然后切換回來就OK



    查看/etc/hosts文件中必須包含a fully qualified name for the server

     [root@localhost lhr]# cat /etc/hosts

    127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4

    ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6

    192.168.128.131 rhel6_linux_asm

    [root@localhost lhr]# hostname

    localhost.localdomain

    [root@localhost lhr]# hostname rhel6.5_linux

    [root@localhost lhr]# hostname

    rhel6_linux_asm


    修改/etc/hosts文件

    [root@oracle ~]#vim/etc/hosts

    127.0.0.1 localhost.localdomainlocalhost

    ::1 localhost6.localdomain6localhost6

    192.168.137.112 oracle.domain.comoracle

    注意將主機名對應(yīng)到真實ip地址,否則oracle有可能將監(jiān)聽程序僅僅建立在127.0.0.1上

    1. 網(wǎng)絡(luò)配置

    如果要配置em的話,這里最后把系統(tǒng)的ip地址設(shè)置成靜態(tài)的ip地址,不然可能導致em訪問的時候改變了數(shù)據(jù)庫服務(wù)器的ip地址,從而導致其它問題的出現(xiàn),具體靜態(tài)ip地址配置參考( o()︿))o 唉。。。。這一塊內(nèi)容還沒有寫博客,大家可以百度或者私聊我)

    1. 磁盤準備


    這里我們準備5塊硬盤


    1塊硬盤安裝操作系統(tǒng)

    234塊用于實現(xiàn)ASM 存儲數(shù)據(jù)

    5塊硬盤用于存儲FRA




    1. 添加磁盤

    1.1. 編輯虛擬機配置

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    1.2. 添加硬件

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    1.3. 添加第一塊硬盤

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    1.4. 創(chuàng)建新的虛擬磁盤

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    1.5. 選擇磁盤類型

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    1.6. 設(shè)置磁盤大小

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    1.7. 完成

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    1.8.

    添加第二、三、四、五塊磁盤:重復(fù)步驟 1~7

    1.9.

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    這里5塊磁盤添加完畢后,為了避免后邊再重啟一次,可以先把后邊需要的一個步驟做了,就是找到虛擬機的配置文件,在最后添加一行 disk.EnableUUID="TRUE",這里注意修改文件的時候一定要在關(guān)機的狀態(tài)下修改該參數(shù)文件。

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    1. 對磁盤進行分區(qū)

    磁盤添加完成后,啟動虛擬機,作為 root 用戶登錄系統(tǒng),格式化新添加的兩塊磁盤。

    [root@localhost share]# fdisk -l | grep "Disk /dev/sd"

    Disk /dev/sde: 10.7 GB, 10737418240 bytes

    Disk /dev/sdd: 10.7 GB, 10737418240 bytes

    Disk /dev/sda: 53.7 GB, 53687091200 bytes

    Disk /dev/sdb: 10.7 GB, 10737418240 bytes

    Disk /dev/sdc: 10.7 GB, 10737418240 bytes

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    磁盤分區(qū)完成后,查看所有磁盤情況。

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    注意這里只做磁盤的分區(qū),并不做磁盤的格式化和掛載

    1. 配置目錄、用戶等


    1. 配置用戶及用戶組

    利用 /usr/sbin/groupadd 命令


    ------這里Oracle用戶可能已經(jīng)安裝過的,沒有影響:

    代碼:

    groupadd oinstall

    groupadd dba

    groupadd oper

    groupadd asmadmin

    groupadd asmoper

    groupadd asmdba


    --添加用戶到組

    useradd -g oinstall -G dba,asmdba,oper,asmadmin oracle

    useradd -g oinstall -G asmadmin,asmdba,asmoper,dba grid


    --修改密碼

    passwd oracle

    passwd grid


    echo oracle | passwd --stdin lhr

    echo grid | passwd --stdin lhr


    ---查看屬主

    [root@rhel_linux_asm ~]# id oracle

    uid=501(oracle) gid=502(dba) groups=502(dba),501(oinstall),504(asmadmin),506(asmdba)

    [root@rhel_linux_asm ~]# id grid

    uid=502(grid) gid=501(oinstall) groups=501(oinstall),502(dba),504(asmadmin),505(asmoper),506(asmdba)

    [root@rhel_linux_asm ~]#

    1. 創(chuàng)建目錄并且配置 grid 和 oracle 用戶的配置文件

    代碼:

    --root用戶下:

    mkdir -p /u01/app/oracle

    mkdir -p /u01/app/grid

    mkdir -p /u01/app/grid/11.2.0

    chown -R grid:oinstall /u01/app/grid --/u01/app/grid 的所有者改為grid

    chown -R oracle:oinstall /u01/app/oracle

    chmod -R 775 /u01


    --------Oracle User----切換到Oracle用戶下------

    [root@rhel_linux_asm ~]# su - oracle

    [grid@rhel_linux_asm ~]$ vi ~/.bash_profile

    export ORACLE_SID=orcl

    export ORACLE_BASE=/u01/app/oracle

    export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1

    export LD_LIBRARY_PATH=$ORACLE_HOME/lib

    export TMP=/tmp

    export TMPDIR=$TMP

    export PATH=$PATH:$ORACLE_HOME/bin


    --------Grid User-----切換到grid用戶下-----


    cd /home/grid

    vim .bash_profile

    export ORACLE_SID=+ASM

    export ORACLE_BASE=/u01/app/grid

    export ORACLE_HOME=/u01/app/grid/11.2.0

    export LD_LIBRARY_PATH=$ORACLE_HOME/lib

    export PATH=$ORACLE_HOME/bin:$PATH

    umask 022


    [oracle@dbserver1 ~]$ source .bash_profile


    1. 使用udev管理磁盤


    1. 配置 udev 綁定的 scsi_id

    注意以下兩點:

    首先切換到root用戶下:

    5.1. 不同的操作系統(tǒng),scsi_id 命令的位置不同。

    [root@localhost ~]# cat /etc/issue

    Oracle Linux Server release 6.4

    Kernel \r on an \m


    [root@localhost ~]# which scsi_id

    /sbin/scsi_id

    [root@localhost ~]#

    5.2. 編輯 /etc/scsi_id.config 文件,如果該文件不存在,則創(chuàng)建該文件并添加如下行:

    [root@localhost ~]# vi /etc/scsi_id.config

    options=--whitelisted --replace-whitespace

    [root@localhost ~]#

    5.3. 如果是使用 VMware 虛擬機,直接輸入 scsi_id 命令可能無法獲取 id,需修改 VMware 文件參數(shù),這一步如果在添加磁盤的時候做過這一步的話就可以跳過了,直接獲取uuid即可

    [root@localhost ~]# scsi_id --whitelisted --replace-whitespace --device=/dev/sdb

    [root@localhost ~]# scsi_id --whitelisted --replace-whitespace --device=/dev/sdc

    D:\VMs\Oracle Database 11gR2\Oracle Database 11gR2.vmx

    使用文本編輯器編輯該文件,在尾部新增一行參數(shù):

    disk.EnableUUID="TRUE"

    保存文件,重新啟動虛擬機。這里注意修改文件的時候一定要在關(guān)機的狀態(tài)下修改,或者 scsi_id -g -u /dev/sdc 來獲得uuid-g -u參數(shù)在rhel6以后已經(jīng)不用了

    [root@localhost share]# scsi_id --whitelisted --replace-whitespace --device=/dev/sdb

    36000c29fbe57659626ee89b4fba07616

    [root@localhost share]# scsi_id --whitelisted --replace-whitespace --device=/dev/sdc

    36000c29384cde894e087e5f0fcaa80f4

    [root@localhost share]# scsi_id --whitelisted --replace-whitespace --device=/dev/sdd

    36000c29022aee23728231ed9b1f9743d

    [root@localhost share]# scsi_id --whitelisted --replace-whitespace --device=/dev/sde

    36000c2938f431664218d1d2632ff1352

    1. 創(chuàng)建并配置 udev rules 文件

    [root@localhost ~]# vi /etc/udev/rules.d/99-oracle-asmdevices.rules

    KERNEL=="sd*", SUBSYSTEM=="block", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="36000c29fe0fc917d7e9982742a28ce7c", NAME="asm-diskb", OWNER="grid",GROUP="asmadmin", MODE="0660"

    KERNEL=="sd*", SUBSYSTEM=="block", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="36000c293ffc0900fd932348de4b6baf8", NAME="asm-diskc", OWNER="grid",GROUP="asmadmin", MODE="0660"


    根據(jù)步驟 5 獲取的 ID 修改 RESULT 值

    這里需要注意,一個KERNEL就是一行,不能換行的,我之前就是犯了這個錯誤的

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    添加4塊硬盤:

    KERNEL=="sd*", SUBSYSTEM=="block", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="36000c29346c1344ffb26f0e5603d519e", NAME="asm-diskb", OWNER="grid",GROUP="asmadmin", MODE="0660"

    KERNEL=="sd*", SUBSYSTEM=="block", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="36000c29d08ee059a345571054517cd03", NAME="asm-diskc", OWNER="grid",GROUP="asmadmin", MODE="0660"

    KERNEL=="sd*", SUBSYSTEM=="block", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="36000c295037a910bfb765af8f400aa07", NAME="asm-diskd", OWNER="grid",GROUP="asmadmin", MODE="0660"

    KERNEL=="sd*", SUBSYSTEM=="block", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="36000c2982bda048f642acd3c429ec983", NAME="asm-diske", OWNER="grid",GROUP="asmadmin", MODE="0660"

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝



    注意:這里的GROUP="asmadmin", 最好修改成 GROUP="asmdba",不然最后可能用dbca創(chuàng)建數(shù)據(jù)庫實例的時候找不見磁盤組。

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    1. 添加完成后,重啟 udev,不同 Linux 發(fā)行版本重啟方式不一樣。

    該步驟慢一點,大約可能需要30秒左右吧,等等等等。。。。。。

    [root@localhost ~]# start_udev

    Starting udev: [ OK ]

    [root@localhost ~]#

    1. 查看綁定的 asm,如果此時還是看不到 asm disk,請重啟操作系統(tǒng)后再查看。

    [root@localhost ~]# ll /dev/asm*

    brw-rw---- 1 grid asmadmin 8, 17 Oct 17 14:26 /dev/asm-diskb

    brw-rw---- 1 grid asmadmin 8, 33 Oct 17 14:26 /dev/asm-diskc

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝


    1. 系統(tǒng)內(nèi)核參數(shù)修改

      1. 編輯 /etc/security/limits.conf 文件,在文件尾部添加如下內(nèi)容:

    [root@localhost ~]# tail -8 /etc/security/limits.conf

    # add by lhr for oracle and grid on 2014-05-02

    oracle soft nproc 2047

    oracle hard nproc 16384

    oracle soft nofile 1024

    oracle hard nofile 65536

    grid soft nproc 2047

    grid hard nproc 16384

    grid soft nofile 1024

    grid hard nofile 65536

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    1. 編輯 /etc/pam.d/login 文件,在文件尾部添加如下內(nèi)容:

    [root@localhost ~]# tail -1 /etc/pam.d/login

    session required pam_limis.so

    [root@localhost ~]#

    1. 編輯 /etc/profile 文件,設(shè)置 shell 限制,在文件尾部添加如下內(nèi)容:

    [root@localhost ~]# tail -9 /etc/profile

    if [ /$USER = "oracle" ] || [ /$USER = "grid" ]; then

    if [ /$SHELL = "/bin/ksh" ]; then

    ulimit -p 16384

    ulimit -n 65536

    else

    ulimit -u 16384 -n 65536

    fi

    umask 022

    fi


    1. /etc/sysctl.conf

    Configuring Kernel Parameters for Linux


    vim /etc/sysctl.conf

    fs.aio-max-nr = 1048576

    fs.file-max = 6815744

    kernel.shmall = 2097152

    kernel.shmmax = 4294967295

    kernel.shmmni = 4096

    kernel.sem = 250 32000 100 128

    net.ipv4.ip_local_port_range = 9000 65500

    net.core.rmem_default = 262144

    net.core.rmem_max = 4194304

    net.core.wmem_default = 262144

    net.core.wmem_max = 1048576


    生效

    # /sbin/sysctl -p




    1. 安裝grid


    1. 通過 ZMODEM 上傳文件 linux.x64_11gR2_grid.zip 至grid用戶家目錄 /home/grid/


    這步當然也可以使用其它軟件來替代上傳軟件包:

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    [root@localhost ~]# ll /home/grid/

    total 1028228

    -rw-r--r-- 1 root root 1052897657 Oct 16 13:22 linux.x64_11gR2_grid.zip

    [root@localhost ~]#

    1. 解壓文件

    [root@localhost grid]# unzip linux.x64_11gR2_grid.zip

    [root@localhost grid]# ll

    total 1028232

    drwxr-xr-x 8 root root 4096 Aug 21 2009 grid

    -rw-r--r-- 1 root root 1052897657 Oct 16 13:22 linux.x64_11gR2_grid.zip

    [root@localhost grid]#

    1. 作為 grid 用戶登錄系統(tǒng),執(zhí)行安裝程序。
      1. 日志

    安裝過程中的日志生成地址:

    /u01/app/oraInventory/logs/installActions2014-06-14_10-32-53PM.log




    16.1. 檢查安裝腳本是否具有可執(zhí)行權(quán)限

    [grid@localhost grid]$ id

    uid=501(grid) gid=500(oinstall) groups=500(oinstall),501(dba),503(asmadmin),504(asmoper),505(asmdba)

    [grid@localhost grid]$ ll runInstaller

    -rwxr-xr-x 1 root root 3227 Aug 15 2009 runInstaller

    [grid@localhost grid]$

    如果無可執(zhí)行權(quán)限,執(zhí)行以下命令進行授權(quán):

    [root@localhost ~]# chown -R grid:oinstall /home/grid/grid/

    [root@localhost ~]# ll /home/grid/grid/runInstaller

    -rwxr-xr-x 1 grid oinstall 3227 Aug 15 2009 /home/grid/grid/runInstaller

    [root@localhost ~]#


    16.2. 執(zhí)行安裝腳本 /home/grid/grid/runInstaller

    首先打開Xmanager - Passive 軟件,然后在 Xshell 會話設(shè)置如下:

    [grid@rhel_linux_asm grid]$ clear

    [grid@rhel_linux_asm grid]$ export DISPLAY=192.168.1.100:0.0 ---這里的ip地址就是本機的ip地址(ipconfig)

    [grid@rhel_linux_asm grid]$ xhost +

    access control disabled, clients can connect from any host

    [grid@rhel_linux_asm grid]$ ls

    doc install response rpm runcluvfy.sh runInstaller sshsetup stage welcome.html

    [grid@rhel_linux_asm grid]$ ./runInstaller

    Starting Oracle Universal Installer...


    Checking Temp space: must be greater than 120 MB. Actual 31642 MB Passed

    Checking swap space: must be greater than 150 MB. Actual 383 MB Passed

    Checking monitor: must be configured to display at least 256 colors. Actual 16777216 Passed

    Preparing to launch Oracle Universal Installer from /tmp/OraInstall2014-04-29_10-53-18PM. Please wait ...[grid@rhel_linux_asm grid]$


    截圖如下:

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝


    17. 安裝過程

    [grid@localhost ~]$ /home/grid/grid/runInstaller

    Starting Oracle Universal Installer...


    Checking Temp space: must be greater than 120 MB. Actual 38826 MB Passed

    Checking swap space: must be greater than 150 MB. Actual 4095 MB Passed

    Checking monitor: must be configured to display at least 256 colors. Actual 16777216 Passed

    Preparing to launch Oracle Universal Installer from /tmp/OraInstall2013-10-17_03-31-41PM. Please wait ...[grid@localhost ~]$

    17.1.

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    17.2.

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    17.3.

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    17.4.

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝 17.5.

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    17.6.

    17.6.1. 檢查安裝條件

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    17.6.2.

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    執(zhí)行修復(fù)腳本:

    [root@localhost ~]# /tmp/CVU_11.2.0.1.0_grid/runfixup.sh

    Response file being used is :/tmp/CVU_11.2.0.1.0_grid/fixup.response

    Enable file being used is :/tmp/CVU_11.2.0.1.0_grid/fixup.enable

    Log file location: /tmp/CVU_11.2.0.1.0_grid/orarun.log

    Setting Kernel Parameters...

    kernel.sem = 250 32000 100 128

    fs.file-max = 6815744

    net.ipv4.ip_local_port_range = 9000 65500

    net.core.rmem_default = 262144

    net.core.wmem_default = 262144

    net.core.rmem_max = 4194304

    net.core.wmem_max = 1048576

    fs.aio-max-nr = 1048576


    17.6.3. 安裝缺失軟件包

    # yum install -y package_name

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    這些軟件包其實已安裝,只不過因為 Oracle Linux 6.4 自帶的軟件包版本高于檢查版本,所以檢查不通過,忽略即可。

    Oracle Linux 6.4 的安裝光盤中無 pdksh 軟件包,安裝 ksh 軟件包即可。

    # yum install -y ksh

    因為沒有 NTP 時鐘服務(wù)器,所以 NTP 檢查不通過,忽略即可。

    17.6.4.

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    17.7.

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    17.8.

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    17.9. 安裝時間較長,請耐心等待。

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    1. 最后的執(zhí)行腳本步驟

    安裝過程中會彈出對話框,提示你以 root 身份執(zhí)行兩個腳本:

    [root@localhost ~]# /u01/app/oraInventory/orainstRoot.sh

    Changing permissions of /u01/app/oraInventory.

    Adding read,write permissions for group.

    Removing read,write,execute permissions for world.


    Changing groupname of /u01/app/oraInventory to oinstall.

    The execution of the script is complete.

    [root@localhost ~]# /u01/app/11.2.0/grid/root.sh

    Running Oracle 11g root.sh script...


    The following environment variables are set as:

    ORACLE_OWNER= grid

    ORACLE_HOME= /u01/app/11.2.0/grid


    Enter the full pathname of the local bin directory: [/usr/local/bin]: -- 輸入回車

    Copying dbhome to /usr/local/bin ...

    Copying oraenv to /usr/local/bin ...

    Copying coraenv to /usr/local/bin ...


    Creating /etc/oratab file...

    Entries will be added to the /etc/oratab file as needed by

    Database Configuration Assistant when a database is created

    Finished running generic part of root.sh script.

    Now product-specific root actions will be performed.

    To configure Grid Infrastructure for a Stand-Alone Server run the following command as the root user: -- 單實例安裝需執(zhí)行以下腳本

    /u01/app/11.2.0/grid/perl/bin/perl -I/u01/app/11.2.0/grid/perl/lib -I/u01/app/11.2.0/grid/crs/install /u01/app/11.2.0/grid/crs/install/roothas.pl



    To configure Grid Infrastructure for a Cluster perform the following steps:

    1. Provide values for Grid Infrastructure configuration parameters in the file - /u01/app/11.2.0/grid/crs/install/crsconfig_params. For details on how to do this, see the installation guide.

    2. Run the following command as the root user:

    /u01/app/11.2.0/grid/perl/bin/perl -I/u01/app/11.2.0/grid/perl/lib -I/u01/app/11.2.0/grid/crs/install /u01/app/11.2.0/grid/crs/install/rootcrs.pl

    To update inventory properties for Grid Infrastructure, perform the following

    steps. If a pre-11.2 home is already configured, execute the following:

    11.2_Home/oui/bin/runInstaller -updateNodeList -silent -local CRS=false ORACLE_HOME=pre-11.2_Home

    Always execute the following to register the current home:

    11.2_Home/oui/bin/runInstaller -updateNodeList -silent -local CRS=true ORACLE_HOME=11.2_Home.

    If either home is shared, provide the additional argument -cfs.

    截圖如下:

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝


    下邊按照要求執(zhí)行腳本:

    [root@localhost ~]# /u01/app/11.2.0/grid/perl/bin/perl -I/u01/app/11.2.0/grid/perl/lib -I/u01/app/11.2.0/grid/crs/install /u01/app/11.2.0/grid/crs/install/roothas.pl

    2013-10-17 16:18:19: Checking for super user privileges

    2013-10-17 16:18:19: User has super user privileges

    2013-10-17 16:18:19: Parsing the host name

    Using configuration parameter file: /u01/app/11.2.0/grid/crs/install/crsconfig_params

    Creating trace directory

    /u01/app/11.2.0/grid/bin/clscfg.bin: error while loading shared libraries: libcap.so.1: cannot open shared object file: No such file or directory -- 報錯

    Failed to create keys in the OLR, rc = 32512, 32512

    OLR configuration failed

    [root@localhost ~]#

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝


    解決報錯:

    17.9.1. 檢查操作系統(tǒng)中 libcap.so 是否已安裝

    如果是 64 位系統(tǒng),i686 x86_64 都要安裝。

    # yum install -y libcap*.i686

    # yum install -y libcap*.x86_64

    [root@localhost ~]# rpm -qa | grep libcap

    libcap-ng-0.6.4-3.el6_0.1.i686

    libcap-2.16-5.5.el6.x86_64

    libcap-devel-2.16-5.5.el6.x86_64

    libcap-devel-2.16-5.5.el6.i686

    libcap-ng-0.6.4-3.el6_0.1.x86_64

    libcap-2.16-5.5.el6.i686

    libcap-ng-devel-0.6.4-3.el6_0.1.i686

    libcap-ng-devel-0.6.4-3.el6_0.1.x86_64

    [root@localhost ~]#

    17.9.2. 檢查 libcap.so 文件

    [root@localhost ~]# ll /lib64/libcap.so*

    lrwxrwxrwx 1 root root 11 Oct 17 16:28 /lib64/libcap.so -> libcap.so.2

    lrwxrwxrwx. 1 root root 14 Oct 16 15:22 /lib64/libcap.so.2 -> libcap.so.2.16

    -rwxr-xr-x 1 root root 19016 Oct 13 2011 /lib64/libcap.so.2.16

    [root@localhost ~]#


    17.9.3.

    [root@localhost ~]# ln -s /lib64/libcap.so.2.16 /lib64/libcap.so.1

    [root@localhost ~]#ln -s /lib64/libcap.so.2 /lib64/libcap.so

    [root@localhost ~]# ll /lib64/libcap.so*

    lrwxrwxrwx 1 root root 11 Oct 17 16:28 /lib64/libcap.so -> libcap.so.2

    lrwxrwxrwx 1 root root 21 Oct 17 17:01 /lib64/libcap.so.1 -> /lib64/libcap.so.2.16

    lrwxrwxrwx. 1 root root 14 Oct 16 15:22 /lib64/libcap.so.2 -> libcap.so.2.16

    -rwxr-xr-x 1 root root 19016 Oct 13 2011 /lib64/libcap.so.2.16

    [root@localhost ~]#

    17.9.4. 重新執(zhí)行 /u01/app/11.2.0/grid/root.sh 腳本

    [root@localhost ~]# /u01/app/11.2.0/grid/root.sh

    Running Oracle 11g root.sh script...


    The following environment variables are set as:

    ORACLE_OWNER= grid

    ORACLE_HOME= /u01/app/11.2.0/grid


    Enter the full pathname of the local bin directory: [/usr/local/bin]:

    The file "dbhome" already exists in /usr/local/bin. Overwrite it? (y/n)

    [n]: y -- 輸入 y 覆蓋安裝

    Copying dbhome to /usr/local/bin ...

    The file "oraenv" already exists in /usr/local/bin. Overwrite it? (y/n)

    [n]: y -- 輸入 y 覆蓋安裝

    Copying oraenv to /usr/local/bin ...

    The file "coraenv" already exists in /usr/local/bin. Overwrite it? (y/n)

    [n]: y -- 輸入 y 覆蓋安裝

    Copying coraenv to /usr/local/bin ...


    Entries will be added to the /etc/oratab file as needed by

    Database Configuration Assistant when a database is created

    Finished running generic part of root.sh script.

    Now product-specific root actions will be performed.

    To configure Grid Infrastructure for a Stand-Alone Server run the following command as the root user:

    /u01/app/11.2.0/grid/perl/bin/perl -I/u01/app/11.2.0/grid/perl/lib -I/u01/app/11.2.0/grid/crs/install /u01/app/11.2.0/grid/crs/install/roothas.pl



    To configure Grid Infrastructure for a Cluster perform the following steps:

    1. Provide values for Grid Infrastructure configuration parameters in the file - /u01/app/11.2.0/grid/crs/install/crsconfig_params. For details on how to do this, see the installation guide.

    2. Run the following command as the root user:

    /u01/app/11.2.0/grid/perl/bin/perl -I/u01/app/11.2.0/grid/perl/lib -I/u01/app/11.2.0/grid/crs/install /u01/app/11.2.0/grid/crs/install/rootcrs.pl

    To update inventory properties for Grid Infrastructure, perform the following

    steps. If a pre-11.2 home is already configured, execute the following:

    11.2_Home/oui/bin/runInstaller -updateNodeList -silent -local CRS=false ORACLE_HOME=pre-11.2_Home

    Always execute the following to register the current home:

    11.2_Home/oui/bin/runInstaller -updateNodeList -silent -local CRS=true ORACLE_HOME=11.2_Home.

    If either home is shared, provide the additional argument -cfs.

    [root@localhost ~]# /u01/app/11.2.0/grid/perl/bin/perl -I/u01/app/11.2.0/grid/perl/lib -I/u01/app/11.2.0/grid/crs/install /u01/app/11.2.0/grid/crs/install/roothas.pl

    2013-10-17 17:04:58: Checking for super user privileges

    2013-10-17 17:04:58: User has super user privileges

    2013-10-17 17:04:58: Parsing the host name

    Using configuration parameter file: /u01/app/11.2.0/grid/crs/install/crsconfig_params

    Improper Oracle Clusterware configuration found on this host

    Deconfigure the existing cluster configuration before starting -- 報錯

    to configure a new Clusterware

    run '/u01/app/11.2.0/grid/crs/install/rootcrs.pl -deconfig'

    to configure existing failed configuration and then rerun root.sh


    17.9.5. 解決步驟 4) 中的錯誤

    [root@localhost ~]# /u01/app/11.2.0/grid/crs/install/roothas.pl -verbose -delete -force

    2013-10-17 18:25:15: Checking for super user privileges

    2013-10-17 18:25:15: User has super user privileges

    2013-10-17 18:25:15: Parsing the host name

    Using configuration parameter file: /u01/app/11.2.0/grid/crs/install/crsconfig_params

    CRS-4639: Could not contact Oracle High Availability Services

    CRS-4000: Command Stop failed, or completed with errors.

    CRS-4639: Could not contact Oracle High Availability Services

    CRS-4000: Command Delete failed, or completed with errors.

    CRS-4544: Unable to connect to OHAS

    CRS-4000: Command Stop failed, or completed with errors.

    /u01/app/11.2.0/grid/bin/acfsdriverstate: line 51: /lib/acfstoolsdriver.sh: No such file or directory

    /u01/app/11.2.0/grid/bin/acfsdriverstate: line 51: exec: /lib/acfstoolsdriver.sh: cannot execute: No such file or directory

    Successfully deconfigured Oracle Restart stack

    [root@localhost ~]#

    17.9.6. 重新執(zhí)行 /u01/app/11.2.0/grid/root.sh 腳本

    [root@localhost ~]# /u01/app/11.2.0/grid/root.sh

    Running Oracle 11g root.sh script...


    The following environment variables are set as:

    ORACLE_OWNER= grid

    ORACLE_HOME= /u01/app/11.2.0/grid


    Enter the full pathname of the local bin directory: [/usr/local/bin]:

    The file "dbhome" already exists in /usr/local/bin. Overwrite it? (y/n)

    [n]: y

    Copying dbhome to /usr/local/bin ...

    The file "oraenv" already exists in /usr/local/bin. Overwrite it? (y/n)

    [n]: y

    Copying oraenv to /usr/local/bin ...

    The file "coraenv" already exists in /usr/local/bin. Overwrite it? (y/n)

    [n]: y

    Copying coraenv to /usr/local/bin ...


    Entries will be added to the /etc/oratab file as needed by

    Database Configuration Assistant when a database is created

    Finished running generic part of root.sh script.

    Now product-specific root actions will be performed.

    To configure Grid Infrastructure for a Stand-Alone Server run the following command as the root user:

    /u01/app/11.2.0/grid/perl/bin/perl -I/u01/app/11.2.0/grid/perl/lib -I/u01/app/11.2.0/grid/crs/install /u01/app/11.2.0/grid/crs/install/roothas.pl



    To configure Grid Infrastructure for a Cluster perform the following steps:

    1. Provide values for Grid Infrastructure configuration parameters in the file - /u01/app/11.2.0/grid/crs/install/crsconfig_params. For details on how to do this, see the installation guide.

    2. Run the following command as the root user:

    /u01/app/11.2.0/grid/perl/bin/perl -I/u01/app/11.2.0/grid/perl/lib -I/u01/app/11.2.0/grid/crs/install /u01/app/11.2.0/grid/crs/install/rootcrs.pl

    To update inventory properties for Grid Infrastructure, perform the following

    steps. If a pre-11.2 home is already configured, execute the following:

    11.2_Home/oui/bin/runInstaller -updateNodeList -silent -local CRS=false ORACLE_HOME=pre-11.2_Home

    Always execute the following to register the current home:

    11.2_Home/oui/bin/runInstaller -updateNodeList -silent -local CRS=true ORACLE_HOME=11.2_Home.

    If either home is shared, provide the additional argument -cfs.

    [root@localhost ~]# /u01/app/11.2.0/grid/perl/bin/perl -I/u01/app/11.2.0/grid/perl/lib -I/u01/app/11.2.0/grid/crs/install /u01/app/11.2.0/grid/crs/install/roothas.pl

    2013-10-17 18:27:55: Checking for super user privileges

    2013-10-17 18:27:55: User has super user privileges

    2013-10-17 18:27:55: Parsing the host name

    Using configuration parameter file: /u01/app/11.2.0/grid/crs/install/crsconfig_params

    LOCAL ADD MODE

    Creating OCR keys for user 'grid', privgrp 'oinstall'..

    Operation successful.

    CRS-4664: Node localhost successfully pinned.

    Adding daemon to inittab

    CRS-4124: Oracle High Availability Services startup failed. -- 報錯

    CRS-4000: Command Start failed, or completed with errors.

    ohasd failed to start: Inappropriate ioctl for device

    ohasd failed to start: Inappropriate ioctl for device at /u01/app/11.2.0/grid/crs/install/roothas.pl line 296.

    [root@localhost ~]#

    這是 11.0.2.1 的一個 BUG,如果安裝11.2.0.3的話就不存在這個問題

    17.9.7. 解決 BUG

    17.9.7.1. 回滾 /u01/app/11.2.0/grid/root.sh 產(chǎn)生的操作

    [root@localhost ~]# /u01/app/11.2.0/grid/crs/install/roothas.pl -verbose -delete -force

    2013-10-17 18:45:42: Checking for super user privileges

    2013-10-17 18:45:42: User has super user privileges

    2013-10-17 18:45:42: Parsing the host name

    Using configuration parameter file: /u01/app/11.2.0/grid/crs/install/crsconfig_params

    CRS-4639: Could not contact Oracle High Availability Services

    CRS-4000: Command Stop failed, or completed with errors.

    CRS-4639: Could not contact Oracle High Availability Services

    CRS-4000: Command Delete failed, or completed with errors.

    CRS-4544: Unable to connect to OHAS

    CRS-4000: Command Stop failed, or completed with errors.

    /u01/app/11.2.0/grid/bin/acfsdriverstate: line 51: /lib/acfstoolsdriver.sh: No such file or directory

    /u01/app/11.2.0/grid/bin/acfsdriverstate: line 51: exec: /lib/acfstoolsdriver.sh: cannot execute: No such file or directory

    Successfully deconfigured Oracle Restart stack

    [root@localhost ~]#

    17.9.7.2. 在執(zhí)行 root.sh 腳本出現(xiàn) Adding daemon to inittab 時,以 root 身份立即執(zhí)行下面的命令:

    # /bin/dd if=/var/tmp/.oracle/npohasd of=/dev/nullbs=1024 count=1

    如果出現(xiàn) /bin/dd: opening `/var/tmp/.oracle/npohasd': No such file or directory,說明文件還沒有生成,繼續(xù)執(zhí)行,直到能執(zhí)行為止。

    同時開兩個 SSH 會話進行下面兩步操作

    [root@localhost ~]# /bin/dd if=/var/tmp/.oracle/npohasd of=/dev/nullbs=1024 count=1

    /bin/dd: opening `/var/tmp/.oracle/npohasd': No such file or directory

    [root@localhost ~]# /bin/dd if=/var/tmp/.oracle/npohasd of=/dev/nullbs=1024 count=1

    [root@localhost ~]# /u01/app/11.2.0/grid/root.sh

    Running Oracle 11g root.sh script...


    The following environment variables are set as:

    ORACLE_OWNER= grid

    ORACLE_HOME= /u01/app/11.2.0/grid


    Enter the full pathname of the local bin directory: [/usr/local/bin]:

    The file "dbhome" already exists in /usr/local/bin. Overwrite it? (y/n)

    [n]: y

    Copying dbhome to /usr/local/bin ...

    The file "oraenv" already exists in /usr/local/bin. Overwrite it? (y/n)

    [n]: y

    Copying oraenv to /usr/local/bin ...

    The file "coraenv" already exists in /usr/local/bin. Overwrite it? (y/n)

    [n]: y

    Copying coraenv to /usr/local/bin ...


    Entries will be added to the /etc/oratab file as needed by

    Database Configuration Assistant when a database is created

    Finished running generic part of root.sh script.

    Now product-specific root actions will be performed.

    To configure Grid Infrastructure for a Stand-Alone Server run the following command as the root user:

    /u01/app/11.2.0/grid/perl/bin/perl -I/u01/app/11.2.0/grid/perl/lib -I/u01/app/11.2.0/grid/crs/install /u01/app/11.2.0/grid/crs/install/roothas.pl



    To configure Grid Infrastructure for a Cluster perform the following steps:

    1. Provide values for Grid Infrastructure configuration parameters in the file - /u01/app/11.2.0/grid/crs/install/crsconfig_params. For details on how to do this, see the installation guide.

    2. Run the following command as the root user:

    /u01/app/11.2.0/grid/perl/bin/perl -I/u01/app/11.2.0/grid/perl/lib -I/u01/app/11.2.0/grid/crs/install /u01/app/11.2.0/grid/crs/install/rootcrs.pl

    To update inventory properties for Grid Infrastructure, perform the following

    steps. If a pre-11.2 home is already configured, execute the following:

    11.2_Home/oui/bin/runInstaller -updateNodeList -silent -local CRS=false ORACLE_HOME=pre-11.2_Home

    Always execute the following to register the current home:

    11.2_Home/oui/bin/runInstaller -updateNodeList -silent -local CRS=true ORACLE_HOME=11.2_Home.

    If either home is shared, provide the additional argument -cfs.

    [root@localhost ~]# /u01/app/11.2.0/grid/perl/bin/perl -I/u01/app/11.2.0/grid/perl/lib -I/u01/app/11.2.0/grid/crs/install /u01/app/11.2.0/grid/crs/install/roothas.pl

    2013-10-17 18:55:45: Checking for super user privileges

    2013-10-17 18:55:45: User has super user privileges

    2013-10-17 18:55:45: Parsing the host name

    Using configuration parameter file: /u01/app/11.2.0/grid/crs/install/crsconfig_params

    LOCAL ADD MODE

    Creating OCR keys for user 'grid', privgrp 'oinstall'..

    Operation successful.

    CRS-4664: Node localhost successfully pinned.

    Adding daemon to inittab

    CRS-4123: Oracle High Availability Services has been started.

    ohasd is starting

    ADVM/ACFS is not supported on redhat-release-server-6Server-6.4.0.4.0.1.el6.x86_64

    localhost 2013/10/17 18:56:11 /u01/app/11.2.0/grid/cdata/localhost/backup_20131017_185611.olr

    Successfully configured Oracle Grid Infrastructure for a Standalone Server

    [root@localhost ~]#


    17.10. 結(jié)束 Grid 安裝

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    1. 11.2.0.3.0 root腳本

    新版本就不會報錯的

    [root@rhel6_lhr oraInventory]# /u01/app/grid/11.2.0/root.sh

    Performing root user operation for Oracle 11g


    The following environment variables are set as:

    ORACLE_OWNER= grid

    ORACLE_HOME= /u01/app/grid/11.2.0


    Enter the full pathname of the local bin directory: [/usr/local/bin]:

    The contents of "dbhome" have not changed. No need to overwrite.

    The contents of "oraenv" have not changed. No need to overwrite.

    The contents of "coraenv" have not changed. No need to overwrite.



    Creating /etc/oratab file...

    Entries will be added to the /etc/oratab file as needed by

    Database Configuration Assistant when a database is created

    Finished running generic part of root script.

    Now product-specific root actions will be performed.

    Using configuration parameter file: /u01/app/grid/11.2.0/crs/install/crsconfig_params

    Creating trace directory

    LOCAL ADD MODE

    Creating OCR keys for user 'grid', privgrp 'oinstall'..

    Operation successful.

    LOCAL ONLY MODE

    Successfully accumulated necessary OCR keys.

    Creating OCR keys for user 'root', privgrp 'root'..

    Operation successful.

    CRS-4664: Node rhel6_lhr successfully pinned.

    Adding Clusterware entries to upstart


    rhel6_lhr 2014/06/14 22:42:26 /u01/app/grid/11.2.0/cdata/rhel6_lhr/backup_20140614_224226.olr

    Successfully configured Oracle Grid Infrastructure for a Standalone Server

    1. 利用asmca創(chuàng)建磁盤組

    [grid@rhel6_lhr ~]$ export DISPLAY=192.168.1.100:0.0

    [grid@rhel6_lhr ~]$ xhost +

    grid 用戶執(zhí)行 asmca 命令

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    這里利用asmca創(chuàng)建磁盤組的時候需要ASM實例啟動才能配置,我們點擊yes后報錯:

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    查看日志來解決,或者利用命令行來啟動asm實例:


    18.1.

    SYS Password -- sys

    ASMSNMP Password -- asmsnmp


    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    18.2.

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    Step 1. 給磁盤組命名

    Step 2. 選擇冗余方式

    High: 為每個分配單元創(chuàng)建三個副本(因此至少需要三個磁盤)

    Normal: 單鏡像(默認)

    External: 不會鏡像,假定底層存在一個 LVM 并且它正在執(zhí)行認為適當?shù)娜魏我环N RAID 級別。

    Step 3. 添加磁盤掛載位置

    Step 4. 輸入磁盤掛載位置和名稱

    18.3.

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝這里我只創(chuàng)建了兩個磁盤,一個磁盤組,沒有創(chuàng)建 FRA 區(qū)域。如果你創(chuàng)建了 3 個或者 3 個以上磁盤,可以留一部分給后面的 FRA 使用(什么是FRA? 就是閃回區(qū))。

    18.4. 點擊 Create ASM 創(chuàng)建 Disk Group

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    如果點擊yes后報如下的錯誤,則說明前邊的Oracle Grid Infrastructure沒有配置好,需要重新配置:

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    配置好Oracle Grid Infrastructure 后,重新點擊 Create ASM 創(chuàng)建 Disk Group

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    稍等一會后(其實大約需要1分鐘吧):

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    18.5. Disk Group 創(chuàng)建完成,退出。



    1. 使用netmgr建立監(jiān)聽

    安裝grid后采用grid來管理監(jiān)聽,所以監(jiān)聽也是在grid用戶下創(chuàng)建的,創(chuàng)建辦法參考下邊的Oracle用戶下創(chuàng)建監(jiān)聽的辦法。


    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    1. 通過 grid 用戶執(zhí)行 crs_stat -t 檢查 ASM 是否安裝好,如下所示表示搭建 OK。

    [grid@localhost ~]$ crs_stat -t

    Name Type Target State Host

    ------------------------

    ora.DATA.dg ora....up.type ONLINE ONLINE localhost

    ora.asm ora.asm.type ONLINE ONLINE localhost

    ora.cssd ora.cssd.type ONLINE ONLINE localhost

    ora.diskmon ora....on.type ONLINE ONLINE localhost

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝


    [grid@localhost ~]$


    [grid@rhel_linux_asm ~]$ echo $ORACLE_SID

    +ASM

    [grid@rhel_linux_asm ~]$ sqlplus / as sysasm


    SQL*Plus: Release 11.2.0.1.0 Production on Mon Apr 28 23:07:24 2014


    Copyright (c) 1982, 2009, Oracle. All rights reserved.


    Connected to an idle instance.


    SQL> startup

    ASM instance started


    Total System Global Area 283930624 bytes

    Fixed Size 2212656 bytes

    Variable Size 256552144 bytes

    ASM Cache 25165824 bytes

    ASM diskgroups mounted

    SQL> select * from v$version;


    BANNER

    --------------------------------------------------------------------------------

    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production

    PL/SQL Release 11.2.0.1.0 - Production

    CORE 11.2.0.1.0 Production

    TNS for Linux: Version 11.2.0.1.0 - Production

    NLSRTL Version 11.2.0.1.0 - Production

    SQL> select name,total_mb from v$asm_diskgroup;


    NAME TOTAL_MB

    ------------------------------ ----------

    DATA 20480


    SQL> select name,group_number,file_number,alias_index,alias_directory,system_created from v$asm_alias;


    1. 開始搭建 Oracle 數(shù)據(jù)庫

    如果系統(tǒng)之前搭建過ORACLE數(shù)據(jù)庫的話就可以不用再搭建數(shù)據(jù)庫了,只需要重新創(chuàng)建一個實例即可。。。。。

    20.1. 作為 oracle 用戶登錄系統(tǒng),將安裝包上傳到 Oracle 家目錄。

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝


    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    20.2. 解壓兩個壓縮包

    [oracle@localhost ~]$ ll linux*

    -rw-r--r-- 1 oracle oinstall 1239269270 Apr 18 20:44 linux.x64_11gR2_database_1of2.zip

    -rw-r--r-- 1 oracle oinstall 1111416131 Apr 18 20:47 linux.x64_11gR2_database_2of2.zip

    [oracle@localhost ~]$ unzip linux.x64_11gR2_database_1of2.zip && unzip linux.x64_11gR2_database_2of2.zip

    20.3. 執(zhí)行 runInstaller

    [oracle@localhost ~]$ /home/oracle/database/runInstaller

    Starting Oracle Universal Installer...


    Checking Temp space: must be greater than 120 MB. Actual 30971 MB Passed

    Checking swap space: must be greater than 150 MB. Actual 4088 MB Passed

    Checking monitor: must be configured to display at least 256 colors. Actual 16777216 Passed

    Preparing to launch Oracle Universal Installer from /tmp/OraInstall2013-10-17_08-01-38PM. Please wait ...[oracle@localhost ~]$

    20.4.

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    20.5.

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    20.6.

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    20.7.


    這里選擇字符集的時候最好把簡體中文安裝上,不然后邊安裝OEM后,網(wǎng)頁瀏覽可能出現(xiàn)會亂碼

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    20.8.

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    20.9.

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    20.10.

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    20.11.

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    20.12.

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    20.13.

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    安裝時間較長,請耐心等待。

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    安裝快結(jié)束時,會彈出窗口,提示你以 root 身份執(zhí)行一個腳本。

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    [root@localhost ~]# /u01/app/oracle/product/11.2.0/dbhome_1/root.sh

    Running Oracle 11g root.sh script...


    The following environment variables are set as:

    ORACLE_OWNER= oracle

    ORACLE_HOME= /u01/app/oracle/product/11.2.0/dbhome_1


    Enter the full pathname of the local bin directory: [/usr/local/bin]:

    The file "dbhome" already exists in /usr/local/bin. Overwrite it? (y/n)

    [n]: y

    Copying dbhome to /usr/local/bin ...

    The file "oraenv" already exists in /usr/local/bin. Overwrite it? (y/n)

    [n]: y

    Copying oraenv to /usr/local/bin ...

    The file "coraenv" already exists in /usr/local/bin. Overwrite it? (y/n)

    [n]: y

    Copying coraenv to /usr/local/bin ...


    Entries will be added to the /etc/oratab file as needed by

    Database Configuration Assistant when a database is created

    Finished running generic part of root.sh script.

    Now product-specific root actions will be performed.

    Finished product-specific root actions.

    [root@localhost ~]#

    20.14. 結(jié)束安裝

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    1. 檢查 $ORACLE_HOME/bin/oracle文件的所屬組

    這一步不是必須的,如果在后邊使用dbca創(chuàng)建數(shù)據(jù)庫的時候選不到磁盤組的時候就返回來做這一步吧。。。

    RAC或者ORACLE RESTART中,oracle可執(zhí)行文件的所屬組是asmadmin

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝


    [root@khm5 bin]# chown oracle:asmadmin oracle

    [root@khm5 bin]# ls -l oracle

    -rwxr-x--x 1 oracle asmadmin 232399473 Apr 19 07:04 oracle


    [root@khm5 bin]# chmod +s oracle

    [root@khm5 bin]# ls -l oracle

    -rwsr-s--x 1 oracle asmadmin 232399473 Apr 19 07:04 oracle



    1. 使用 netmgr 建立監(jiān)聽--Oracle用戶不需要創(chuàng)建

    需配置好環(huán)境變量,否則會出現(xiàn)找不到命令的情況。

    該步驟即建立監(jiān)聽文件,也可以從其它地方拷貝過來,或者自己新建文件:/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora

    [oracle@rhel_linux_asm grid]$ netmgr

    21.1.

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    21.2.

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    21.3.

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    21.4.

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    21.5.

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    21.6.

    點擊 File --> Save Network Configuration

    然后退出,執(zhí)行完后在以下路徑有文件:

    [oracle@rhel_linux_asm admin]$ pwd

    /u01/app/oracle/product/11.2.0/dbhome_1/network/admin

    [oracle@rhel_linux_asm admin]$ ll

    total 8

    drwxr-xr-x. 2 oracle dba 4096 Apr 28 23:24 samples

    -rw-r--r--. 1 oracle dba 187 May 7 2007 shrept.lst

    [oracle@rhel_linux_asm admin]$ netmgr

    [oracle@rhel_linux_asm admin]$ ll

    total 12

    -rw-r--r--. 1 oracle dba 475 Apr 28 23:47 listener.ora

    drwxr-xr-x. 2 oracle dba 4096 Apr 28 23:24 samples

    -rw-r--r--. 1 oracle dba 187 May 7 2007 shrept.lst

    [oracle@rhel_linux_asm admin]$ cat listener.ora

    # listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora

    # Generated by Oracle configuration tools.


    SID_LIST_LISTENER =

    (SID_LIST =

    (SID_DESC =

    (GLOBAL_DBNAME = orclasm)

    (ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)

    (SID_NAME = orclasm)

    )

    )


    LISTENER =

    (DESCRIPTION =

    (ADDRESS = (PROTOCOL = TCP)(HOST = rhel_linux_asm)(PORT = 1521))

    )


    ADR_BASE_LISTENER = /u01/app/oracle



    1. 使用 dbca 創(chuàng)建數(shù)據(jù)庫

    以oracle用戶執(zhí)行dbca命令來創(chuàng)建一個數(shù)據(jù)庫:【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    27.2.

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    27.3.

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    27.4.

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    27.5.

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    27.6.

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    27.7.

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    27.8.

    這里如果啟用閃回區(qū)和歸檔的話,就選擇fra磁盤組,不啟用的話可以不選擇

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    27.9.

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    27.10.

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    27.11.

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    27.12.

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝


    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    27.13.

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝


    安裝過程中可以查看日志:

    [root@rhel_linux_asm ~]# cd /u01/app/grid/cfgtoollogs/dbca/oralasm2/

    [root@rhel_linux_asm oralasm2]# tail -f trace.log

    。。。。。。。

    Datafile

    '+DATA/oralasm2/datafile/system.256.845998107',

    '+DATA/oralasm2/datafile/sysaux.257.845998109',

    '+DATA/oralasm2/datafile/undotbs1.258.845998109',

    '+DATA/oralasm2/datafile/users.259.845998109'

    [Thread-151] [ 2014-04-27 15:29:49.328 CST ] [CloneDBCreationStep.executeImpl:419] Length of OriginalRedoLogsGrNames=3

    [Thread-151] [ 2014-04-27 15:29:49.330 CST ] [CloneDBCreationStep.executeImpl:427] 0th redoLogText = GROUP 1 SIZE 51200K

    [Thread-151] [ 2014-04-27 15:29:49.331 CST ] [CloneDBCreationStep.executeImpl:427] 1th redoLogText = GROUP 2 SIZE 51200K

    [Thread-151] [ 2014-04-27 15:29:49.331 CST ] [CloneDBCreationStep.executeImpl:427] 2th redoLogText = GROUP 3 SIZE 51200K

    [Thread-151] [ 2014-04-27 15:29:49.332 CST ] [CloneDBCreationStep.executeImpl:448] createCTLSql=Create controlfile reuse set database "oralasm2"

    MAXINSTANCES 8

    MAXLOGHISTORY 1

    MAXLOGFILES 16

    MAXLOGMEMBERS 3

    MAXDATAFILES 100

    Datafile

    '+DATA/oralasm2/datafile/system.256.845998107',

    '+DATA/oralasm2/datafile/sysaux.257.845998109',

    '+DATA/oralasm2/datafile/undotbs1.258.845998109',

    '+DATA/oralasm2/datafile/users.259.845998109'

    LOGFILE GROUP 1 SIZE 51200K,

    GROUP 2 SIZE 51200K,

    GROUP 3 SIZE 51200K RESETLOGS;

    [Thread-151] [ 2014-04-27 15:29:55.330 CST ] [CloneDBCreationStep.executeImpl:460] calling zerodbid

    [Thread-151] [ 2014-04-27 15:30:02.332 CST ] [CloneDBCreationStep.executeImpl:470] Shutdown database

    [Thread-151] [ 2014-04-27 15:30:02.334 CST ] [CloneDBCreationStep.executeImpl:492] Startup ......nomount......

    [Thread-151] [ 2014-04-27 15:30:04.131 CST ] [CloneDBCreationStep.executeImpl:500] deleting dummy control file from v$controlfile: +DATA/oralasm2/controlfile/current.260.845998195

    [Thread-151] [ 2014-04-27 15:30:08.881 CST ] [CloneDBCreationStep.executeImpl:511] Enabling restricted session.

    [Thread-151] [ 2014-04-27 15:30:11.028 CST ] [CloneDBCreationStep.executeImpl:513] alter database "oralasm2" open resetlogs;

    [Thread-151] [ 2014-04-27 15:30:29.193 CST ] [CloneDBCreationStep.executeImpl:521] Removing existing services from sourcedb seeddata

    [Thread-151] [ 2014-04-27 15:30:30.025 CST ] [CloneDBCreationStep.executeImpl:526] Renaming globale_name

    [Thread-151] [ 2014-04-27 15:30:30.163 CST ] [CloneDBCreationStep.executeImpl:542] control file from v$controlfile: +DATA/oralasm2/controlfile/current.260.845998209

    [Thread-151] [ 2014-04-27 15:30:30.164 CST ] [CloneDBCreationStep.executeImpl:557] controlfiles("+DATA/oralasm2/controlfile/current.260.845998209")

    [Thread-151] [ 2014-04-27 15:30:30.186 CST ] [CloneDBCreationStep.executeImpl:601] Temp file to be added:=+DATA/{DB_UNIQUE_NAME}/temp01.dbf

    [Thread-151] [ 2014-04-27 15:30:30.187 CST ] [CloneDBCreationStep.executeImpl:602] Temp file size in KB:=20480

    [Thread-151] [ 2014-04-27 15:30:31.603 CST ] [CloneDBCreationStep.executeImpl:632] Establish USERS as the default permanent tablespace of the database

    [Thread-151] [ 2014-04-27 15:30:31.704 CST ] [TemplateManager.isInstallTemplate:2300] Selected Template by user:=General Purpose

    [Thread-151] [ 2014-04-27 15:30:31.704 CST ] [TemplateManager.isInstallTemplate:2307] The Message Id to be searched:=GENERAL_PURPOSE

    。。。。。。。。。

    27.14.

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

  4. 至此,基于 ASM Oracle Database 11g 環(huán)境搭建完畢。


    1. 關(guān)閉防火墻--不然客戶端可能連接不上

    service iptables stop

    [root@rhel6_lhr ~]# service iptables stop

    iptables: Setting chains to policy ACCEPT: filter [ OK ]

    iptables: Flushing firewall rules: [ OK ]

    iptables: Unloading modules: [ OK ]

    [root@rhel6_lhr ~]#


    1. 是否有tnsnames.ora 生成

    檢查 /u01/app/oracle/product/11.2.0/dbhome_1/network/ 下是否有 tnsnames.ora,如果沒有就生成以為文件吧:

    /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora


    orclasm =

    (DESCRIPTION =

    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.128.134)(PORT = 1521))

    (CONNECT_DATA =

    (SERVER = DEDICATED)

    (SERVICE_NAME = orclasm)

    )

    )



    1. 配置ORACLE自動啟動

    如果不需要系統(tǒng)啟動的時候自動起動則可以不用配置。

    1. 編輯/etc/oratab

    [oracle@dbserver1 ~]$ vi /etc/oratab

    orcl:/u01/app/oracle/product/11.2.0/db_1:Y


    1. ROOT用戶創(chuàng)建/etc/init.d/dbora

    [root@dbserver1 ~]# cat /etc/init.d/dbora

    #!/bin/sh

    # chkconfig: 345 99 10

    # description: Oracle auto start-stop script.

    #

    # Set ORA_HOME to be equivalent to the $ORACLE_HOME

    # from which you wish to execute dbstart and dbshut;

    #

    # Set ORA_OWNER to the user id of the owner of the

    # Oracle database in ORA_HOME.


    #ORA_HOME=/u01/app/oracle/product/10.2.0/db_1

    #ORA_HOME=/u01/app/oracle/product/11.1.0/db_1

    ORA_HOME=/u01/app/oracle/product/11.2.0/db_1

    ORA_OWNER=oracle


    if [ ! -f $ORA_HOME/bin/dbstart ]

    then

    echo "Oracle startup: cannot start"

    exit

    fi


    case "$1" in

    'start')

    # Start the Oracle databases:

    # The following command assumes that the oracle login

    # will not prompt the user for any values

    su - $ORA_OWNER -c "$ORA_HOME/bin/dbstart $ORA_HOME"

    touch /var/lock/subsys/dbora

    ;;

    'stop')

    # Stop the Oracle databases:

    # The following command assumes that the oracle login

    # will not prompt the user for any values

    su - $ORA_OWNER -c "$ORA_HOME/bin/dbshut $ORA_HOME"

    rm -f /var/lock/subsys/dbora

    ;;

    esac


    1. 加入啟動項


    [root@dbserver1 ~]# chmod 750 /etc/init.d/dbora

    [root@dbserver1 ~]# chkconfig --add dbora




    1. 驗證

    [oracle@localhost ~]$ sqlplus / as sysdba


    SQL*Plus: Release 11.2.0.1.0 Production on Thu Oct 17 21:37:22 2013


    Copyright (c) 1982, 2009, Oracle. All rights reserved.



    Connected to:

    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production

    With the Partitioning, Automatic Storage Management, OLAP, Data Mining

    and Real Application Testing options


    SQL> select * from v$version;


    BANNER

    --------------------------------------------

    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production

    PL/SQL Release 11.2.0.1.0 - Production

    CORE 11.2.0.1.0 Production

    TNS for Linux: Version 11.2.0.1.0 - Production

    NLSRTL Version 11.2.0.1.0 - Production

    SQL> select file_name from dba_data_files;


    FILE_NAME

    --------------------------------------------

    +DATA/orcl/datafile/users.259.829084507

    +DATA/orcl/datafile/undotbs1.258.829084505

    +DATA/orcl/datafile/sysaux.257.829084505

    +DATA/orcl/datafile/system.256.829084505

    +DATA/orcl/datafile/example.265.829084649


    SQL>select name,total_mb,state from v$asm_diskgroup;

    select name,group_number,file_number,alias_index,alias_directory,system_created from v$asm_alias;

    # su grid$ crsctl check has$ crsctl check css$ crsctl check evm$ crs_stat t v$ ocrcheck

    # su oracle$ sqlplus / as sysdbaSQL> select name from v$datafile 2 union all 3 select name from v$controlfile 4 union all 5 select member from v$logfile;

    檢查高可用性服務(wù)器的狀態(tài)[grid@restart ~]$ crsctl check hasCRS-4638: Oracle High Availability Services is online[grid@restart ~]$ crsctl check cssCRS-4529: Cluster Synchronization Services is online[grid@restart ~]$ crsctl check evmCRS-4533: Event Manager is online

    [grid@restart ~]$ crs_stat -tName Type Target State Host ————————————————————ora.CRS.dg ora.up.type ONLINE ONLINE restart ora.ER.lsnr ora.er.type ONLINE ONLINE restart ora.asm ora.asm.type ONLINE ONLINE restart ora.cssd ora.cssd.type ONLINE ONLINE restart ora.diskmon ora.on.type OFFLINE OFFLINE ora.evmd ora.evm.type ONLINE ONLINE restart ora.ons ora.ons.type OFFLINE OFFLINE

    [grid@restart ~]$ ps -ef | grep asmgrid 16058 1 0 19:56 ? 00:00:00 asm_pmon_+ASMgrid 16060 1 0 19:56 ? 00:00:00 asm_psp0_+ASMgrid 16062 1 0 19:56 ? 00:00:00 asm_vktm_+ASMgrid 16066 1 0 19:56 ? 00:00:00 asm_gen0_+ASMgrid 16068 1 0 19:56 ? 00:00:00 asm_diag_+ASMgrid 16070 1 0 19:56 ? 00:00:00 asm_dia0_+ASMgrid 16072 1 0 19:56 ? 00:00:00 asm_mman_+ASMgrid 16074 1 0 19:56 ? 00:00:00 asm_dbw0_+ASMgrid 16076 1 0 19:56 ? 00:00:00 asm_lgwr_+ASMgrid 16078 1 0 19:56 ? 00:00:00 asm_ckpt_+ASMgrid 16080 1 0 19:56 ? 00:00:00 asm_smon_+ASMgrid 16082 1 0 19:56 ? 00:00:00 asm_rbal_+ASMgrid 16084 1 0 19:56 ? 00:00:00 asm_gmon_+ASMgrid 16086 1 0 19:56 ? 00:00:00 asm_mmon_+ASMgrid 16088 1 0 19:56 ? 00:00:00 asm_mmnl_+ASMgrid 16188 16152 0 19:59 pts/1 00:00:00 grep asm

    # cat /etc/oracle/ocr.lococrconfig_loc=/u01/app/11.2.0/grid/cdata/localhost/local.ocrlocal_only=TRUE

    # /u01/app/11.2.0/grid/bin/ocrcheckStatus of Oracle Cluster Registry is as follows : Version : 3 Total space (kbytes) : 262120 Used space (kbytes) : 152 Available space (kbytes) : 261968 ID : 1179492779 Device/File Name : /u01/app/11.2.0/grid/cdata/localhost/local.ocr Device/File integrity check succeeded

    Device/File not configured

    Device/File not configured

    Device/File not configured

    Device/File not configured

    Cluster registry integrity check succeeded

    Logical corruption check succeeded

    [grid@restart ~]$ crs_stat -t -vName Type R/RA F/FT Target State Host ———————————————————————-ora.ARCH.dg ora.up.type 0/5 0/ ONLINE ONLINE restart ora.CRS.dg ora.up.type 0/5 0/ ONLINE ONLINE restart ora.DATA.dg ora.up.type 0/5 0/ ONLINE ONLINE restart ora.ER.lsnr ora.er.type 0/5 0/ ONLINE ONLINE restart ora.asm ora.asm.type 0/5 0/ ONLINE ONLINE restart ora.cssd ora.cssd.type 0/5 0/5 ONLINE ONLINE restart ora.diskmon ora.on.type 0/10 0/5 OFFLINE OFFLINE ora.evmd ora.evm.type 0/10 0/5 ONLINE ONLINE restart ora.ons ora.ons.type 0/3 0/ OFFLINE OFFLINE ora.restart.db ora.se.type 0/2 0/1 ONLINE ONLINE restart

    SQL> select name from v$datafile 2 union all 3 select name from v$controlfile 4 union all 5 select member from v$logfile;

    NAME——————————————————————————–+DATA/restart/datafile/system.260.790288571+DATA/restart/datafile/sysaux.261.790288633+DATA/restart/datafile/undotbs1.262.790288683+DATA/restart/datafile/users.264.790288715+DATA/restart/controlfile/current.256.790288547+DATA/restart/onlinelog/group_1.257.790288549+DATA/restart/onlinelog/group_2.258.790288555+DATA/restart/onlinelog/group_3.259.790288561

    8 rows selected.

    SQL>SQL> archive log listDatabase log mode No Archive ModeAutomatic archival DisabledArchive destination /u01/app/oracle/product/11.2.0/dbhome_1/dbs/archOldest online log sequence 36Current log sequence 38

    不是歸檔模式運行,現(xiàn)在手動開啟

    SQL> create pfile='/u01/pfile-0802.bak' from spfile;

    File created.

    SQL> alter system set log_archive_dest_1='LOCATION=+ARCH';

    System altered.

    SQL> shutdown immediateDatabase closed.Database dismounted.ORACLE instance shut down.

    SQL> startup mountORACLE instance started.

    Total System Global Area 839282688 bytesFixed Size 2233000 bytesVariable Size 528485720 bytesDatabase Buffers 306184192 bytesRedo Buffers 2379776 bytesDatabase mounted.

    SQL> alter database archivelog;

    Database altered.

    SQL> alter database open;

    Database altered.

    SQL> archive log list;Database log mode Archive ModeAutomatic archival EnabledArchive destination +ARCHOldest online log sequence 36Next log sequence to archive 38Current log sequence 38

    SQL> select name from v$archived_log;

    no rows selected

    SQL> alter system switch logfile;

    System altered.

    SQL> select name from v$archived_log;

    NAME——————————————————————————–+ARCH/restart/archivelog/2012_08_02/thread_1_seq_38.256.790292467

    以監(jiān)聽為例用srvctl 關(guān)閉啟動測試:[grid@restart ~]$ srvctl status listenerListener LISTENER is enabledListener LISTENER is running on node(s): restart[grid@restart ~]$ srvctl stop listener[grid@restart ~]$ srvctl status listenerListener LISTENER is enabledListener LISTENER is not running

    [grid@restart ~]$ srvctl start listener[grid@restart ~]$ crs_stat -t -vName Type R/RA F/FT Target State Host ———————————————————————-ora.ARCH.dg ora.up.type 0/5 0/ ONLINE ONLINE restart ora.CRS.dg ora.up.type 0/5 0/ ONLINE ONLINE restart ora.DATA.dg ora.up.type 0/5 0/ ONLINE ONLINE restart ora.ER.lsnr ora.er.type 0/5 0/ ONLINE ONLINE restart ora.asm ora.asm.type 0/5 0/ ONLINE ONLINE restart ora.cssd ora.cssd.type 0/5 0/5 ONLINE ONLINE restart ora.diskmon ora.on.type 0/10 0/5 OFFLINE OFFLINE ora.evmd ora.evm.type 0/10 0/5 ONLINE ONLINE restart ora.ons ora.ons.type 0/3 0/ OFFLINE OFFLINE ora.restart.db ora.se.type 0/2 0/1 ONLINE ONLINE restart

    再測試kill監(jiān)聽進程,看能否自動起來。

    [grid@restart ~]$ ps -ef | grep lsnrgrid 28139 1 0 21:43 ? 00:00:00 /u01/app/11.2.0/grid/bin/tnslsnr LISTENER -inheritgrid 28325 28251 0 21:46 pts/1 00:00:00 grep lsnr

    [grid@restart ~]$ kill -9 28139

    過幾秒鐘后他就起來,因為這中間有監(jiān)控進程的時間段

    [grid@restart ~]$ ps -ef | grep lsnrgrid 28455 1 0 21:47 ? 00:00:00 /u01/app/11.2.0/grid/bin/tnslsnr LISTENER -inheritgrid 28469 28251 0 21:47 pts/1 00:00:00 grep lsnr

    好,最后測試硬性重啟之后看ORACLE能不能自動起來# reboot

    系統(tǒng)起來稍等之后:[root@restart bin]# ./crs_stat -tName Type Target State Host ————————————————————ora.ARCH.dg ora.up.type ONLINE ONLINE restart ora.CRS.dg ora.up.type ONLINE ONLINE restart ora.DATA.dg ora.up.type ONLINE ONLINE restart ora.ER.lsnr ora.er.type ONLINE ONLINE restart ora.asm ora.asm.type ONLINE ONLINE restart ora.cssd ora.cssd.type ONLINE ONLINE restart ora.diskmon ora.on.type OFFLINE OFFLINE ora.evmd ora.evm.type ONLINE ONLINE restart ora.ons ora.ons.type OFFLINE OFFLINE ora.restart.db ora.se.type ONLINE ONLINE restart


    1. 啟動crs

    [root@b1 install]# /u01/app/grid/11.2.0/crs/install/roothas.pl -deconfig -force -verbose

    [root@b1 grid]#/u01/app/grid/11.2.0/root.sh


    ----同時執(zhí)行

    /u01/app/grid/11.2.0/perl/bin/perl -I/u01/app/grid/11.2.0/perl/lib -I/u01/app/grid/11.2.0/crs/install /u01/app/grid/11.2.0/crs/install/roothas.pl


    /bin/dd if=/var/tmp/.oracle/npohasd of=/dev/null bs=1024 count=1




    ---grid用戶下啟動

    crs_start -all

    crs_start -t

    crsctl check css

    crsctl check has

    1. 一些報錯解決方案:

      1. Oracle 11gR2 RAC ohasd failed to start 解決方法

    CRS-4124: Oracle High Availability Services startup failed.

    CRS-4000: Command Start failed, or completed with errors.

    ohasd failed to start: Inappropriate ioctl for device

    ohasd failed to start at/u01/app/11.2.0/grid/crs/install/rootcrs.pl line 443.

    第一次安裝11gR2 RAC的時候就遇到了這個11.0.2.1的經(jīng)典問題,上網(wǎng)一查才知道這是個bug,解決辦法也很簡單,

    就是在執(zhí)行root.sh之前執(zhí)行以下命令

    /bin/dd if=/var/tmp/.oracle/npohasd of=/dev/null bs=1024 count=1

    如果出現(xiàn)

    /bin/dd: opening`/var/tmp/.oracle/npohasd': No such file or directory

    的時候文件還沒生成就繼續(xù)執(zhí)行,直到能執(zhí)行為止,一般出現(xiàn)Adding daemon to inittab這條信息的時候執(zhí)行dd命令。

    另外還有一種解決方法就是更改文件權(quán)限

    chown root:oinstall /var/tmp/.oracle/npohasd

    重新執(zhí)行root.sh之前別忘了刪除配置:/u01/app/11.2.0/grid/crs/install/roothas.pl -deconfig -force-verbose

    1. CRS-4639: Could not contact Oracle High Availability Services


    在啟動asm實例的時候報如下錯誤

    [grid@b1 ~]$ sqlplus / as sysasm

    SQL*Plus: Release 11.2.0.1.0 Production on Thu Sep 12 18:14:13 2013

    Copyright (c) 1982, 2009, Oracle. All rights reserved.

    Connected to an idle instance.

    SQL> startupORA-01078: failure in processing system parametersORA-29701: unable to connect to Cluster Synchronization Service


    然后用crsctl check css檢查的時候報如下錯誤:

    [grid@b1 ~]$ crsctl check cssCRS-4639: Could not contact Oracle High Availability ServicesCRS-4000: Command Check failed, or completed with errors.


    解決CRS-4639: Could not contact Oracle High Availability Services過程如下:

    [root@b1 grid]# cd /u01/app/11.2.0/grid/crs/install[root@b1 install]# ./roothas.pl -deconfig -force -verbose2013-09-12 19:25:05: Checking for super user privileges2013-09-12 19:25:05: User has super user privileges2013-09-12 19:25:05: Parsing the host nameUsing configuration parameter file: ./crsconfig_paramsCRS-4639: Could not contact Oracle High Availability ServicesCRS-4000: Command Stop failed, or completed with errors.CRS-4639: Could not contact Oracle High Availability ServicesCRS-4000: Command Delete failed, or completed with errors.Failure at scls_scr_getval with code 1Internal Error Information: Category: -2 Operation: opendir Location: scrsearch2 Other: cant open scr home dir scls_scr_getval System Dependent Information: 2

    CRS-4544: Unable to connect to OHASCRS-4000: Command Stop failed, or completed with errors.ACFS-9200: SupportedSuccessfully deconfigured Oracle Restart stack

    [root@b1 install]# cd /u01/app/11.2.0/grid/[root@b1 grid]# ./root.shRunning Oracle 11g root.sh script...

    The following environment variables are set as: ORACLE_OWNER= grid ORACLE_HOME= /u01/app/11.2.0/grid

    Enter the full pathname of the local bin directory: [/usr/local/bin]: The file "dbhome" already exists in /usr/local/bin. Overwrite it? (y/n) [n]: y Copying dbhome to /usr/local/bin ...The file "oraenv" already exists in /usr/local/bin. Overwrite it? (y/n) [n]: y Copying oraenv to /usr/local/bin ...The file "coraenv" already exists in /usr/local/bin. Overwrite it? (y/n) [n]: y Copying coraenv to /usr/local/bin ...

    Entries will be added to the /etc/oratab file as needed byDatabase Configuration Assistant when a database is createdFinished running generic part of root.sh script.Now product-specific root actions will be performed.2013-09-12 19:27:31: Checking for super user privileges2013-09-12 19:27:31: User has super user privileges2013-09-12 19:27:31: Parsing the host nameUsing configuration parameter file: /u01/app/11.2.0/grid/crs/install/crsconfig_paramsLOCAL ADD MODE Creating OCR keys for user 'grid', privgrp 'oinstall'..Operation successful.CRS-4664: Node b1 successfully pinned.Adding daemon to inittabCRS-4123: Oracle High Availability Services has been started.ohasd is starting

    b1 2013/09/12 19:29:12 /u01/app/11.2.0/grid/cdata/b1/backup_20130912_192912.olrSuccessfully configured Oracle Grid Infrastructure for a Standalone ServerUpdating inventory properties for clusterwareStarting Oracle Universal Installer...

    Checking swap space: must be greater than 500 MB. Actual 4094 MB PassedThe inventory pointer is located at /etc/oraInst.locThe inventory is located at /u01/app/oraInventory'UpdateNodeList' was successful.


    [grid@b1 ~]$ crs_stat -tName Type Target State Host ------------------------------------------------------------ora.cssd ora.cssd.type OFFLINE OFFLINE ora.diskmon ora....on.type OFFLINE OFFLINE [grid@b1 ~]$ crs_start -allAttempting to start `ora.diskmon` on member `b1`Attempting to start `ora.cssd` on member `b1`Start of `ora.diskmon` on member `b1` succeeded.Start of `ora.cssd` on member `b1` succeeded.

    [grid@b1 ~]$ sqlplus / as sysasm

    SQL*Plus: Release 11.2.0.1.0 Production on Thu Sep 12 19:34:50 2013

    Copyright (c) 1982, 2009, Oracle. All rights reserved.

    Connected to an idle instance.

    SQL> startupASM instance started

    Total System Global Area 283930624 bytesFixed Size 2212656 bytesVariable Size 256552144 bytesASM Cache 25165824 bytesASM diskgroups mountedASM diskgroups volume enabled


    1. ORA-29701: unable to connect to Cluster Synchronization Service

    [grid@vm11gr2] /home/grid> sqlplus "/as sysasm" SQL*Plus: Release 11.2.0.1.0 Production on Sun Oct 25 10:16:21 2009 Copyright (c) 1982, 2009, Oracle. All rights reserved. Connected to an idle instance. SQL> startup ORA-01078: failure in processing system parametersORA-29701: unable to connect to Cluster Synchronization Service SQL> 無法連接到CSS服務(wù)上.到操作系統(tǒng)上檢查一下看看 [grid@vm11gr2] /home/grid> crsctl check css CRS-4530: Communications failure contacting Cluster Synchronization Services daemon [grid@vm11gr2] /home/grid> [grid@vm11gr2] /home/grid> ps -ef|grep cssd 果然沒有CSS的服務(wù)daemon進程,再看一下HAS(High Availability Service)的狀態(tài) [grid@vm11gr2] /home/grid> crsctl check has CRS-4638: Oracle High Availability Services is online [grid@vm11gr2] /home/grid> ps -ef|grep d.bin grid 5886 1 0 10:06 ? 00:00:01 /u01/app/grid/product/11.2/grid/bin/ohasd.bin reboot [grid@vm11gr2] /home/grid> 發(fā)現(xiàn)HAS的服務(wù)確實啟動了的,而ora.cssd和ora.diskmon這2個服務(wù)是依賴于HAS維護的. 進一步查看各資源的狀態(tài) [grid@vm11gr2] /home/grid> crs_stat -t Name Type Target State Host -------------------------------------------------------------- ora.FLASH_DATA.dg ora.diskgroup.type OFFLINE OFFLINE vm11gr2 ora.SYS_DATA.dg ora.diskgroup.type OFFLINE OFFLINE vm11gr2 ora.asm ora.asm.type OFFLINE OFFLINE vm11gr2 ora.cssd ora.cssd.type OFFLINE OFFLINE vm11gr2 ora.diskmon ora.diskmon.type OFFLINE OFFLINE vm11gr2 [grid@vm11gr2] /home/grid> [grid@vm11gr2] /home/grid> crsctl status resource -t -------------------------------------------------------------------------------- NAME TARGET STATE SERVER STATE_ DETAILS -------------------------------------------------------------------------------- Local Resources -------------------------------------------------------------------------------- ora.FLASH_DATA.dg OFFLINE OFFLINE vm11gr2 ora.SYS_DATA.dg OFFLINE OFFLINE vm11gr2 ora.asm OFFLINE OFFLINE vm11gr2 -------------------------------------------------------------------------------- Cluster Resources -------------------------------------------------------------------------------- ora.cssd 1 OFFLINE OFFLINE ora.diskmon 1 OFFLINE OFFLINE 再看一下ora.cssd和ora.diskmon的屬性 [grid@vm11gr2] /home/grid> crs_stat -p ora.cssd NAME=ora.cssd TYPE=ora.cssd.type ACTION_SCRIPT= ACTIVE_PLACEMENT=0AUTO_START=never CHECK_INTERVAL=30 DESCRIPTION="Resource type for CSSD" FAILOVER_DELAY=0 FAILURE_INTERVAL=3 FAILURE_THRESHOLD=5 HOSTING_MEMBERS= PLACEMENT=balanced RESTART_ATTEMPTS=5 SCRIPT_TIMEOUT=600 START_TIMEOUT=600 STOP_TIMEOUT=900 UPTIME_THRESHOLD=1m [grid@vm11gr2] /home/grid> crs_stat -p ora.diskmon NAME=ora.diskmon TYPE=ora.diskmon.type ACTION_SCRIPT= ACTIVE_PLACEMENT=0AUTO_START=never CHECK_INTERVAL=20 DESCRIPTION="Resource type for Diskmon" FAILOVER_DELAY=0 FAILURE_INTERVAL=3 FAILURE_THRESHOLD=5 HOSTING_MEMBERS= PLACEMENT=balanced RESTART_ATTEMPTS=10 SCRIPT_TIMEOUT=60 START_TIMEOUT=60 STOP_TIMEOUT=60 UPTIME_THRESHOLD=5s [grid@vm11gr2] /home/grid> 到這里基本就找到了原因了,可以看到這兩個資源的AUTO_START屬性默認都設(shè)置為never,也就是說他們不會隨著HAS服務(wù)的啟動而自動啟動的,盡管默認情況下HAS服務(wù)是開機自動啟動的.好了,那我們就手動啟動一下吧: [grid@vm11gr2] /home/grid> crsctl start resource ora.cssd CRS-2672: Attempting to start 'ora.cssd' on 'vm11gr2' CRS-2679: Attempting to clean 'ora.diskmon' on 'vm11gr2' CRS-2681: Clean of 'ora.diskmon' on 'vm11gr2' succeeded CRS-2672: Attempting to start 'ora.diskmon' on 'vm11gr2' CRS-2676: Start of 'ora.diskmon' on 'vm11gr2' succeeded CRS-2676: Start of 'ora.cssd' on 'vm11gr2' succeeded [grid@vm11gr2] /home/grid> :ora.cssd和ora.diskmon這兩個服務(wù)是有依賴關(guān)系的,啟動哪個都會把兩個都起來. [grid@vm11gr2] /home/grid> crs_stat -t Name Type Target State Host -------------------------------------------------------------- ora.FLASH_DATA.dg ora.diskgroup.type OFFLINE OFFLINE vm11gr2 ora.SYS_DATA.dg ora.diskgroup.type OFFLINE OFFLINE vm11gr2 ora.asm ora.asm.type OFFLINE OFFLINE vm11gr2 ora.cssd ora.cssd.type ONLINE ONLINE vm11gr2 ora.diskmon ora.diskmon.type ONLINE ONLINE vm11gr2 [grid@vm11gr2] /home/grid> CSS服務(wù)起來了,重啟動asm instance [grid@vm11gr2] /home/grid> sqlplus "/as sysasm" SQL*Plus: Release 11.2.0.1.0 Production on Sun Oct 25 10:30:03 2009 Copyright (c) 1982, 2009, Oracle. All rights reserved. Connected to an idle instance. SQL> startup ASM instance started Total System Global Area 284565504 bytes Fixed Size 1336036 bytes Variable Size 258063644 bytes ASM Cache 25165824 bytes ASM diskgroups mounted SQL> exit Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production With the Automatic Storage Management option [grid@vm11gr2] /home/grid> crs_stat -t Name Type Target State Host -------------------------------------------------------------- ora.FLASH_DATA.dg ora.diskgroup.type ONLINE ONLINE vm11gr2 ora.SYS_DATA.dg ora.diskgroup.type ONLINE ONLINE vm11gr2 ora.asm ora.asm.type ONLINE ONLINE vm11gr2 ora.cssd ora.cssd.type ONLINE ONLINE vm11gr2 ora.diskmon ora.diskmon.type ONLINE ONLINE vm11gr2 [grid@vm11gr2] /home/grid> tips 1)默認情況下HAS(High Availability Service)是自動啟動的.通過如下命令可以取消和啟用自動啟動 crsctl disable has crsctl enable has 2)HAS手動啟動和停止 crsctl start has crsctl stop has 3)查看HAS的狀態(tài) crsctl check has 4)如果想讓ora.css和ora.diskmon服務(wù)隨著HAS的啟動而自動啟動,那么你可以這兩個服務(wù)的AUTO_START屬性 crsctl modify resource "ora.cssd" -attr "AUTO_START=1" or crsctl modify resource "ora.diskmon" -attr "AUTO_START=1" 5)如果想取消ora.css和ora.diskmon的Auto start crsctl modify resource "ora.cssd" -attr "AUTO_START=never" crsctl modify resource "ora.diskmon" -attr "AUTO_START=never"


    1. asm 實例無法加載diskgroups,ORA-15110: no diskgroups mounted

    今天安裝oracle11g R2grid,裝完之后發(fā)現(xiàn)無法加載diskgroups,報錯如下:

    SQL> startupORA-00099: warning: no parameter file specified for ASM instanceASM instance started

    Total System Global Area 283930624 bytesFixed Size 2225792 bytesVariable Size 256539008 bytesASM Cache 25165824 bytesORA-15110: no diskgroups mounted

    (1)分析認為是由于ORA-00099引起,無法找到diskgroup。

    2)在網(wǎng)上搜索得到asm參數(shù)文件的配置格式如下:

    asm_diskstring='/dev/oracleasm/disks/DISK*'

    asm_diskgroups='DATA'asm_power_limit=1diagnostic_dest='/opt/oracle'instance_type='asm'large_pool_size=12Mremote_login_passwordfile='EXCLUSIVE'


    生成文件:$ORACLE_HOME/dbs/init+ASM.ora

    注意asm_diskstring中必須包含"*"才能正確加載,否則報下面錯誤


    SQL> startupASM instance started

    Total System Global Area 283930624 bytesFixed Size 2225792 bytesVariable Size 256539008 bytesASM Cache 25165824 bytesORA-15032: not all alterations performedORA-15017: diskgroup "DATA" cannot be mountedORA-15063: ASM discovered an insufficient number of disks for diskgroup "DATA"

    3)保存設(shè)置到spfile

    SQL> create spfile from pfile;create spfile from pfile*ERROR at line 1:ORA-29786: SIHA attribute GET failed with error [Attribute 'SPFILE' sts[200]lsts[0]]

    產(chǎn)生這個問題的原因為ORACLE認為ASM實例是手工創(chuàng)建的,并沒有注冊這個資源,那么首先增加ASM資源

    需要使用下面命令注冊asm,在grid用戶下執(zhí)行:

    srvctl add asm -l LISTENER -d '/dev/oracleasm/disks/DISK*'

    然后重新執(zhí)行命令:

    SQL> create spfile from pfile;

    File created.


    4)關(guān)閉asm實例后重新啟動,成功加載:

    SQL> startupASM instance started

    Total System Global Area 283930624 bytesFixed Size 2225792 bytesVariable Size 256539008 bytesASM Cache 25165824 bytesASM diskgroups mountedASM diskgroups volume enabled

    1. 在啟動DB時報錯ORA-27154 ORA-27300 ORA-27301 ORA-27302

    在啟動DB時報錯ORA-27154 ORA-27300 ORA-27301 ORA-27302

    這個錯誤是內(nèi)核參數(shù)設(shè)置的問題,測試過程如下。[oracle@gtlions ~]$ sqlplus "/as sysdba"SQL*Plus: Release 10.2.0.5.0 - Production on Sat Feb 4 23:47:02 2012Copyright (c) 1982, 2010, Oracle. All Rights Reserved.Connected to an idle instance.SQL> startupORA-27154: post/wait create failedORA-27300: OS system dependent operation:semget failed with status: 28ORA-27301: OS failure message: No space left on deviceORA-27302: failure occurred at: sskgpsemsperSQL>


    [root@gtlions ~]# /sbin/sysctl -pnet.ipv4.ip_forward = 0net.ipv4.conf.default.rp_filter = 2net.ipv4.conf.default.accept_source_route = 0kernel.sysrq = 0kernel.core_uses_pid = 1net.ipv4.tcp_syncookies = 1kernel.msgmnb = 65536kernel.msgmax = 65536kernel.shmmax = 4294967295kernel.shmall = 268435456fs.aio-max-nr = 1048576fs.file-max = 6815744net.ipv4.ip_local_port_range = 9000 65500net.core.rmem_default = 262144net.core.rmem_max = 4194304net.core.wmem_default = 262144net.core.wmem_max = 1048586kernel.sem = 25032000100128注意上面的最后一個參數(shù)kernel.sem = 25032000100128這個值看似很正常的,實際上是有問題的,我測試了修改為下面正常的值后OK,它值與值之間有空格標記的[root@gtlions ~]# vi /etc/sysctl.conf[root@gtlions ~]# /sbin/sysctl -pnet.ipv4.ip_forward = 0net.ipv4.conf.default.rp_filter = 2net.ipv4.conf.default.accept_source_route = 0kernel.sysrq = 0kernel.core_uses_pid = 1net.ipv4.tcp_syncookies = 1kernel.msgmnb = 65536kernel.msgmax = 65536kernel.shmmax = 4294967295kernel.shmall = 268435456fs.aio-max-nr = 1048576fs.file-max = 6815744net.ipv4.ip_local_port_range = 9000 65500net.core.rmem_default = 262144net.core.rmem_max = 4194304net.core.wmem_default = 262144net.core.wmem_max = 1048586kernel.sem = 250 32000 100 128[root@gtlions ~]#來看下是否可以正常啟動數(shù)據(jù)庫了。[oracle@gtlions ~]$ sqlplus "/as sysdba"SQL*Plus: Release 10.2.0.5.0 - Production on Sun Feb 5 00:00:39 2012Copyright (c) 1982, 2010, Oracle. All Rights Reserved.Connected to an idle instance.SQL> startupORACLE instance started.Total System Global Area 167772160 bytesFixed Size 1272600 bytesVariable Size 62915816 bytesDatabase Buffers 100663296 bytesRedo Buffers 2920448 bytesDatabase mounted.Database opened.SQL>

    1. ORA-29786: SIHA attribute GET failed


    Normal 0 7.8 磅 0 2 false false false EN-US ZH-CN X-NONE

    ORA-29786: SIHA attribute GET failed with error [Attribute 'ASM_DISKSTRING' sts[200] lsts[0]]


    如果使用asmca創(chuàng)建的asm實例,asm會自動注冊到crs,手動創(chuàng)建asm實例需要注冊


    [10:18:03 oracle(grid)@test ~]$ sql


    SQL*Plus: Release 11.2.0.3.0 Production on Tue Sep 10 10:18:04 2013


    Copyright (c) 1982, 2011, Oracle. All rights reserved.



    Connected to:

    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production

    With the Automatic Storage Management option


    10:18:05 idle> show parameter name


    NAME TYPE VALUE

    ------------------------------------ --------------------------------- ------------------------------

    db_unique_name string +ASM

    instance_name string +ASM

    lock_name_space string

    service_names string +ASM

    10:18:14 idle> create spfile from pfile;

    create spfile from pfile

    *

    ERROR at line 1:

    ORA-29786: SIHA attribute GET failed with error [Attribute 'SPFILE' sts[200] lsts[0]]



    Elapsed: 00:00:00.17

    10:19:06 idle> exit

    Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production

    With the Automatic Storage Management option

    [10:19:12 oracle(grid)@test ~]$ srvctl add asm -l LISTENER -p /oracle/product/11.2.0/grid/dbs/init+ASM.ora -d 'ASMDISK*'

    PRCR-1001 : Resource ora.LISTENER.lsnr does not exist

    [10:20:19 oracle(grid)@rmdgl ~]$ crs_stat -t

    Name Type Target State Host

    ------------------------------------------------------------

    ora.cssd ora.cssd.type ONLINE ONLINE rmdgl

    ora.diskmon ora....on.type OFFLINE OFFLINE

    ora.evmd ora.evm.type ONLINE ONLINE rmdgl

    ora.ons ora.ons.type OFFLINE OFFLINE

    [10:20:35 oracle(grid)@test~]$ srvctl add asm -p /u01/app/11.2.0/grid/dbs/spfile+ASM.ora -d 'ASMDISK*'

    [10:20:56 oracle(grid)@rmdgl ~]$ crs_stat -t

    Name Type Target State Host

    ------------------------------------------------------------

    ora.asm ora.asm.type OFFLINE OFFLINE

    ora.cssd ora.cssd.type ONLINE ONLINE rmdgl

    ora.diskmon ora....on.type OFFLINE OFFLINE

    ora.evmd ora.evm.type ONLINE ONLINE rmdgl

    ora.ons ora.ons.type OFFLINE OFFLINE

    [10:20:58 oracle(grid)@test ~]$ cd /u01/app/11.2.0/grid/dbs/

    [10:21:21 oracle(grid)@test dbs]$ ll

    total 20

    -rw-rw---- 1 oracle oinstall 1257 Sep 5 02:34 ab_+ASM.dat

    -rw-rw---- 1 oracle oinstall 1544 Sep 5 02:34 hc_+ASM.dat

    -rw-r----- 1 oracle oinstall 169 Aug 30 13:49 init+ASM.ora

    -rw-r--r-- 1 oracle oinstall 2851 May 15 2009 init.ora

    -rw-r----- 1 oracle oinstall 2560 Aug 30 13:50 orapw+ASM

    [10:21:22 oracle(grid)@test dbs]$ crs_stat -t

    Name Type Target State Host

    ------------------------------------------------------------

    ora.asm ora.asm.type OFFLINE OFFLINE

    ora.cssd ora.cssd.type ONLINE ONLINE rmdgl

    ora.diskmon ora....on.type OFFLINE OFFLINE

    ora.evmd ora.evm.type ONLINE ONLINE rmdgl

    ora.ons ora.ons.type OFFLINE OFFLINE

    [10:21:40 oracle(grid)@rmdgl dbs]$ crs_stat -t

    Name Type Target State Host

    ------------------------------------------------------------

    ora.asm ora.asm.type OFFLINE OFFLINE

    ora.cssd ora.cssd.type ONLINE ONLINE rmdgl

    ora.diskmon ora....on.type OFFLINE OFFLINE

    ora.evmd ora.evm.type ONLINE ONLINE rmdgl

    ora.ons ora.ons.type OFFLINE OFFLINE

    [10:23:16 oracle(grid)@rmdgl dbs]$ srvctl start asm

    [10:23:20 oracle(grid)@rmdgl dbs]$ crs_stat -t

    Name Type Target State Host

    ------------------------------------------------------------

    ora.asm ora.asm.type ONLINE ONLINE rmdgl

    ora.cssd ora.cssd.type ONLINE ONLINE rmdgl

    ora.diskmon ora....on.type OFFLINE OFFLINE

    ora.evmd ora.evm.type ONLINE ONLINE rmdgl

    ora.ons ora.ons.type OFFLINE OFFLINE

    [11:13:50 oracle(grid)@test dbs]$ sql


    SQL*Plus: Release 11.2.0.3.0 Production on Tue Sep 10 11:14:39 2013


    Copyright (c) 1982, 2011, Oracle. All rights reserved.



    Connected to:

    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production

    With the Automatic Storage Management option


    11:14:39 idle> create spfile from pfile;


    File created.


    Elapsed: 00:00:00.24



    Elapsed: 00:00:00.26

    1. 11gR2手動創(chuàng)建ASM實例ORA-29786錯誤解決方法

    從11gR2開始,使用圖形化方式安裝Grid Infrastructure和使用ASMCA工具創(chuàng)建ASM實例都強制使用磁盤組作為ASM實例參數(shù)文件的存儲方式。如果想將ASM參數(shù)文件存放到本地磁盤文件系統(tǒng)中,只能手動創(chuàng)建ASM實例。手動創(chuàng)建ASM實例,在執(zhí)行CRETAE SPFILE FROM PFILE將PFILE轉(zhuǎn)換成SPFILE的時候收到如下報錯:SQL> create spfile from pfile;

    create spfile from pfile

    *

    ERROR at line 1:

    ORA-29786: SIHA attribute GET failed with error [Attribute 'SPFILE' sts[200]

    lsts[0]]下面是METALINK的解決方案:ORA-29786: SIHA attribute GET failed with Error If 11gR2 ASM instance is created manually [ID 976075.1] 修改時間:2011-8-11【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝類型:PROBLEM【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝狀態(tài):PUBLISHED【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝優(yōu)先級:3

    In this Document Symptoms Changes Cause Solution

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝


    Symptoms

    After creating an initial parameter file init+ASM.ora manually and starting an ASM instance, certain ASM commands fails with ORA-29786 in sqlplus:

    sqlplus / as sysasmSQL> create spfile='$ORACLE_HOME/spfile+ASM.ora' from pfile='$ORACLE_HOME/dbs/init+ASM.ora';create spfile='$ORACLE_HOME/spfile+ASM.ora' from pfile='$ORACLE_HOME/dbs/init+ASM.ora'*ERROR at line 1:ORA-29786: SIHA attribute GET failed with error [Attribute 'SPFILE' sts[200]lsts[0]]


    SQL> create diskgroup dg1 normal redundancy disk '/opt/oracle/oradata/nobilldb/DG1_dev0' disk '/opt/oracle/oradata/nobilldb/DG1_dev1';Diskgroup created.SQL> drop diskgroup dg1;drop diskgroup dg1*ERROR at line 1:ORA-15039: diskgroup not droppedORA-29786: SIHA attribute GET failed with error [Attribute 'SPFILE' sts[200]lsts[0]]

    Better option to create ASM instance is to run asmca in GUI/Silent mode.

    Changes

    Starting with 11gR2, ASM instance is a resoure in CRS repository also in single instance installations. Hence, it must be registered to OCR before doing certain operations like create/drop diskgroup, create pfile/spfile, etc.

    Cause

    ASM instance is created and started manually but it is not registered to cluster repository.

    Solution

    If ASM instance is created manually, add ASM instance to CRS repository with srvctl add asm:

    srvctl add asm -l LISTENER -p /oracle/product/11.2.0/grid/dbs/init+ASM.ora -d '/dev/sdc*'srvctl add asm -h -- will give the options

    根據(jù)文章提示,執(zhí)行以下命令:# pwd

    /u01/app/11.2.0/grid/bin

    # ./srvctl add asm -h


    Adds an ASM configuration to be managed by Oracle Restart.


    Usage: srvctl add asm [-l ] [-p ] [-d ]

    -l Listener name

    -p Server parameter file path

    -d ASM diskgroup discovery string

    -h Print usage

    # su - grid $ ./srvctl add asm -l LISTENER -p /u01/app/11.2.0/grid/dbs/spfile+ASM.ora -d '/dev/rhdisk*'

    注意:以上的srvctl add asm命令必須用grid用戶執(zhí)行,不能用root用戶執(zhí)行,詳情參考文章《11gR2手動創(chuàng)建的ASM實例無法被Clusterware管理的問題的解決》http://space.itpub.net/?uid-23135684-action-viewspace-itemid-743090


    $ sqlplus / as sysdba


    SQL*Plus: Release 11.2.0.3.0 Production on Mon Sep 10 11:12:53 2012


    Copyright (c) 1982, 2011, Oracle. All rights reserved.



    Connected to:

    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production

    With the Automatic Storage Management option


    SQL> create spfile from pfile;

    create spfile from pfile

    *

    ERROR at line 1:

    ORA-27038: created file already exists

    Additional information: 1



    SQL> exit

    Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production

    With the Automatic Storage Management option

    $ cd $ORACLE_HOME/dbs

    $ ls

    ab_+ASM.dat hc_+ASM.dat init+ASM.ora init.ora spfile+ASM.ora

    執(zhí)行srvctl add asm命令會自動為ASM實例添加SPFILE參數(shù)文件。

    $ strings spfile*

    /M?

    *.asm_power_limit=1

    *.diagnostic_dest='/u01/app/grid'

    *.instance_type='asm'

    *.large_pool_size=12M

    *.remote_login_passwordfile='EXCLUSIVE'

    $ sqlplus / as sysasm


    SQL*Plus: Release 11.2.0.3.0 Production on Mon Sep 10 11:13:21 2012


    Copyright (c) 1982, 2011, Oracle. All rights reserved.



    Connected to:

    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production

    With the Automatic Storage Management option


    SQL> shutdown immediate

    ORA-15100: invalid or missing diskgroup name



    ASM instance shutdown

    SQL>

    SQL> startup nomount

    ASM instance started


    Total System Global Area 283930624 bytes

    Fixed Size 2220800 bytes

    Variable Size 256544000 bytes

    ASM Cache 25165824 bytes

    SQL> show parameter spfile


    NAME TYPE

    ------------------------------------ ----------------------

    VALUE

    ------------------------------

    spfile string

    /u01/app/11.2.0/grid/dbs/spfil

    e+ASM.ora

    --end--


    1. ORACLE dbca 找不到asm disks

      2012-04-11 14:44:03

    ORACLE dbca 找不到asm disks


    oracle版本: 11.2.0.1.0

    grid 版本: 11.2


    前面的安裝基本都一步一步都走過來了,當然走的不是那么的平坦.還好有百度google的鼎力相助終于是裝好了.


    問題現(xiàn)象:dbca 到第6步的時候 "Database file location ",

    選擇 Storage Type :Automatic Storage management

    然后 Databse Area : DATA(創(chuàng)建的asm disk group的名稱)

    如下圖:

    【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝


    點擊下一步系統(tǒng)提示: 無法找到指定的磁盤組.


    錯誤判斷:

    1 執(zhí)行: /usr/sbin/oracleasm scandisks

    /usr/sbin/oracleasm listdisks

    結(jié)果正常,而且listdisk可以正常的將磁盤組可顯示出來.


    2 切換到 grid 帳戶 ,執(zhí)行數(shù)據(jù)查詢

    sqlplus /nolog

    conn /as sysdba

    select name from v$asm_disks

    也可以查得到.

    3 用戶組判斷

    id oracle

    發(fā)現(xiàn)oracle沒能在asmdba組里面,問題在此.


    解決問題

    執(zhí)行 usermod -G oinstall -g dba,asmdba oracle


    再次選擇,asm 磁盤組出來了.


    后記

    其實在我的最開始的創(chuàng)建用戶及組的腳本里面是將oracle 加入到了asmdba中的,但是創(chuàng)建的腳本受了系統(tǒng)自帶腳本orarun的影響.


    oracle 11g dbca 找不到asm diskgroup的解決辦法

    oracle 11g dbca 找不到asm diskgroup的解決辦法

    昨天在家里的本本虛擬機里配置11G R2 RAC時,GI安裝正常,db soft 安裝正常,查看資源asm 磁盤也正常,GI是用的GRID 用戶及用ASMLIB配置的ASM DISKGROUP.但到最后一步用ORACLE用戶DBCA建庫時,在儲存選擇ASM,無法找到ASMDISKGROUP?

    家里沒法上網(wǎng)只能自己猜一下,嘗試用GRID 用戶運行DBCA,當然目的只是嘗試到選擇存儲時會不會發(fā)現(xiàn)ASM DISKGROUP,開始會因為環(huán)境變量問題報錯忽略,當?shù)竭x擇存儲時發(fā)現(xiàn)正常的發(fā)現(xiàn)了先前用ASMCA創(chuàng)建的ASM磁盤組,取消安裝,開始排查錯誤。

    命令 id oracle查看了ORACLE的用戶組,發(fā)現(xiàn)有oinstall,asmdba,dba再查看 id grid發(fā)現(xiàn)grid的用戶組要比ORACLE用戶多出一個asmadmin的用戶組然后再查看ASM設(shè)備的用戶組ls -l /dev/oracleasm/diskstotal 0brw-rw- 1 grid asmadmin 8, 33 Nov 4 15:35 CRDATAbrw-rw- 1 grid asmadmin 8, 49 Nov 4 15:35 DBDATA

    所以你可以修改ASM設(shè)備的組為asmdba,也可以給ORACLE用戶加到asmadmin,我選擇第二個usermod -a -G asmadmin oracle

    或者:chown grid:asmdba /dev/asm*

    還有就是去檢查一下$GRID_HOME/bin/oracle執(zhí)行文件的權(quán)限是不是下面[grid@rac1 bin]$ ll oracle-rwsr-sx 1 grid oinstall 152462814 Apr 10 19:51 oracle

    我記的當時好像是沒有s而是x,如果沒有執(zhí)行下面的命令chmod +s oracles對于執(zhí)行文件是suid,就是告之以文件所有者的身份運行。

    執(zhí)行完上面一系列的排查后,在ORACLE用戶的DBCA中終于發(fā)現(xiàn)了ASM DISKGROUP.

    1. Incorrect permission setting for oracle user2. ASM instance was not started or diskgroups are not mounted.3. The diskgroup resources are not online.4. The permission setting for the asm devices are incorrect.5. The oracle executable under /bin has incorrect permission settings.6. the file system for grid home was mounted with option 'nosuid'.

    Related Posts:

  • No related posts found!



安裝RAC或者Oracle RestartGI(Grid Infrastructure)RDBMS安裝順序顛倒導致dbca無法識別ASM磁盤組問題解決


最近和一朋友做這樣的測試,在安裝RAC或者Oracle Restart的時候如果先安裝RDBMS Software,后安裝GI(Grid Infrastructure),會不會影響數(shù)據(jù)庫的使用或者會不會影響創(chuàng)建數(shù)據(jù)庫。我們懷著這樣的疑問在測試環(huán)境里進行了實驗。RDBMS Software安裝和GI的安裝都很順利,通過asmca也創(chuàng)建了后續(xù)存放數(shù)據(jù)文件和用于閃回恢復(fù)區(qū)的ASM磁盤組。本以為很順利進行下去,但dbca建庫的時候遇到了問題,到選擇存儲方式的時候無法識別asm磁盤組。如下圖:

【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

提醒:大家要相信如果安裝順序是正確的,那么在這個步驟中肯定是能夠看到大家創(chuàng)建好的ASM磁盤組信息的。

那分析下常見的找不到ASM磁盤組的原因:1grid家目錄或者其子目錄權(quán)限錯誤2asm磁盤的權(quán)限錯誤3asm實例未啟動或者asm磁盤組沒有mount4asm磁盤組資源沒有在線5oracle用戶的權(quán)限錯誤6oracle($ORACLE_HOME/bin)可執(zhí)行文件的權(quán)限錯誤

OK,那我就按照上面的分析結(jié)果進行逐一排查:1gi家目錄或者其子目錄權(quán)限錯誤

[root@khm5 ~]# ls -ld /u02/app/11.2.0/grid/

drwxr-x--- 66 root oinstall 4096 Apr 19 01:36 /u02/app/11.2.0/grid/

我先簡單查看了GI的家目錄權(quán)限,這是正常的。這里想要提醒大家,有些DBA有意無意中看到這樣的目錄權(quán)限,發(fā)現(xiàn)所屬主是root,以為出了問題,理所應(yīng)當?shù)赝ㄟ^命令去更改,如果只更改該目錄權(quán)限問題也不大,回退方法很簡單,但一旦加上-R參數(shù)遞歸方式把子目錄、子文件的權(quán)限一并更改,那故障就發(fā)生了。所以,大家在操作的時候不要盲目去做沒有把握的事情,掌握每個操作后面的原理以及其帶來的后果,以至于充分準備好回退方法。

在這里我很清楚地知道沒有做過修改權(quán)限的操作,所以初步認為是這個環(huán)節(jié)沒有問題,所以pass。

2asm磁盤的權(quán)限錯誤我是通過ASMLib驅(qū)動創(chuàng)建的asm磁盤,通過下面命令查看:

[root@khm5 ~]# ls -l /dev/oracleasm/disks/t

otal 0brw-rw---- 1 grid asmadmin 8, 17 Apr 19 01:22 ASMDISK1

brw-rw---- 1 grid asmadmin 8, 33 Apr 19 01:22 ASMDISK2

brw-rw---- 1 grid asmadmin 8, 49 Apr 19 01:22 ASMDISK3

如果發(fā)現(xiàn)權(quán)限不對,通過如下命令修改:

[root@khm5 ~]# oracleasm configure -I 或者[root@khm5 ~]# /etc/init.d/oracleasm configure

修改之后查看:[root@khm5 ~]# oracleasm configureORACLEASM_ENABLED=trueORACLEASM_UID=grid

ORACLEASM_GID=asmadmin

ORACLEASM_SCANBOOT=trueORACLEASM_SCANORDER=""ORACLEASM_SCANEXCLUDE=""

3asm實例未啟動或者asm磁盤組沒有mount4asm磁盤組資源沒有在線通過查看資源情況可以判斷有沒有34提到的問題

[grid@khm5 ~]$ crsctl stat res -t

--------------------------------------------------------------------------------

NAME TARGET STATE SERVER STATE_DETAILS

--------------------------------------------------------------------------------Local Resources--------------------------------------------------------------------------------ora.DATA.dg

ONLINE ONLINE khm5

ora.FLASH.dg

ONLINE ONLINE khm5

ora.GRID.dg

ONLINE ONLINE khm5

ora.LISTENER.lsnr

ONLINE ONLINE khm5

ora.asm ONLINE ONLINE khm5 Started

ora.ons

OFFLINE OFFLINE khm5

--------------------------------------------------------------------------------Cluster Resources--------------------------------------------------------------------------------ora.cssd

1 ONLINE ONLINE khm5

ora.diskmon

1 OFFLINE OFFLINE

ora.evmd

1 ONLINE ONLINE khm5

5oracle用戶的權(quán)限錯誤

[root@khm5 ~]# id oracle

uid=1101(oracle) gid=1000(oinstall) groups=1000(oinstall),1300(dba),1301(oper),1201(asmdba)

oracle用戶需要加入到asmdba組,如果發(fā)現(xiàn)沒有加入,進行如下操作:

[root@khm5 ~]# gpasswd -a oracle asmdba

Adding user oracle to group asmdba

6oracle($ORACLE_HOME/bin)可執(zhí)行文件的權(quán)限錯誤

[root@khm5 ~]# su - oracle

[oracle@khm5 ~]$ cd $ORACLE_HOME/bin

[oracle@khm5 bin]$ ls -l oracle

-rwsr-s--x 1 oracle oinstall 232399473 Apr 19 07:04 oracle

好,到這里我們發(fā)現(xiàn)問題了,oracle可執(zhí)行文件的權(quán)限不正確。RAC或者ORACLE RESTART中,oracle可執(zhí)行文件的所屬組是asmadmin。

如下方式進行修改:

[root@khm5 ~]# cd /u02/app/oracle/product/11.2.0/dbhome_1/bin/

[root@khm5 bin]# chown oracle:asmadmin oracle

[root@khm5 bin]# ls -l oracle

-rwxr-x--x 1 oracle asmadmin 232399473 Apr 19 07:04 oracle


[root@khm5 bin]# chmod +s oracle

[root@khm5 bin]# ls -l oracle

-rwsr-s--x 1 oracle asmadmin 232399473 Apr 19 07:04 oracle

修改完后問題解決,我們能夠看到ASM磁盤組信息了。

【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝


  1. ora-15077,ASM磁盤組不能掛載

一、現(xiàn)象分析:1、數(shù)據(jù)庫和實例服務(wù)無法啟動,如下:[oracle@rac1 ~]$ crs_stat -tName Type Target State Host------------------------------------------------------------ora.....CRM.cs application ONLINE OFFLINE rac1ora....cl1.srv application ONLINE OFFLINE rac1ora.orcl.db application ONLINE OFFLINE rac2ora....l1.inst application ONLINE OFFLINE rac1ora....l2.inst application ONLINE OFFLINE rac2ora....SM1.asm application ONLINE ONLINE rac1ora....C1.lsnr application ONLINE ONLINE rac1ora.rac1.gsd application ONLINE ONLINE rac1ora.rac1.ons application ONLINE ONLINE rac1ora.rac1.vip application ONLINE ONLINE rac1ora....SM2.asm application ONLINE ONLINE rac2ora....C2.lsnr application ONLINE ONLINE rac2ora.rac2.gsd application ONLINE ONLINE rac2ora.rac2.ons application ONLINE ONLINE rac2ora.rac2.vip application ONLINE ONLINE rac22、單獨啟動某個應(yīng)用服務(wù)依然啟不起來3、用sqlplus啟動實例,如下:[oracle@rac1]$ export ORACLE_SID=devdb1SQL> startup;ORA-01078: failure in processing system parametersORA-01565: error in identifying file '+DG1/devdb/spfiledevdb.ora'ORA-17503: ksfdopn:2 Failed to open file +DG1/devdb/spfiledevdb.oraORA-15077: could not locate ASM instance serving a required diskgroup可以看出diskgroup沒有mount,所以先把diskgroup mount

也可做下面的測試,同樣也會報磁盤組沒掛載:[oracle@rac1 bdump]$ export ORACLE_SID=+ASM1[oracle@rac1 bdump]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Sat Mar 22 17:59:39 2008

Copyright (c) 1982, 2005, Oracle. All rights reserved.

Connected to:Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - ProductionWith the Partitioning, Real Application Clusters, OLAP and Data Mining options

SQL> shutdown immediate;ORA-15100: invalid or missing diskgroup name

ASM instance shutdownSQL> startup;ASM instance started

Total System Global Area 92274688 bytesFixed Size 1217884 bytesVariable Size 65890980 bytesASM Cache 25165824 bytesORA-15110: no diskgroups mounted

二、解決辦法:1、首先掛載ASM磁盤組[oracle@rac1 bdump]$ export ORACLE_SID=+ASM1[oracle@rac1 bdump]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Sat Mar 22 17:59:39 2008

Copyright (c) 1982, 2005, Oracle. All rights reserved.

Connected to:Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - ProductionWith the Partitioning, Real Application Clusters, OLAP and Data Mining optionsSQL> select name,state from v$asm_diskgroup;

NAME STATE------------------------------ -----------RECOVERYDEST DISMOUNTEDDG1 DISMOUNTED

SQL> alter diskgroup RECOVERYDEST mount;

Diskgroup altered.

SQL> alter diskgroup DG1 mount;

Diskgroup altered.

SQL> exitDisconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - ProductionWith the Partitioning, Real Application Clusters, OLAP and Data Mining options

2、啟動數(shù)據(jù)庫實例[oracle@rac1 bdump]$ export ORACLE_SID=devdb1[oracle@rac1 bdump]$ sqlplus / as sysdbaSQL> startup;ORACLE instance started.

Total System Global Area 264241152 bytesFixed Size 1218868 bytesVariable Size 109053644 bytesDatabase Buffers 150994944 bytesRedo Buffers 2973696 bytesDatabase mounted.database open.

三、原因:發(fā)現(xiàn)可能是因為oracle用戶下的.bashrc文件中$ORACLE_SID環(huán)境變量與實際建庫的數(shù)據(jù)庫名不一致所至,所以在數(shù)據(jù)庫啟動時會找不到環(huán)境變量對應(yīng)的實例名.bashrc中是orcl1[oracle@rac1~]cat .bashrc.....export ORACLE_SID=orcl1.....

而實現(xiàn)的實例名是devdb1所以修改.bashrc中的ORACLE_SID=devdb1

 





About Me

...............................................................................................................................

● 本文作者:小麥苗,只專注于數(shù)據(jù)庫的技術(shù),更注重技術(shù)的運用

● 本文在itpub(http://blog.itpub.net/26736162)、博客園(http://www.cnblogs.com/lhrbest)和個人微信公眾號(xiaomaimiaolhr)上有同步更新

● 本文itpub地址:http://blog.itpub.net/26736162/abstract/1/

● 本文博客園地址:http://www.cnblogs.com/lhrbest

● 本文pdf版及小麥苗云盤地址:http://blog.itpub.net/26736162/viewspace-1624453/

● 數(shù)據(jù)庫筆試面試題庫及解答:http://blog.itpub.net/26736162/viewspace-2134706/

● QQ群:230161599     微信群:私聊

● 聯(lián)系我請加QQ好友(646634621),注明添加緣由

● 于 2017-07-01 09:00 ~ 2017-07-31 22:00 在魔都完成

● 文章內(nèi)容來源于小麥苗的學習筆記,部分整理自網(wǎng)絡(luò),若有侵權(quán)或不當之處還請諒解

● 版權(quán)所有,歡迎分享本文,轉(zhuǎn)載請保留出處

...............................................................................................................................

拿起手機使用微信客戶端掃描下邊的左邊圖片來關(guān)注小麥苗的微信公眾號:xiaomaimiaolhr,掃描右邊的二維碼加入小麥苗的QQ群,學習最實用的數(shù)據(jù)庫技術(shù)。

【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝
【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝
【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝

向AI問一下細節(jié)

免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI