zoukankan      html  css  js  c++  java
  • Linux环境下Oracle安装参数设置

    前面讲了虚拟机的设置和OracleLinux的安装,接下来我们来说下Oracle安装前的准备工作。
    1、系统信息查看
    系统信息查看
    首先服务器ip:192.168.8.120
    服务器系统:Oracle Linux Server release 6.5
    服务器主机名:oracle-learn
    查看磁盘空间情况:

    [root@oracle-learn ~]# df -h
    Filesystem Size Used Avail Use% Mounted on
    /dev/sda1 32G 4.8G 26G 17% /
    tmpfs 3.9G 224K 3.9G 1% /dev/shm
    /dev/sdc1 197G 60M 187G 1% /oracle
    /dev/sdb1 40G 48M 38G 1% /soft
    

    /oracle目录用于安置oracle
    /soft用于存放oracle等工具安装包
    2、挂载光驱
    在启动系统后,检查虚拟机光驱设置是否选中已连接,如果没有,则选中。
    挂载光驱

    [root@oracle-learn ~]# mount /dev/cdrom /mnt
    mount: block device /dev/sr0 is write-protected, mounting read-only
    

      

    检查是否挂载成功

    [root@oracle-learn ~]# df -h
    Filesystem Size Used Avail Use% Mounted on
    /dev/sda1 32G 4.8G 26G 17% /
    tmpfs 3.9G 224K 3.9G 1% /dev/shm
    /dev/sdc1 197G 60M 187G 1% /oracle
    /dev/sdb1 40G 48M 38G 1% /soft
    /dev/sr0 3.7G 3.7G 0 100% /mnt
    

      

    1、设置yum配置
    修改原yum文件的名称

    [root@oracle-learn ~]# cd /etc/yum.repos.d/
    [root@oracle-learn yum.repos.d]# mv public-yum-ol6.repo public-yum-ol6.repofuben
    [root@oracle-learn yum.repos.d]# ll
    总用量 4
    -rw-r--r--. 1 root root 2545 10月 29 2018 public-yum-ol6.repofuben
    [root@oracle-learn yum.repos.d]# 
    

      

    2、设置yum的配置

    [root@oracle-learn yum.repos.d]# vim /etc/yum.conf 


    添加如下内容:

    [EL]
    name =Oracle Linux 6.5 
    baseurl=file:///mnt/Server/
    gpgcheck=0
    enabled=1


    保存并退出
    测试下是否配置成功

    [root@oracle-learn yum.repos.d]# yum install binutils -y
    

    如果配置成功

    3、安装Oracle需要的软件包

    yum install binutils -y
    yum install compat-libcap1 -y
    yum install compat-libstdc++-33 -y
    yum install gcc -y
    yum install gcc-c++ -y
    yum install glibc -y
    yum install glibc-devel -y
    yum install ksh -y
    yum install libgcc -y
    yum install libstdc++ -y
    yum install libstdc++-devel -y
    yum install libaio -y
    yum install libaio-devel -y
    yum install libXext -y
    yum install libXtst -y
    yum install libX11 -y
    yum install libXau -y
    yum install libxcb -y
    yum install libXi -y
    yum install make -y
    yum install sysstat -y
    yum install unixODBC -y
    yum install unixODBC-devel –y
    

      

    4、hosts文件配置
    编辑/etc/hosts文件,

    [root@db01 /]# vi /etc/hosts
    

      

    在最后添加如下内容:
    192.168.8.120 oracle-learn
    前面是服务器ip,后面是服务器主机名
    5、添加组与用户

    [root@oracle-learn ~]# /usr/sbin/groupadd -g 60001 oinstall
    /usr/sbin/groupadd -g 60002 dba
    [root@oracle-learn ~]# /usr/sbin/groupadd -g 60002 dba
    /usr/sbin/groupadd -g 60003 oper
    [root@oracle-learn ~]# /usr/sbin/groupadd -g 60003 oper
    [root@oracle-learn ~]#/usr/sbin/useradd -u 61002 -g oinstall -G dba oracle 
    [root@oracle-learn ~]# /usr/sbin/useradd -u 61002 -g oinstall -G dba oracle
    

      

    查看oracle用户

    [root@oracle-learn ~]# id oracle
    uid=61002(oracle) gid=60001(oinstall) 组=60001(oinstall),60002(dba)
    [root@oracle-learn ~]# 
    

      

    设置Oracle用户密码

    [root@oracle-learn ~]# passwd oracle
    更改用户 oracle 的密码 。
    新的 密码:
    无效的密码: 它基于字典单词
    无效的密码: 过于简单
    重新输入新的 密码:
    passwd: 所有的身份验证令牌已经成功更新。
    [root@oracle-learn ~]# 
    

    6、添加文件系统
    创建/oracle用以存放oracle

    [root@oracle-learn ~]# cd /oracle
    [root@oracle-learn oracle]# mkdir -p /oracle/app/oracle/product/11.2.0/db_1
    [root@oracle-learn oracle]# chown -R oracle:oinstall /oracle
    [root@oracle-learn oracle]# chmod -R 775 /oracle/
    [root@oracle-learn oracle]# 
    

    7、修改操作系统参数
    7.1修改/etc/security/limits.conf文件;

    [root@oracle-learn oracle]# vi /etc/security/limits.conf
    

    增加内容如下:

    #ORACLE SETTING
    oracle soft nproc 2047
    oracle hard nproc 16384
    oracle soft nofile 1024
    oracle hard nofile 65536
    oracle soft stack 10240
    oracle hard stack 32768
    

      

    7.2修改/etc/security/limits.d/90-nproc.conf文件内容

    [root@oracle-learn oracle]# vi /etc/security/limits.d/90-nproc.conf
    

      

    注释掉

    #* soft nproc 1024
    

    添加

    * - nproc 16384
    

     查看更改的文件

    [root@oracle-learn oracle]# cat /etc/security/limits.d/90-nproc.conf
    # Default limit for number of user's processes to prevent
    # accidental fork bombs.
    # See rhbz #432903 for reasoning.
    
    #* soft nproc 1024
    * - nproc 16384
    root soft nproc unlimited
    [root@oracle-learn oracle]# 
    

     

    7.3禁用SELINUX

    [root@oracle-learn oracle]# vi /etc/selinux/config
    

    SELINUX=enforcing
    改成
    SELINUX=disabled
    让SELINUX生效:

    [root@oracle-learn oracle]# setenforce 0
    

    7.4关闭iptables防火墙
    关闭防火墙

    [root@oracle-learn oracle]# service iptables stop
    iptables:将链设置为政策 ACCEPT:filter [确定]
    iptables:清除防火墙规则: [确定]
    iptables:正在卸载模块: [确定]
    [root@oracle-learn oracle]# 
    

     

    也可以设置永久关闭防火墙

    [root@oracle-learn oracle]# chkconfig iptables off
    [root@oracle-learn oracle]# 
    

      

    7.5修改/etc/pam.d/login文件

    [root@oracle-learn oracle]# vi /etc/pam.d/login
    

     

    添加

    #ORACLE SETTING
    session required pam_limits.so
    

     

    7.6修改sysctl.conf配置文件

    [root@oracle-learn ~]# vi /etc/sysctl.conf
    


    注释
    #kernel.shmmax = 68719476736
    #kernel.shmall = 4294967296
    添加

    #ORACLE SETTING
    fs.aio-max-nr = 1048576
    fs.file-max = 6815744
    kernel.shmmax = 8589934592
    kernel.shmall = 2097152
    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 = 1048586
    

    注释:

    kernel.shmmax和kernel.shmall的计算方法:
    kernel.shmmax大于SGA,小于物理内存
    我这里服务器的内存是8G
    所以kernel.shmmax的值是
    `1024*1024*1024*8=8589934592`
    `kernel.shmmni = 4096`
    `kernel.shmall=kernel.shmmax/4096`

    让配置生效:

    [root@oracle-learn ~]# sysctl -p
    

      

    8、环境变量设置
    切换到oracle用户下

    [root@oracle-learn ~]# su - oracle
    [oracle@oracle-learn ~]$
    

      

    修改环境变量

    [oracle@oracle-learn ~]$ vi ~/.bash_profile
    

      

    添加如下:

    #Oracle Settings oracle
    TMP=/tmp; export TMP
    TMPDIR=$TMP; export TMPDIR
    #export LANG=en_US
    ORACLE_BASE=/oracle/app/oracle; export ORACLE_BASE
    ORACLE_HOME=$ORACLE_BASE/product/11.2.0; export ORACLE_HOME
    ORACLE_SID=orcl; export ORACLE_SID
    ORACLE_TERM=xterm; export ORACLE_TERM
    PATH=/usr/sbin:$PATH; export PATH
    PATH=$ORACLE_HOME/bin:$PATH; export PATH
    LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
    CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH
    NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS"; export NLS_DATE_FORMAT
    NLS_LANG=AMERICAN_AMERICA.ZHS16GBK;export NLS_LANG
    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
    

      

    其中ORACLE_SID=orcl;可以自定义数据库的sid
    退出用户

    [oracle@oracle-learn ~]$ exit
    logout
    [root@oracle-learn ~]# 
    

      

    在登录oracle用户检查环境变量参数

    [root@oracle-learn ~]# su - oracle
    [oracle@oracle-learn ~]$ env |grep ORACLE
    ORACLE_SID=orcl
    ORACLE_BASE=/oracle/app/oracle
    ORACLE_TERM=xterm
    ORACLE_HOME=/oracle/app/oracle/product/11.2.0
    [oracle@oracle-learn ~]$ 
    

      

    至此,Linux环境下Oracle环境准备完毕。

  • 相关阅读:
    树链剖分( 洛谷P3384 )
    ZJOI 2015 诸神眷顾的幻想乡
    BZOJ 1002 [FJOI2007]轮状病毒
    洛谷 P1485 火枪打怪
    Luogu2860 [USACO06JAN]冗余路径Redundant Paths
    CF962F Simple Cycles Edges
    Luogu3605 [USACO17JAN]Promotion Counting晋升者计数
    Luogu2295 MICE
    CF341D Iahub and Xors
    CF617E XOR and Favorite Number
  • 原文地址:https://www.cnblogs.com/black-start/p/10973340.html
Copyright © 2011-2022 走看看