美文网首页
CentOS 7 命令行方式安装 Oracle 11.2.0.4

CentOS 7 命令行方式安装 Oracle 11.2.0.4

作者: awker | 来源:发表于2018-10-30 20:57 被阅读0次

    1、下载 oralce 安装包
    点此下载

    [root@devops oracle]# unzip p13390677_112040_Linux-x86-64_1of7.zip
    [root@devops oracle]# unzip p13390677_112040_Linux-x86-64_2of7.zip
    [root@devops oracle]# ls database/
    install  readme.html  response  rpm  runInstaller  sshsetup  stage  welcome.html
    [root@devops oracle]# mv database/ /tmp/
    
    

    2、安装相关依赖
    2.1 先安装pdksh

    // centos 7 没有相关安装包可用,可下载 pdksh 的 rpm 包
    [root@devops oracle]# wget http://vault.centos.org/5.11/os/x86_64/CentOS/pdksh-5.2.14-37.el5_8.1.x86_64.rpm
    // 安装 pdksh 出现依赖问题的话,使用  rpm -ivh pdksh-5.2.14-37.el5_8.1.x86_64.rpm  --nodeps --force 安装
    [root@devops oracle]# rpm -ivh pdksh-5.2.14-37.el5_8.1.x86_64.rpm
    

    2.2 安装其他依赖

    [root@devops oracle]# yum -y install binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel expat gcc gcc-c++ glibc glibc-common glibc-devel glibc-headers libaio libaio-devel libgcc libstdc++ libstdc++-devel make pdksh sysstat unixODBC unixODBC-devel
    

    2.3 检查所有依赖是否安装完整

    [root@devops oracle]# rpm -q binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel expat gcc gcc-c++ glibc glibc-common glibc-devel glibc-headers libaio libaio-devel libgcc libstdc++ libstdc++-devel make pdksh sysstat unixODBC unixODBC-devel | grep "not installed"
    

    3、添加 oracle 用户组和用户

    [root@devops oracle]# groupadd oinstall
    [root@devops oracle]# groupadd dba
    [root@devops oracle]# useradd -g oinstall -G dba -d /home/oracle oracle
    

    4、优化系统内核参数

    [root@devops oracle]# vim /etc/pam.d/login
    session    required     pam_limits.so
    
    [root@devops oracle]# vim /etc/security/limits.conf
    oracle        soft    nproc    8192
    oracle        hard    nproc    16384
    oracle        soft    nofile  32768
    oracle        hard    nofile  65535
    
    [root@devops oracle]# vim /etc/sysctl.conf
    net.ipv4.ip_local_port_range = 9000 65500
    fs.file-max = 6815744
    kernel.shmall = 10523004
    kernel.shmmax = 6465333657
    kernel.shmmni = 4096
    kernel.sem = 250 32000 100 128
    net.core.rmem_default=262144
    net.core.wmem_default=262144
    net.core.rmem_max=4194304
    net.core.wmem_max=1048576
    fs.aio-max-nr = 1048576
    [root@devops oracle]# sysctl -p
    
    [root@devops oracle]# vim /etc/profile
    if [ $USER = "oracle" ]; then
      if [ $SHELL = "/bin/ksh" ]; then
        ulimit -p 16384
        ulimit -n 65535
      else
        ulimit -u 16384 -n 65535
      fi
    fi
    [root@devops oracle]# source /etc/profile
    

    5、创建 oracle 相关目录

    [root@devops oracle]# mkdir /data/oracle
    
    [root@devops oracle]# mkdir /data/oracle/product/11.2.0/dbhome_1 -p
    [root@devops oracle]# mkdir /data/oracle/oraInventory -p
    [oracle@devops ~]$ mkdir -p /data/oracle/oradata
    [oracle@devops ~]$ mkdir -p /data/oracle/fast_recovery_area
    [root@devops oracle]# chown -R oracle:oinstall /data/oracle/
    [root@devops oracle]# chmod -R 775 /data/oracle/
    

    6、配置 swap 空间

    [root@devops oracle]# dd if=/dev/zero of=/data/swap bs=1M count=8192
    [root@devops oracle]# mkswap /data/swap
    [root@devops oracle]# swapon /data/swap
    [root@devops oracle]# vim /etc/rc.local
    swapon -a
    [root@devops oracle]# echo 10 > /proc/sys/vm/swappiness
    [root@devops oracle]# vim /etc/sysctl.conf
    vm.swappiness = 10
    [root@devops oracle]# sysctl -p
    [root@devops oracle]# vim /etc/fstab
    /data/swap           swap                 swap       defaults      0 0
    [root@devops oracle]# free -m
                  total        used        free      shared  buff/cache   available
    Mem:          32013         328       16740           0       14944       31274
    Swap:          8191           0        8191
    

    7、配置 oracle 用户环境变量

    [root@devops oracle]# su - oracle
    [oracle@devops ~]$ vim .bash_profile
    umask 022
    export ORACLE_BASE=/data/oracle
    export ORACLE_HOME=/data/oracle/product/11.2.0.4.0/dbhome_1
    export PATH=$PATH:$ORACLE_HOME/bin
    export ORACLE_SID=finance
    export DISPLAY=10.1.18.245:1.0
    [oracle@devops ~]$ source .bash_profile
    [oracle@devops ~]$ exit
    

    8、安装 oracle

    [root@devops oracle]# cp /tmp/database/response/dbca.rsp /home/oracle/
    [root@devops oracle]# cp /tmp/database/response/db_install.rsp /home/oracle/
    [root@devops oracle]# cp /tmp/database/response/netca.rsp /home/oracle/
    [root@devops oracle]# chown -R oracle:oinstall /home/oracle/*.rsp
    
    // 修改 db_install.rsp 的参数,以实现静默安装
    [root@devops oracle]# vim /home/oracle/db_install.rsp
    oracle.install.option=INSTALL_DB_SWONLY
    ORACLE_HOSTNAME=devops
    UNIX_GROUP_NAME=oinstall
    INVENTORY_LOCATION=/data/oracle/oraInventory
    SELECTED_LANGUAGES=en,zh_CN
    ORACLE_HOME=/data/oracle/product/11.2.0/dbhome_1
    ORACLE_BASE=/data/oracle
    oracle.install.db.InstallEdition=EE
    oracle.install.db.DBA_GROUP=dba
    oracle.install.db.OPER_GROUP=oinstall
    oracle.install.db.config.starterdb.type=GENERAL_PURPOSE
    oracle.install.db.config.starterdb.globalDBName=finance
    oracle.install.db.config.starterdb.SID=finance
    oracle.install.db.config.starterdb.characterSet=ZHS16GBK
    oracle.install.db.config.starterdb.password.ALL=oracle
    DECLINE_SECURITY_UPDATES=true
    
    
    [root@devops oracle]# su - oracle
    [oracle@devops ~]$ cd /tmp/database/
    // 开始静默安装 oracle
    [oracle@devops database]$ ./runInstaller -silent -ignorePrereq -responseFile /home/oracle/db_install.rsp
    [oracle@devops database]$ exit
    [root@devops tmp]#  sh  /data/oracle/oraInventory/orainstRoot.sh
    [root@devops tmp]#  sh /data/oracle/product/11.2.0/dbhome_1/root.sh
    

    9、安装监听

    [root@devops tmp]#  su - oracle
    [oracle@devops ~]$ netca /silent /responseFile /home/oracle/netca.rsp
    
    

    10、静默模式创建实例

    [oracle@devops ~]$ vim dbca.rsp
    [root@devops ~]# egrep -v "^$|^#" /home/oracle/dbca.rsp 
    [GENERAL]
    RESPONSEFILE_VERSION = "11.2.0"
    OPERATION_TYPE = "createDatabase"
    [CREATEDATABASE]
    GDBNAME = "finance"
    SID = "finance"
    TEMPLATENAME = "General_Purpose.dbc"
    SYSPASSWORD = "oracle" 
    SYSTEMPASSWORD = "oracle"
    SYSMANPASSWORD = "oracle"
    DBSNMPPASSWORD = "oracle"
    DATAFILEDESTINATION = /data/oracle/oradata
    RECOVERYAREADESTINATION=/data/oracle/flash_recovery_area
    CHARACTERSET = "ZHS16GBK"
    TOTALMEMORY = "13107"
    [createTemplateFromDB]
    SOURCEDB = "myhost:1521:finance"
    SYSDBAUSERNAME = "system"
    TEMPLATENAME = "My Copy TEMPLATE"
    [createCloneTemplate]
    SOURCEDB = "finance"
    TEMPLATENAME = "My Clone TEMPLATE"
    [DELETEDATABASE]
    SOURCEDB = "finance"
    [generateScripts]
    TEMPLATENAME = "New Database"
    GDBNAME = "finance"
    [CONFIGUREDATABASE]
    [ADDINSTANCE]
    DB_UNIQUE_NAME = "finance"
    NODELIST=
    SYSDBAUSERNAME = "sys"
    [DELETEINSTANCE]
    DB_UNIQUE_NAME = "finance"
    INSTANCENAME = "finance"
    SYSDBAUSERNAME = "sys"
    [oracle@devops ~]$ dbca -silent -responseFile /home/oracle/dbca.rsp
    

    11、至此,Oracle 安装成功

    [oracle@devops ~]$ sqlplus / as sysdba
    sys@FINANCE> select * from v$Version;
    
    BANNER
    --------------------------------------------------------------------------------
    Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
    PL/SQL Release 11.2.0.4.0 - Production
    CORE    11.2.0.4.0  Production
    TNS for Linux: Version 11.2.0.4.0 - Production
    NLSRTL Version 11.2.0.4.0 - Production
    
    5 rows selected.
    

    相关文章

      网友评论

          本文标题:CentOS 7 命令行方式安装 Oracle 11.2.0.4

          本文链接:https://www.haomeiwen.com/subject/acsntqtx.html