zoukankan      html  css  js  c++  java
  • rac(二)

    vi /etc/hosts

    两个节点都执行

    #Public IP
    10.10.10.10 shdb1
    10.10.10.20 shdb2

    #Virtual IP
    10.10.10.30 shdb1-vip
    10.10.10.40 shdb2-vip

    #Private IP1
    192.168.7.10 shdb1-priv1
    192.168.7.20 shdb2-priv1

    #Private IP2
    192.168.8.10 shdb2-priv1
    192.168.8.20 shdb2-priv2

    #Scan IP
    10.10.10.50 shdb-scan

    创建oracle、grig用户和组

    groupadd -g 501 oinstall
    groupadd -g 502 dba
    groupadd -g 503 oper
    groupadd -g 504 asmadmin
    groupadd -g 505 asmdba
    groupadd -g 506 asmoper
    useradd -u 501 -g oinstall -G dba,oper,asmdba,asmadmin oracle -m
    useradd -u 502 -g oinstall -G dba,asmadmin,asmdba,asmoper,oper grid -m

    创建密码
    passwd grid

    passwd oracle

    (3) 创建安装目录

    mkdir -p /opt/app/{grid,oracle}
    mkdir -p /opt/app/oracrs/grid
    chown -R grid:oinstall /opt
    chown -R oracle:oinstall /opt/app/oracle
    chmod -R 775 /opt

    db1:/u01 # ls -l /opt/app/
    total 12
    drwxrwxr-x 2 grid oinstall 4096 Nov 14 15:47 grid
    drwxrwxr-x 2 oracle oinstall 4096 Nov 14 15:47 oracle
    drwxrwxr-x 3 grid oinstall 4096 Nov 14 15:47 oracrs

    配置db1节点grid用户的profile,ORACLE_SID为+ASM1,db2节点改为+ASM2
    su - grid
    vi .profile
    -------------------------------------------------------------------------------------------------------
    export ORACLE_SID=+ASM1
    export ORACLE_BASE=/opt/app/grid
    export ORACLE_HOME=/opt/app/oracrs/grid
    export PATH=$PATH:$ORACLE_HOME/bin
    export TMP=/tmp
    export TMPDIR=$TMP
    export NLS_DATE_FORMAT="yyyy-mm-ddHH24:MI:SS"
    export THREADS_FLAG=native
    export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
    export CVUQDISK GRP=oinstall


    source .profile


    ----节点2-----
    su - grid
    vi .profile

    export ORACLE_SID=+ASM2
    export ORACLE_BASE=/opt/app/grid
    export ORACLE_HOME=/opt/app/oracrs/grid
    export PATH=$PATH:$ORACLE_HOME/bin
    export TMP=/tmp
    export TMPDIR=$TMP
    export NLS_DATE_FORMAT="yyyy-mm-ddHH24:MI:SS"
    export THREADS_FLAG=native
    export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
    export CVUQDISK GRP=oinstall

    export ORACLE_SID=shinfo1
    export ORACLE_BASE=/opt/app/oracle
    export ORACLE_HOME=$ORACLE_BASE/product
    export PATH=$ORACLE_HOME/bin:/usr/sbin:$PATH
    export TMP=/tmp
    export TMPDIR=$TMP
    export ORACLE_TERM=xterm
    export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/usr/lib64
    export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
    export NLS_DATE_FORMAT="yyyy-mm-ddHH24:MI:SS"
    export NLS_LANG=AMERICAN_AMERICA.AL32UTF8

    -----节点2------
    export ORACLE_SID=shinfo2
    export ORACLE_BASE=/opt/app/oracle
    export ORACLE_HOME=$ORACLE_BASE/product
    export PATH=$ORACLE_HOME/bin:/usr/sbin:$PATH
    export TMP=/tmp
    export TMPDIR=$TMP
    export ORACLE_TERM=xterm
    export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/usr/lib64
    export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
    export NLS_DATE_FORMAT="yyyy-mm-ddHH24:MI:SS"
    export NLS_LANG=AMERICAN_AMERICA.AL32UTF8

    source .profile


    两节点修改内核参数配置

    1. 修改/etc/sysctl.conf配置

    vi /etc/sysctl.conf

    kernel.shmmax = 139586437120
    kernel.shmall = 34078720
    net.core.rmem_default = 262144
    net.core.rmem_max = 4194304
    net.core.wmem_default = 262144
    net.core.wmem_max = 1048576
    net.ipv4.ip_local_port_range = 9000 65500
    fs.aio-max-nr = 1048576
    fs.file-max = 6815744
    kernel.sem = 250 32000 100 128
    kernel.shmmni = 4096

    sysctl -p

    2. 修改/etc/security/limits.conf
    # vi /etc/security/limits.conf

    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

    # vi /etc/pam.d/login

    session required pam_limits.so

    修改文件/etc/pam.d/su,追加以下内容(如果不存在)。
    vi /etc/pam.d/su
    session required pam_limits.so

    修改文件/etc/profile(根据SUSE版本不同,名字可能叫/etc/profile),追加以下内容(如果不存在)。
    vi /etc/profile

    if [ $USER = "oracle" ]; then
    if [ $SHELL = "/bin/ksh" ]; then
    ulimit -u 16384
    ulimit -n 65536
    else
    ulimit -u 16384 -n 65536
    fi
    fi

    source /etc/profile

    设置操作系统的共享内存大小
    操作步骤
    步骤 1 以root用户登录。
    步骤 2 检查操作系统共享内存大小。
    # df -m| grep shm
    Filesystem 1K-blocks Used Available Use% Mounted on
    shm 16777216 1131136 15646080 7% /dev/shm
    如果/dev/shm的文件系统大小为物理内存大小,则表示已经正确设置。否则需要重新设置。
    步骤 3 卸载/dev/shm文件系统。
    # umount /dev/shm


    如果提示“device is busy”则需要停止数据库。
    步骤 4 挂载/dev/shm文件系统。
    内存大小请根据实际情况填写。
    # mount -t tmpfs shmfs -o size=16g /dev/shm
    步骤 5 修改文件/etc/fstab,追加以下内容:
    shm /dev/shm tmpfs size=16g 0 0

    ssh互信
    虽然可以在安装过程中图形化配置互信,
    但提前配置的目的是便于执行安装先决条件检查


    grid用户
    su - grid

    rac1
    ssh-keygen -t rsa

    rac2
    ssh-keygen -t rsa

    rac1
    ssh-copy-id -i ~/.ssh/id_rsa.pub grid@shdb1
    ssh-copy-id -i ~/.ssh/id_rsa.pub grid@shdb2

    rac2
    ssh-copy-id -i ~/.ssh/id_rsa.pub grid@shdb1
    Change_Me
    ssh-copy-id -i ~/.ssh/id_rsa.pub grid@shdb2

    oracle用户
    su - oracle
    rac1
    ssh-keygen -t rsa

    rac2
    ssh-keygen -t rsa

    rac1
    ssh-copy-id -i ~/.ssh/id_rsa.pub oracle@shdb1
    ssh-copy-id -i ~/.ssh/id_rsa.pub oracle@shdb2

    rac2
    ssh-copy-id -i ~/.ssh/id_rsa.pub oracle@shdb1
    ssh-copy-id -i ~/.ssh/id_rsa.pub oracle@shdb2

    service ntp status
    service ntp stop
    mv /etc/ntp.conf /etc/ntp.conf.bak


    for i in "gcc gcc-c++ gcc-32bit glibc-devel glibc-devel-32bit libaio libaio-devel libaio-devel-32bit libstdc++43-devel-32bit libstdc++43-devel sysstat libstdc++-devel libcap1 libcap1-32bit libcap2 libcap2-32bit libgomp unixODBC unixODBC-devel oracleasm";do rpm -q $i;done


    mount -o loop /dev/cdrom2 /mnt/
    db1:~ # cd /etc/zypp/repos.d

    zypper ar file:///mnt/ local-sles


    zypper in gcc gcc-c++ gcc-32bit glibc-devel glibc-devel-32bit libaio libaio-devel libaio-devel-32bit libstdc++43-devel-32bit libstdc++43-devel sysstat libstdc++-devel libcap1 libcap1-32bit libcap2 libcap2-32bit libgomp* unixODBC unixODBC-devel oracleasm

    shdb1:/soft # rpm -ivh oracleasm-support-2.1.8-1.SLE11.x86_64.rpm
    shdb1:/soft # rpm -ivh oracleasmlib-2.0.4-1.sle11.x86_64.rpm

    rpm -qa|grep oracleasm
    oracleasm-2.0.5-7.37.3
    oracleasm-support-2.1.8-1.SLE11
    oracleasmlib-2.0.4-1.SLE11
    oracleasm-kmp-default-2.0.5_3.0.101_63-7.42.33

    创建ASM分区(只需在节点1上创建)


    fdisk /dev/sdb
    fdisk /dev/sdc
    fdisk /dev/sdd
    fdisk /dev/sde
    fdisk /dev/sdf
    fdisk /dev/sdg
    fdisk /dev/sdh

    以sdb为例:
    db1:~ # fdisk /dev/sdb
    Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
    Building a new DOS disklabel with disk identifier 0x381681fc.
    Changes will remain in memory only, until you decide to write them.
    After that, of course, the previous content won't be recoverable.

    Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

    Command (m for help): n
    Command action
    e extended
    p primary partition (1-4)
    p
    Partition number (1-4, default 1): 1
    First sector (2048-4194303, default 2048):
    Using default value 2048
    Last sector, +sectors or +size{K,M,G} (2048-4194303, default 4194303):
    Using default value 4194303

    Command (m for help): w
    The partition table has been altered!

    Calling ioctl() to re-read partition table.
    Syncing disks.
    db1:~ #

    shdb1:/soft # oracleasm init
    Creating /dev/oracleasm mount point: /dev/oracleasm
    Loading module "oracleasm": oracleasm
    Configuring "oracleasm" to use device physical block size
    Mounting ASMlib driver filesystem: /dev/oracleasm
    shdb1:/soft # /etc/init.d/oracleasm configure
    Configuring the Oracle ASM library driver.

    This will configure the on-boot properties of the Oracle ASM library
    driver. The following questions will determine whether the driver is
    loaded on boot and what permissions it will have. The current values
    will be shown in brackets ('[]'). Hitting <ENTER> without typing an
    answer will keep that current value. Ctrl-C will abort.

    Default user to own the driver interface []: grid
    Default group to own the driver interface []: asmadmin
    Start Oracle ASM library driver on boot (y/n) [n]: y
    Scan for Oracle ASM disks on boot (y/n) [y]: y
    Writing Oracle ASM library driver configuration: done
    Initializing the Oracle ASMLib driver: done
    Scanning the system for Oracle ASMLib disks: done


    shdb1:/soft # oracleasm configure
    ORACLEASM_ENABLED=true
    ORACLEASM_UID=grid
    ORACLEASM_GID=asmadmin
    ORACLEASM_SCANBOOT=true
    ORACLEASM_SCANORDER=""
    ORACLEASM_SCANEXCLUDE=""
    ORACLEASM_USE_LOGICAL_BLOCK_SIZE="false"
    shdb1:/soft #

    第二个节点:
    db2:~ # oracleasm init
    Creating /dev/oracleasm mount point: /dev/oracleasm
    Loading module "oracleasm": oracleasm
    Configuring "oracleasm" to use device physical block size
    Mounting ASMlib driver filesystem: /dev/oracleasm
    db2:~ #

    shdb2:~ # /etc/init.d/oracleasm configure
    Configuring the Oracle ASM library driver.

    This will configure the on-boot properties of the Oracle ASM library
    driver. The following questions will determine whether the driver is
    loaded on boot and what permissions it will have. The current values
    will be shown in brackets ('[]'). Hitting <ENTER> without typing an
    answer will keep that current value. Ctrl-C will abort.

    Default user to own the driver interface []: grid
    Default group to own the driver interface []: asmadmin
    Start Oracle ASM library driver on boot (y/n) [n]: y
    Scan for Oracle ASM disks on boot (y/n) [y]: y
    Writing Oracle ASM library driver configuration: done
    Initializing the Oracle ASMLib driver: done
    Scanning the system for Oracle ASMLib disks: done
    shdb2:~ #

    db1:~ # oracleasm listdisks
    查看目前有无配置好的asm磁盘组

    创建ASM
    oracleasm createdisk OCRVOT1 /dev/sdb1
    oracleasm createdisk OCRVOT2 /dev/sdc1
    oracleasm createdisk OCRVOT3 /dev/sdd1
    oracleasm createdisk DATADG1 /dev/sde1
    oracleasm createdisk DATADG2 /dev/sdf1
    oracleasm createdisk DATADG3 /dev/sdg1
    oracleasm createdisk ARCHDG1 /dev/sdh1

    db1:~ # oracleasm listdisks
    ARCHDG1
    DATADG1
    DATADG2
    DATADG3
    OCRVOT1
    OCRVOT2
    OCRVOT3
    db1:~ #


    2. 节点2上扫描ASM共享盘

    shdb2:~ # oracleasm scandisks
    Reloading disk partitions: done
    Cleaning any stale ASM disks...
    Scanning system for ASM disks...
    Instantiating disk "OCRVOT1"
    Instantiating disk "OCRVOT2"
    Instantiating disk "OCRVOT3"
    Instantiating disk "DATADG1"
    Instantiating disk "DATADG2"
    Instantiating disk "DATADG3"
    Instantiating disk "ARCHDG1"
    shdb2:~ #

    shdb2:~ # oracleasm listdisks
    ARCHDG1
    DATADG1
    DATADG2
    DATADG3
    OCRVOT1
    OCRVOT2
    OCRVOT3
    shdb2:~ #

    3. 检查ASM磁盘路径

    oracleasm querydisk /dev/sdb1
    oracleasm querydisk /dev/sdc1
    oracleasm querydisk /dev/sdd1
    oracleasm querydisk /dev/sde1
    oracleasm querydisk /dev/sdf1
    oracleasm querydisk /dev/sdg1
    oracleasm querydisk /dev/sdh1

    关注如下部分内容:
    db1:/soft # oracleasm querydisk /dev/sdb1
    Device "/dev/sdb1" is marked an ASM disk with the label "OCRVOT1"
    db1:/soft # oracleasm querydisk /dev/sdc1
    Device "/dev/sdc1" is marked an ASM disk with the label "OCRVOT2"
    db1:/soft # oracleasm querydisk /dev/sdd1
    Device "/dev/sdd1" is marked an ASM disk with the label "OCRVOT3"
    db1:/soft # oracleasm querydisk /dev/sde1
    Device "/dev/sde1" is marked an ASM disk with the label "DATADG1"
    db1:/soft # oracleasm querydisk /dev/sdf1
    Device "/dev/sdf1" is marked an ASM disk with the label "DATADG2"
    db1:/soft # oracleasm querydisk /dev/sdg1
    Device "/dev/sdg1" is marked an ASM disk with the label "DATADG3"
    db1:/soft # oracleasm querydisk /dev/sdh1
    Device "/dev/sdh1" is marked an ASM disk with the label "ARCHDG1"

    shdb1:~ # ll /dev/oracleasm/disks/
    total 0
    brw-rw---- 1 grid asmadmin 8, 113 Aug 9 00:26 ARCHDG1
    brw-rw---- 1 grid asmadmin 8, 65 Aug 9 00:26 DATADG1
    brw-rw---- 1 grid asmadmin 8, 81 Aug 9 00:26 DATADG2
    brw-rw---- 1 grid asmadmin 8, 97 Aug 9 00:26 DATADG3
    brw-rw---- 1 grid asmadmin 8, 17 Aug 9 00:25 OCRVOT1
    brw-rw---- 1 grid asmadmin 8, 33 Aug 9 00:26 OCRVOT2
    brw-rw---- 1 grid asmadmin 8, 49 Aug 9 00:26 OCRVOT3
    shdb1:~ #

    shdb2:~ # ll /dev/oracleasm/disks/
    total 0
    brw-rw---- 1 grid asmadmin 8, 113 Aug 9 00:27 ARCHDG1
    brw-rw---- 1 grid asmadmin 8, 65 Aug 9 00:27 DATADG1
    brw-rw---- 1 grid asmadmin 8, 81 Aug 9 00:27 DATADG2
    brw-rw---- 1 grid asmadmin 8, 97 Aug 9 00:27 DATADG3
    brw-rw---- 1 grid asmadmin 8, 17 Aug 9 00:27 OCRVOT1
    brw-rw---- 1 grid asmadmin 8, 33 Aug 9 00:27 OCRVOT2
    brw-rw---- 1 grid asmadmin 8, 49 Aug 9 00:27 OCRVOT3
    shdb2:~ #

    查看设备号是否合上面对应一致

    shdb1:~ # ll /dev/sd*
    brw-rw---- 1 root disk 8, 0 Aug 8 15:49 /dev/sda
    brw-rw---- 1 root disk 8, 1 Aug 8 15:49 /dev/sda1
    brw-rw---- 1 root disk 8, 2 Aug 8 15:49 /dev/sda2
    brw-rw---- 1 root disk 8, 3 Aug 8 15:49 /dev/sda3
    brw-rw---- 1 root disk 8, 16 Aug 9 00:21 /dev/sdb
    brw-rw---- 1 root disk 8, 17 Aug 9 00:25 /dev/sdb1
    brw-rw---- 1 root disk 8, 32 Aug 9 00:21 /dev/sdc
    brw-rw---- 1 root disk 8, 33 Aug 9 00:26 /dev/sdc1
    brw-rw---- 1 root disk 8, 48 Aug 9 00:21 /dev/sdd
    brw-rw---- 1 root disk 8, 49 Aug 9 00:26 /dev/sdd1
    brw-rw---- 1 root disk 8, 64 Aug 9 00:21 /dev/sde
    brw-rw---- 1 root disk 8, 65 Aug 9 00:26 /dev/sde1
    brw-rw---- 1 root disk 8, 80 Aug 9 00:21 /dev/sdf
    brw-rw---- 1 root disk 8, 81 Aug 9 00:26 /dev/sdf1
    brw-rw---- 1 root disk 8, 96 Aug 9 00:21 /dev/sdg
    brw-rw---- 1 root disk 8, 97 Aug 9 00:26 /dev/sdg1
    brw-rw---- 1 root disk 8, 112 Aug 9 00:21 /dev/sdh
    brw-rw---- 1 root disk 8, 113 Aug 9 00:26 /dev/sdh1
    shdb1:~ #

  • 相关阅读:
    ZROI2018提高day9t1
    p2114 起床困难综合症
    EZOJ #78
    Linux JDK配置
    jps命令
    虚拟机 网卡模式配置
    redhat下yum命令安装(替换为centos yum命令)
    URL编码
    Query DSL(2)----Full text queries
    Query DSL(1)
  • 原文地址:https://www.cnblogs.com/connected/p/13461253.html
Copyright © 2011-2022 走看看