zoukankan      html  css  js  c++  java
  • Linux下搭建Oracle11g RAC(3)----创建用户及配置相关文件

     

    配置11gR2 RAC需要安装Oracle Grid Infrastructure软件、Oracle数据库软件,其中Grid软件等同于Oracle 10g的Clusterware集群件。Oracle建议以不同的用户分别安装Grid Infrastructure软件、Oracle数据库软件,我们这里以grid用户安装Grid Infrastructure,oracle用户安装Oracle数据库软件。并且grid、oracle用户需要属于不同的用户组。在配置RAC时,还要求这两个用户在RAC的不同节点上uid、gid要一致。用户、组的对应信息见下表:

    Group Name

    Group ID

    Group Info

    Oracle User(1100)

    Grid User(1101)

    oinstall

    1000

    Inventory Group

    Y

    Y

    dba

    1300

    OSDBA Group

    Y

     

    oper

    1301

    OSOPER Group

    Y

     

    asmadmin

    1200

    OSASM 

     

    Y

    asmdba

    1201

    OSDBA for ASM

    Y

    Y

    asmoper

    1202

    OSOPER for ASM 

     

    Y

     

    1.创建用户和组

    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 -u 1100 -g oinstall -G asmadmin,asmdba,asmoper,dba -d /home/grid -s /bin/bash -c "grid Infrastructure Owner" grid
    echo "grid" | passwd --stdin grid2014
    echo "export TMP=/tmp">> /home/grid/.bash_profile
    echo 'export TMPDIR=$TMP'>>/home/grid/.bash_profile
    echo "export ORACLE_SID=+ASM1">> /home/grid/.bash_profile
    echo "export ORACLE_BASE=/u01/app/grid">> /home/grid/.bash_profile
    echo "export ORACLE_HOME=/u01/app/11.2.0/grid">> /home/grid/.bash_profile
    echo "export ORACLE_TERM=xterm">> /home/grid/.bash_profile
    echo 'export PATH=/usr/sbin:$PATH'>> /home/grid/.bash_profile
    echo 'export PATH=$ORACLE_HOME/bin:$PATH'>> /home/grid/.bash_profile
    echo 'export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib'>> /home/grid/.bash_profile
    echo "export EDITOR=vi" >> /home/grid/.bash_profile
    echo "umask 022">> /home/grid/.bash_profile

    useradd -u 1101 -g oinstall -G dba,oper,asmdba -d /home/oracle -s /bin/bash -c "Oracle Software Owner" oracle
    echo "oracle" | passwd --stdin oracle2014
    echo "export TMP=/tmp">> /home/oracle/.bash_profile
    echo 'export TMPDIR=$TMP'>>/home/oracle/.bash_profile
    echo "export ORACLE_HOSTNAME=rac1.db.com">> /home/oracle/.bash_profile
    echo "export ORACLE_SID=orcl1">> /home/oracle/.bash_profile
    echo "export ORACLE_BASE=/u01/app/oracle">> /home/oracle/.bash_profile
    echo 'export ORACLE_HOME=$ORACLE_BASE/11.2.0/db_1'>> /home/oracle/.bash_profile
    echo "export ORACLE_TERM=xterm">> /home/oracle/.bash_profile
    echo 'export PATH=/usr/sbin:$PATH'>> /home/oracle/.bash_profile
    echo 'export PATH=$ORACLE_HOME/bin:$PATH'>> /home/oracle/.bash_profile
    echo 'export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib'>> /home/oracle/.bash_profile
    echo "export EDITOR=vi" >> /home/oracle/.bash_profile
    echo "umask 022">> /home/oracle/.bash_profile

    测试

    [root@node1 shell]# id grid

    uid=1100(grid) gid=1000(oinstall) groups=1000(oinstall),1200(asmadmin),1201(asmdba),1202(asmoper)

    [root@node1 shell]# id oracle

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

    [root@node1 shell]#    

    说明:在节点node2上执行该脚本时,需要将grid用户环境变量ORACLE_SID修改为+ASM2,oracle用户环境变量ORACLE_SID修改为devdb2,ORACLE_HOSTNAME环境变量修改为node2.localdomain

    2.建路径、改权限

    关于grid、oracle用户的环境变量配置信息,见下述表格。

    Environment Variable

    Grid User

    Oracle User

    ORACLE_BASE

    /u01/app/grid

    /u01/app/oracle

    ORACLE_HOME

    /u01/app/11.2.0/grid

    /u01/app/oracle/product/11.2.0/db_1

    ORACLE_SID [node1]

    +ASM1

    devdb1

    ORACLE_SID [node2]

    +ASM2

    devdb2

     

    mkdir -p /u01/app/grid
    mkdir -p /u01/app/11.2.0/grid
    mkdir -p /u01/app/oracle
    chown -R oracle:oinstall /u01
    chown -R grid:oinstall /u01/app/grid
    chmod -R 775 /u01

    [root@node1 shell]# cd /u01/app/

    [root@node1 app]# ll

    total 12

    drwxrwxr-x 3 grid   oinstall 4096 Apr 24 10:06 11.2.0

    drwxrwxr-x 2 grid   oinstall 4096 Apr 24 10:06 grid

    drwxrwxr-x 2 oracle oinstall 4096 Apr 24 10:06 oracle

    [root@node1 app]# 

     

    3. 修改/etc/security/limits.conf,配置oracle、grid用户的shell限制

    cp /etc/security/limits.conf /etc/security/limits.conf.bak
    echo "oracle soft nproc 2047" >>/etc/security/limits.conf
    echo "oracle hard nproc 16384" >>/etc/security/limits.conf
    echo "oracle soft nofile 1024" >>/etc/security/limits.conf
    echo "oracle hard nofile 65536" >>/etc/security/limits.conf
    echo "grid soft nproc 2047" >>/etc/security/limits.conf
    echo "grid hard nproc 16384" >>/etc/security/limits.conf
    echo "grid soft nofile 1024" >>/etc/security/limits.conf
    echo "grid hard nofile 65536" >>/etc/security/limits.conf

    4. 修改/etc/pam.d/login配置文件

       

    cp /etc/pam.d/login /etc/pam.d/login.bak
    echo "session required /lib/security/pam_limits.so" >>/etc/pam.d/login
    echo "session required pam_limits.so" >>/etc/pam.d/login

     

    5. 修改/etc/profile文件

     

    cp /etc/profile /etc/profile.bak
    echo 'if [ $USER = "oracle" ]||[ $USER = "grid" ]; then' >> /etc/profile
    echo 'if [ $SHELL = "/bin/ksh" ]; then' >> /etc/profile
    echo 'ulimit -p 16384' >> /etc/profile
    echo 'ulimit -n 65536' >> /etc/profile
    echo 'else' >> /etc/profile
    echo 'ulimit -u 16384 -n 65536' >> /etc/profile
    echo 'fi' >> /etc/profile
    echo 'fi' >> /etc/profile

    6.修改内核配置文件

    cp /etc/sysctl.conf /etc/sysctl.conf.bak
    echo "fs.aio-max-nr = 1048576" >> /etc/sysctl.conf
    echo "fs.file-max = 6815744" >> /etc/sysctl.conf
    echo "kernel.shmall = 2097152" >> /etc/sysctl.conf
    echo "kernel.shmmax = 1054472192" >> /etc/sysctl.conf
    echo "kernel.shmmni = 4096" >> /etc/sysctl.conf
    echo "kernel.sem = 250 32000 100 128" >> /etc/sysctl.conf
    echo "net.ipv4.ip_local_port_range = 9000 65500" >> /etc/sysctl.conf
    echo "net.core.rmem_default = 262144" >> /etc/sysctl.conf
    echo "net.core.rmem_max = 4194304" >> /etc/sysctl.conf
    echo "net.core.wmem_default = 262144" >> /etc/sysctl.conf
    echo "net.core.wmem_max = 1048586" >> /etc/sysctl.conf
    echo "net.ipv4.tcp_wmem = 262144 262144 262144" >> /etc/sysctl.conf
    echo "net.ipv4.tcp_rmem = 4194304 4194304 4194304" >> /etc/sysctl.conf

    7. 停止ntp服务,11gR2新增的检查项

    [root@node1 ~]# service ntpd status

    ntpd is stopped

    [root@node1 ~]# chkconfig ntpd off

    [root@node1 ~]# cat /etc/ntp

    ntp/      ntp.conf  

    [root@node1 ~]# cp /etc/ntp.conf /etc/ntp.conf.bak

    [root@node1 ~]# rm -rf /etc/ntp.conf

    [root@node1 ~]# 

    8. node2准备工作

    我们已经在node1完成基本准备配置工作,在node2上重复上述1到7中准备工作,以完成节点2的准备工作。

  • 相关阅读:
    Chrome80调整SameSite策略对IdentityServer4的影响以及处理方案(翻译)
    IdentityServer4源码解析_4_令牌发放接口
    IdentityServer4源码解析_3_认证接口
    IdentityServer4源码解析_2_元数据接口
    IdentityServer4源码解析_1_项目结构
    AspNetCore3.1_Secutiry源码解析_8_Authorization_授权框架
    AspNetCore3.1_Secutiry源码解析_7_Authentication_其他
    AspNetCore3.1_Secutiry源码解析_6_Authentication_OpenIdConnect
    AspNetCore3.1_Secutiry源码解析_5_Authentication_OAuth
    AspNetCore3.1_Secutiry源码解析_4_Authentication_JwtBear
  • 原文地址:https://www.cnblogs.com/SUN-PH/p/4056267.html
Copyright © 2011-2022 走看看