• ORACLE LINUX 6.3 + ORACLE 11.2.0.3 RAC + VBOX安装文档


    ORACLE LINUX 6.3 + ORACLE 11.2.0.3 RAC + VBOX安装文档

     分类:

    VBOX + Oracle Linux 6U3 + ORACLE 11.2.0.3.0 RAC 安装

    环境:

    虚拟机          VIRTUAL BOX

    OS                ORACLE LINUX 6.3_X86_64

    ORACLE     11.2.0.3.0_X86_64



    1, 安装VITUAL BOX,略过.
    2, 安装ORACLE LINUX 6U3虚拟机,安装时只需选桌面选项.
    硬件配置 CPU 1个,内存2048GB,硬盘100GB,共享磁盘30GB(6个5GB共享磁盘,固定大小,3块用于ASM,3块用于ORACLE)每3块使用grid 的asmca命令创建一个ADMDISK ,2块网卡(其中一块桥接,另一块内部网络),

    3, 配置配置网络环境,
    服务器1主机名 rac1    公网桥接网卡IP:192.168.2.10   网关:192.168.2.1 私网内部网卡IP:172.168.1.10  子网掩码均为:255.255.255.0  
    服务器2主机名 rac2    公网桥接网卡IP:192.168.2.11   网关:192.168.2.1 私网内部网卡IP:172.168.1.11  子网掩码均为:255.255.255.0

    4,并开机自动激活。增加/etc/hosts文件如下

    #public 
    192.168.2.10   rac1   rac1.fengg.com
    192.168.2.11   rac2   rac2.fengg.com

    #vip
    192.168.2.12   rac1-vip  
    192.168.2.13   rac2-vip

    #scan
    192.168.2.18   rac-cluster rac-cluster-scan

    #priv
    172.168.1.10   rac1-priv
    172.168.1.11   rac2-priv

    #public、vip、scan在同一网段,priv在同一网段

    5,关闭FIREWALL和DISABLE SELINUX等服务
    vim /etc/selinux/config   ==> SELINUX=disabled
    [root@RAC1 ~]# chkconfig --level 35 iptables off
    [root@RAC1 ~]# chkconfig --level 35 ip6tables off
    [root@RAC1 ~]# chkconfig --level 35 atd off
    [root@RAC1 ~]# chkconfig --level 35 postfix off
    [root@RAC1 ~]# chkconfig --level 35 bluetooth off

    6, 创建用户、组、目录并设置口令
    groupadd -g 5000 asmadmin
    groupadd -g 5001 asmdba
    groupadd -g 5002 asmoper
    groupadd -g 6000 oinstall
    groupadd -g 6001 dba
    groupadd -g 6002 oper 

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

    echo 'oracle' | passwd --stdin oracle
    echo 'oracle' | passwd --stdin grid

    mkdir /s01
    mkdir /g01

    chown oracle:oinstall /s01
    chown grid:oinstall   /g01


    7, 使用yum 安装oracle-rdbms-server-11gR2-preinstall,准备RAC安装环境
    [root@rac1 ~]# cd /etc/yum.repos.d
    [root@rac1 yum.repos.d]# mv public-yum-ol6.repo public-yum-ol6.repo.bak
    [root@rac1 yum.repos.d]# vim public-yum-ol6.repo

    [oel6]
    name = Enterprise Linux 6.3 DVD
    baseurl=file:///media/"OL6.3 x86_64 Disc 1 20120626"/Server
    gpgcheck=0
    enabled=1

    [root@rac1 ~]# yum install oracle-rdbms-server-11gR2-preinstall*
    vim /etc/security/limits.conf
    #在文件最后增加以下行
    # grid-rdbms-server-11gR2-preinstall setting for nofile soft limit is 1024
    grid   soft   nofile    1024

    # grid-rdbms-server-11gR2-preinstall setting for nofile hard limit is 65536
    grid   hard   nofile    65536

    # grid-rdbms-server-11gR2-preinstall setting for nproc soft limit is 2047
    grid   soft   nproc    2047

    # grid-rdbms-server-11gR2-preinstall setting for nproc hard limit is 16384
    grid   hard   nproc    16384

    # grid-rdbms-server-11gR2-preinstall setting for stack soft limit is 10240KB
    grid   soft   stack    10240

    # grid-rdbms-server-11gR2-preinstall setting for stack hard limit is 32768KB
    grid   hard   stack    32768

    8, 克隆RAC2虚拟机并修改RAC2的主机名和IP地址
    9, 配置两台服务器挂载共享存储

    [root@RAC1 ~]# for i in b c d e f g ;
    do
    echo "KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="`/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/sd$i`", NAME="asm-disk$i", OWNER="grid", GROUP="asmadmin", MODE="0660""      >> /etc/udev/rules.d/99-oracle-asmdevices.rules
    done


    [root@RAC2 ~]# for i in b c d e f g ;
    do
    echo "KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="`/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/sd$i`", NAME="asm-disk$i", OWNER="grid", GROUP="asmadmin", MODE="0660""      >> /etc/udev/rules.d/99-oracle-asmdevices.rules
    done

     /sbin/start_udev
     
    10, 配置root、grid、oracle 用户profile 
     
    mkdir /g01/orabase 
     
    RAC1节点:
    export GRID_HOME=/g01/11ggrid/app/11.2.0/grid
    export ORACLE_HOME=/g01/11ggrid/app/11.2.0/grid
    export PATH=$GRID_HOME/bin:$GRID_HOME/OPatch:/sbin:/bin:/usr/sbin:/usr/bin

    export ORACLE_SID=+ASM1
    export LD_LIBRARY_PATH=$GRID_HOME/lib:$GRID_HOME/lib32

    export ORACLE_BASE=/g01/orabase
    #export ORA_NLS10=$ORACLE_HOME/nls/data
    export NLS_LANG="Simplified Chinese"_China.AL32UTF8
     
    RAC2节点:
    export GRID_HOME=/g01/11ggrid/app/11.2.0/grid
    export ORACLE_HOME=/g01/11ggrid/app/11.2.0/grid
    export PATH=$GRID_HOME/bin:$GRID_HOME/OPatch:/sbin:/bin:/usr/sbin:/usr/bin

    export ORACLE_SID=+ASM2
    export LD_LIBRARY_PATH=$GRID_HOME/lib:$GRID_HOME/lib32

    export ORACLE_BASE=/g01/orabase
    #export ORA_NLS10=$ORACLE_HOME/nls/data
    export NLS_LANG="Simplified Chinese"_China.AL32UTF8


    RAC1和RAC2节点root用户的环境变量
    export GRID_HOME=/g01/11ggrid/app/11.2.0/grid
    export ORACLE_HOME=/g01/11ggrid/app/11.2.0/grid
    export PATH=$GRID_HOME/bin:$GRID_HOME/OPatch:/sbin:/bin:/usr/sbin:/usr/bin

    RAC1节点oracle用户的环境变量
    mkdir /s01/orabase

    export ORACLE_HOME=/s01/orabase/app/oracle/product/11.2.0/dbhome_1
    export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:/sbin:/bin:/usr/sbin:/usr/bin
    export ORACLE_SID=RAC1
    export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/lib32
    export ORACLE_BASE=/s01/orabase
    #export ORA_NLS10=$ORACLE_HOME/nls/data
    export NLS_LANG="Simplified Chinese"_China.AL32UTF8


    RAC2节点oracle用户的环境变量
    mkdir /s01/orabase


    export ORACLE_HOME=/s01/orabase/app/oracle/product/11.2.0/dbhome_1
    export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:/sbin:/bin:/usr/sbin:/usr/bin

    export ORACLE_SID=RAC2
    export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/lib32

    export ORACLE_BASE=/s01/orabase
    #export ORA_NLS10=$ORACLE_HOME/nls/data
    export NLS_LANG="Simplified Chinese"_China.AL32UTF8
     
    11, 安装LINUX下的XTERM软件支持xmanger图型化界面 yum install xterm*
    12, 安装GRID CLUSTWARE 软件,不选gns选项.
    注意:预安装检查失败可以忽略
    Device check for asm       warning no  
    Network Time Protocol(NTP) warning no  
    Task resolv.conf integrity failed  no

    安装完失败以下选项可以忽略
    oracleoracle cluster verification utility failed, configure oracle grid infrastructure for a cluster failed 

    13, 再安装ORACLE 软件
     
    14. 在RAC1和RAC2节点grid、oracle 打PSU补丁,补丁文件p14727347_112030_Linux-x86-64.zip,unzip 解压到/tmp/patch 目录下,升级PSU之前先升级opatch命令软件,软件包为p6880880_112000_Linux-x86-64.zip,解压到grid home目录下覆盖Opatch目录
    opatch lspatches  ==> 检查PSU补丁
    su - root
    $GRID_HOME/crs/install/rootcrs.pl -unlock
    AIX上: su - root;  slibclean

    su -  grid 
    opatch napply -oh $GRID_HOME -local /tmp/patch/14727310/
    opatch napply -oh $GRID_HOME -local /tmp/patch/15876003/

    su - oracle
    [oracle@rac1 scripts]$ /tmp/patch/15876003/custom/server/15876003/custom/scripts/prepatch.sh -dbhome $ORACLE_HOME
    /tmp/patch/15876003/custom/server/15876003/custom/scripts/prepatch.sh completed successfully.

    #注意patch权限
    opatch napply -oh $ORACLE_HOME -local /tmp/patch/15876003/custom/server/15876003
    opatch napply -oh $ORACLE_HOME -local /tmp/patch/14727310

    /tmp/patch/15876003/custom/server/15876003/custom/scripts/postpatch.sh -dbhome $ORACLE_HOME

    su - root
    [root@RAC1 ~]# /g01/11ggrid/app/11.2.0/grid/rdbms/install/rootadd_rdbms.sh 
    [root@RAC1 ~]# /g01/11ggrid/app/11.2.0/grid/crs/install/rootcrs.pl -patch

    15,使用DBCA安装ORACLE数据库

    16,RAC监听安装完GRID自动创建,tnsnames.ora文件及相关命令如下:

    /usr/bin/xterm -ls -display $DISPLAY

    crsctl stat res -t
    crsctl check crs
    asmcmd
    asmcmd>lsdg
    ASMCMD> lsdsk
    crs_stat|grep vip
    crsctl stat res ora.scan1.vip
    crsctl stat res ora.scan1.vip -p
    crsctl stat res ora.net1.network
    crsctl stat res ora.net1.network -p
    opatch auto
    opatch lspatches
    opatch version
    opatch lsinventory
    crsctl check has
    crsctl check crs
    crsctl stop has -f
    crsctl start has
    srvctl stop database -d rac
    srvctl start database -d rac
    srvctl status database -d rac
    srvctl config database -d rac
    crsctl stop cluster -all
    crsctl start cluster -all
    crsctl start cluster -n rac1  rac2
    crsctl status resource -t
    crsctl check cluster 
    crsctl check ctss
    srvctl status asm -a
    cluvfy comp clocksync -verkbose
    olsnodes -n
    ocrcheck
    crsctl query css votedisk
    crs_stat -t -v


    crsctl start cluster -all
    crsctl stop cluster -all
    srvctl start database -d rac
    srvctl stop  database -d rac


    show parameter cluster_database;
    show parameter local_listener;
    show parameter remote_listener;
    select * from v$instance;
    select * from gv$instance;


    参看集群状态
    crs_stat -t  
    查看集群资源信息
    srvctl config database -d rac -a  
    查看连接信息
    srvctl config database -d rac -t  
    查看服务信息
    srvctl config service  -d rac -a  
    srvctl config service  -d rac -s rac 
    srvctl config service  -d rac -s rac -a 
    查看ASM信息
    srvctl config asm -n rac1  
    srvctl config asm -n rac2 
    查看监听信息
    srvctl config listener -n rac1     
    srvctl config listener -n rac2
    查看数据库状态
    srvctl  status database -d rac 
    srvctl  status database -d rac -v


    查看监听状态
    srvctl status instance -d rac -i rac1,rac2
    srvctl status instance -d rac -i rac1,rac2 -v


    查看节点应用状态
    srvctl status nodeapps -n rac1
    srvctl status nodeapps -n rac2


    查看节点ASM状态
    srvctl status asm -n rac1
    srvctl status asm -n rac2


    关闭当前所连接的实例
    srvctl  stop instance -i rac1 -d rac -o abort
    打开当前实例
    srvctl  start instance -i rac1 -d rac


    设定服务TAF模式为BASIC
    RAC =
      (DESCRIPTION =
        (ADDRESS = (PROTOCOL = TCP)(HOST = rac1-vip)(PORT = 1521))
        (ADDRESS = (PROTOCOL = TCP)(HOST = rac2-vip)(PORT = 1521))
        (LOAD_BALANCE = yes)
        (CONNECT_DATA =
          (SERVER = DEDICATED)
          (SERVICE_NAME = rac)
          (FAILOVER_MODE =
            (TYPE = SELECT)
            (METHOD = BASIC)
            (RETRIES = 180)
            (DELAY = 5)
          )
        )
      )


      
    客户端TNSNAMES.ORA
    使用数据库 tnsname连接如下:
     
    RAC_12/13 =
      (DESCRIPTION =
        (ADDRESS_LIST =
         (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.2.12)(PORT = 1521))
         (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.2.13)(PORT = 1521))
         (LOAD_BALANCE = yes)
         (FAILOVER=yes)
        )
        (CONNECT_DATA =
          (SERVER=DEDICATED)
          (SERVICE_NAME = RAC)
        )
      )
      




    SELECT x.ksppinm NAME, y.ksppstvl VALUE, x.ksppdesc describ
     FROM SYS.x$ksppi x, SYS.x$ksppcv y
     WHERE x.inst_id = USERENV ('Instance')
     AND y.inst_id = USERENV ('Instance')
     AND x.indx = y.indx
    AND x.ksppinm like '%high%';


    虚拟机可以关闭这个选项,提高性能

    SQL> alter system set "_high_priority_processes"='LMS*' scope=spfile;

    参考来自互联网

  • 相关阅读:
    css 控制溢出文本显示省略号效果
    限制input 文本框复制粘贴
    charCodeAt()方法
    背景全透明 background: transparent
    jQuery 双击事件(dblclick)时,不触发单击事件(click)
    html textarea(文本域)自动换行
    input 文本框无法输入 有光标
    双击鼠标滚动屏幕的代码
    ABP 日志审计 返回值开启 循环引用序列化异常 Self referencing loop detected
    浏览器相关知识点一(前端面试准备)
  • 原文地址:https://www.cnblogs.com/archoncap/p/6188321.html
Copyright © 2020-2023  润新知