• ORACLE-RAC-11G-R2_INSTALL


    ORACLE 11.2.0.3 RAC INSTALL
                                                                           2013-06-09 __Yoon
    挂载镜像:
    mkdir /media/disk
    mount /dev/cdrom /media/disk

    安装oracle-linux依赖的所有包:
    vi /etc/yum.repos.d/public-yum-el5.repo
    [oel5]
    name = Enterprise Linux 5.7 DVD
    baseurl=file:///media/disk/Server/
    gpgcheck=0
    enabled=1

    yum install oracle-validated --执行并安装依赖的包

    修改hosts,配置域名:
    vi /etc/hosts
    # Do not remove the following line, or various programs
    # that require network functionality will fail.
    #127.0.0.1 rac1 localhost.localdomain localhost
    #::1 localhost6.localdomain6 localhost6
    127.0.0.1 localhost
    192.168.228.161 rac1
    192.168.228.168 rac1-vip
    1.1.1.161 rac1-priv
    192.168.228.162 rac2
    192.168.228.169 rac2-vip
    1.1.1.162 rac2-priv
    192.168.228.170 rac-scan

    添加组和用户:
    groupadd -g 1000 oinstall
    groupadd -g 1200 asmadmin
    groupadd -g 1201 asmdba
    groupadd -g 1202 asmoper
    groupadd -g 1300 dba
    groupadd -g 1301 oper
    useradd -m -u 1100 -g oinstall -G asmadmin,asmdba,asmoper -d /home/grid -s /bin/bash grid
    useradd -m -u 1101 -g oinstall -G dba,oper,asmdba -d /home/oracle -s /bin/bash oracle

    创建oralce、grid 密码:
    id oracle
    id grid
    passwd oracle
    passwd grid

    创建安装目录:
    mkdir -p /u01/app/grid/11.2.0
    chown -R grid:oinstall /u01
    mkdir -p /u01/app/oracle/11.2.0/db_1
    chown -R oracle:oinstall /u01/app/oracle
    chmod -R 775 /u01

     配置服务器时间同步:(10g需要配置,在11gR2中不用ntp配置)
    rac1:
    vi /etc/ntp.conf
    server 127.127.1.0
    fudge 127.127.1.0 stratum 11
    driftfile /var/lib/ntp/drift
    broadcastdelay 0.008
    rac2:
    vi /etc/ntp.conf
    server 192.168.228.161 prefer --192.168.228.161为主节点的IP地址
    driftfile /var/lib/ntp/drift
    broadcastdelay 0.008
    /etc/init.d/ntpd restart --重启

    配置SSH: (在10g需要配置ssh通信,在11g R2新特性 无需配置SSH)
    在rac1、rac2:
    su - oracle
    mkdir ~/.ssh
    ssh-keygen -t rsa
    ssh-keygen -t dsa
    在rac1:
    cat ~/.ssh/id_rsa.pub >> ./.ssh/authorized_keys
    cat ~/.ssh/id_dsa.pub >> ./.ssh/authorized_keys
    ssh rac2 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
    ssh rac2 cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
    scp ~/.ssh/authorized_keys rac2:~/.ssh/authorized_keys
    在rac1:
    ssh rac1 date
    ssh rac2 date
    ssh rac1-priv date
    ssh rac2-priv date
    在rac2:
    ssh rac1 date
    ssh rac2 date
    ssh rac1-priv date
    ssh rac2-priv date

    时间同步,配置ctss:  (在11g r2中不需要配置)
    在rac1、rac2:
    /sbin/service ntpd stop
    chkconfig ntpd off
    mv /etc/ntp.conf /etc/ntp.conf.original
    chkconfig ntpd --list
    rm /var/run/ntpd.pid
    安装完后要确认ctssd处于活动状态,用grid用户输入:
    $ crsctl check ctss

    在grid下配置.bash_profile:
    rac1:
    export ORACLE_SID=+ASM1
    #export ORACLE_SID=+ASM2
    export ORACLE_BASE=/u01/app/grid
    export ORACLE_HOME=/u01/app/grid/11.2.0
    export PATH=$ORACLE_HOME/bin:$PATH:/usr/local/bin/:.
    export TEMP=/tmp
    export TMP=/tmp
    export TMPDIR=/tmp
    umask 022
    rac2:
    #export ORACLE_SID=+ASM1
    export ORACLE_SID=+ASM2
    export ORACLE_BASE=/u01/app/grid
    export ORACLE_HOME=/u01/app/grid/11.2.0
    export PATH=$ORACLE_HOME/bin:$PATH:/usr/local/bin/:.
    export TEMP=/tmp
    export TMP=/tmp
    export TMPDIR=/tmp
    umask 022

    在oracle下配置.bash_profile:
    rac1和rac2: 注意SID
    ORACLE_SID=yoon1; export ORACLE_SID
    #ORACLE_SID=yoon2; export ORACLE_SID
    ORACLE_UNQNAME=yoon; export ORACLE_UNQNAME
    JAVA_HOME=/usr/local/java; export JAVA_HOME
    ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
    ORACLE_HOME=$ORACLE_BASE/11.2.0/db_1; export ORACLE_HOME
    ORACLE_TERM=xterm; export ORACLE_TERM
    NLS_DATE_FORMAT="YYYY:MM:DD HH24:MI:SS"; export NLS_DATE_FORMAT
    NLS_LANG=american_america.ZHS16GBK; export NLS_LANG
    TNS_ADMIN=$ORACLE_HOME/network/admin; export TNS_ADMIN
    ORA_NLS11=$ORACLE_HOME/nls/data; export ORA_NLS11
    PATH=.:${JAVA_HOME}/bin:${PATH}:$HOME/bin:$ORACLE_HOME/bin:$ORA_CRS_HOME/bin
    PATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin
    export PATH
    LD_LIBRARY_PATH=$ORACLE_HOME/lib
    LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/lib
    LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib
    export LD_LIBRARY_PATH
    CLASSPATH=$ORACLE_HOME/JRE
    CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib
    CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib
    CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib
    export CLASSPATH
    THREADS_FLAG=native; export THREADS_FLAG
    export TEMP=/tmp
    export TMPDIR=/tmp
    # ---------------------------------------------------
    # UMASK
    # ---------------------------------------------------
    # Set the default file mode creation mask
    # (umask) to 022 to ensure that the user performing
    # the Oracle software installation creates files
    # with 644 permissions.
    # ---------------------------------------------------
    umask 022

    关闭防火墙:
    Service iptables status
    Service iptables stop
    chkconfig iptables off
    chkconfig iptables --list

    安装ASMlib:
    oracleasm-2.6.18-274.0.0.0.1.el5-2.0.5-1.el5.x86_64.rpm
    oracleasm-2.6.18-274.el5-2.0.5-1.el5.x86_64.rpm
    oracleasm-support-2.1.7-1.el5.x86_64.rpm

    安装配置oracleasm

    /etc/init.d/oracleasm configure
    /etc/init.d/oracleasm createdisk DATA /dev/mapper/Mpath2p1
    /etc/init.d/oracleasm listdisks
    /etc/init.d/oracleasm scandisks

    在grid用户下:

    执行./ runInstaller

    ORACLE-RAC-11G-R2_INSTALL

    ORACLE-RAC-11G-R2_INSTALL

    ORACLE-RAC-11G-R2_INSTALL

    ORACLE-RAC-11G-R2_INSTALL

    ORACLE-RAC-11G-R2_INSTALL

    ORACLE-RAC-11G-R2_INSTALL

    ORACLE-RAC-11G-R2_INSTALL

    ORACLE-RAC-11G-R2_INSTALL

    ORACLE-RAC-11G-R2_INSTALL

    ORACLE-RAC-11G-R2_INSTALL

    ORACLE-RAC-11G-R2_INSTALL

    ORACLE-RAC-11G-R2_INSTALL

    ORACLE-RAC-11G-R2_INSTALL

    ORACLE-RAC-11G-R2_INSTALL

    ORACLE-RAC-11G-R2_INSTALL

    ORACLE-RAC-11G-R2_INSTALL

    ORACLE-RAC-11G-R2_INSTALL

    ORACLE-RAC-11G-R2_INSTALL

    在oracle下执行./ runInstaller,安装数据库软件

    ORACLE-RAC-11G-R2_INSTALL

    ORACLE-RAC-11G-R2_INSTALL

    ORACLE-RAC-11G-R2_INSTALL

    ORACLE-RAC-11G-R2_INSTALL

    ORACLE-RAC-11G-R2_INSTALL

    ORACLE-RAC-11G-R2_INSTALL

    ORACLE-RAC-11G-R2_INSTALL

    ORACLE-RAC-11G-R2_INSTALL

    ORACLE-RAC-11G-R2_INSTALL

    ORACLE-RAC-11G-R2_INSTALL

    ORACLE-RAC-11G-R2_INSTALL

    在grid用户下运行asmca创建ASM磁盘组:

    su - grid

    [grid@rac1 ~]$asmca

    ORACLE-RAC-11G-R2_INSTALL

    ORACLE-RAC-11G-R2_INSTALL

    ORACLE-RAC-11G-R2_INSTALL

    在oracle用户下创建数据库:

    su - oracle

    执行dbca

    ORACLE-RAC-11G-R2_INSTALL

    ORACLE-RAC-11G-R2_INSTALL

    ORACLE-RAC-11G-R2_INSTALL

    ORACLE-RAC-11G-R2_INSTALL

    ORACLE-RAC-11G-R2_INSTALL

    ORACLE-RAC-11G-R2_INSTALL

    ORACLE-RAC-11G-R2_INSTALL

    ORACLE-RAC-11G-R2_INSTALL

    ORACLE-RAC-11G-R2_INSTALL

    ORACLE-RAC-11G-R2_INSTALL

    ORACLE-RAC-11G-R2_INSTALL

    ORACLE-RAC-11G-R2_INSTALL

    OK

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

    Maclean Liu 所创脚本:
    ####udev 创建裸设备脚本#######
    for i in b c d e f g h i j k ;
    do
    echo "KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="`scsi_id -g -u -s /block/sd$i`", NAME="asm-disk$i", OWNER="oracle", GROUP="oinstall", MODE="0660""
    done
    #############################

    udev方式创建裸设备:
    vi /etc/udev/rules.d/60-raw.rules
    ACTION=="add",KERNEL=="sdb1",RUN+="/bin/raw/dev/raw/raw1 %N"
    ACTION=="add",KERNEL=="sdb2",RUN+="/bin/raw/dev/raw/raw2 %N"
    ACTION=="add",KERNEL=="sdb3",RUN+="/bin/raw/dev/raw/raw3 %N"
    ACTION=="add",KERNEL=="raw*",OWNER=="oracle",GROUP=="oinstall", MODE=="0660"
    在root下执行:
    start_udev

    创建完oracleasm组后,无法删除:
    service oracleasm stop
    service oracleasm deletedisk /dev/mapper/mpath2p1
    service oracleasm start
    /etc/init.d/oracleasm scandisks
    /etc/init.d/oracleasm listdisks

    ASM磁盘无法识别几种现象:

    1) gi家目录或者其子目录权限错误

    2)asm磁盘的权限错误

    3)asm实例未启动或者asm磁盘组没有mount上

    4)asm磁盘组资源没有在线

    5)oracle用户的权限错误

    6)oracle($ORACLE_HOME/bin)可执行文件的权限错误
      OK,那我就按照上面的分析结果进行逐一排查:

    1) gi家目录或者其子目录权限错误
    [root@rac1 ~]# ls -ld /u01/app/11.2.0/grid/
    drwxr-x--- 66 root oinstall 4096 Apr 19 01:36 /u02/app/11.2.0/grid/
    我先简单查看了GI的家目录权限,这是正常的。这里想要提醒大家,有些DBA有意无意中看到这样的目录权限,发现所属主是root,以为出了问题,理所应当地通过命令去更改,如果只更改该目录权限问题也不大,回退方法很简单,但一旦加上-R参数递归方式把子目录、子文件的权限一并更改,那故障就发生了。所以,大家在操作的时候不要盲目去做没有把握的事情,掌握每个操作后面的原理以及其带来的后果,以至于充分准备好回退方法.
    2) asm磁盘的权限错误
    [root@rac1 ~]# ls -l /dev/oracleasm/disks/
    total 0
    brw-rw---- 1 grid asmadmin 8, 17 Apr 19 01:22 ASMDISK1
    brw-rw---- 1 grid asmadmin 8, 33 Apr 19 01:22 ASMDISK2
    如果发现权限不对,通过如下命令修改:
    [root@rac1 ~]# oracleasm configure -I
    或者
    [root@rac1 ~]# /etc/init.d/oracleasm configure
    修改之后查看:
    [root@rac1 ~]# oracleasm configure
    ORACLEASM_ENABLED=true
    ORACLEASM_UID=grid
    ORACLEASM_GID=asmadmin
    ORACLEASM_SCANBOOT=true
    ORACLEASM_SCANORDER=""
    ORACLEASM_SCANEXCLUDE=""
    3) asm实例未启动或者asm磁盘组没有mount上
    4) asm磁盘组资源没有在线:
    [grid@rac1 ~]$ crsctl stat res –t
    ---------------------------------------------------------------------
    NAME TARGET STATE SERVER STATE_DETAILS
    --------------------------------------------------------------------------------
    Local Resources
    ---------------------------------------------------------------------
    ora.DATA.dg
    ONLINE ONLINE rac1
    ora.FLASH.dg
    ONLINE ONLINE rac1
    ora.GRID.dg
    ONLINE ONLINE rac1
    ora.LISTENER.lsnr
    ONLINE ONLINE rac1
    ora.asm
    ONLINE ONLINE rac1 Started
    ora.ons
    OFFLINE OFFLINE rac1
    ---------------------------------------------------------------------
    Cluster Resources
    ---------------------------------------------------------------------
    ora.cssd
    1 ONLINE ONLINE rac1
    ora.diskmon
    1 OFFLINE OFFLINE
    ora.evmd
    1 ONLINE ONLINE rac1
    5) oracle用户的权限错误
    [root@rac1 ~]# id oracle
    uid=1101(oracle) gid=1000(oinstall) groups=1000(oinstall),1300(dba),1301(oper),1201(asmdba)
    oracle用户需要加入到asmdba组,如果发现没有加入,进行如下操作:
    [root@rac1 ~]# gpasswd -a oracle asmdba
    Adding user oracle to group asmdba
    6) oracle($ORACLE_HOME/bin)可执行文件的权限错误
    [root@rac1 ~]# su - oracle
    [oracle@rac1 ~]$ cd $ORACLE_HOME/bin
    [oracle@rac1 bin]$ ls -l oracle
    -rwsr-s--x 1 oracle oinstall 232399473 Apr 19 07:04 oracle
    oracle可执行文件的权限不正确:
    [root@rac1 ~]# cd /u01/app/oracle/product/11.2.0/dbhome_1/bin/
    [root@rac1 bin]# chown oracle.asmadmin oracle
    [root@rac1 bin]# ls -l oracle
    -rwxr-x--x 1 oracle asmadmin 232399473 Apr 19 07:04 oracle
    [root@rac1 bin]# chmod +s oracle
    [root@rac1 bin]# ls -l oracle
    -rwsr-s--x 1 oracle asmadmin 232399473 Apr 19 07:04 oracle

  • 相关阅读:
    毫秒级从百亿大表任意维度筛选数据,是怎么做到的...
    编译时异常和运行时异常的区别
    ajax同步与异步的区别
    jdk、jre、jvm三者联系
    java可变参数
    String 堆内存和栈内存
    构造方法
    为什么成员变量不用先初始化
    Javascript 创建对象方法的总结
    Java四种读取和创建XML文档的例子教程
  • 原文地址:https://www.cnblogs.com/hankyoon/p/5174635.html
Copyright © 2020-2023  润新知