美文网首页
静默安装Oracle 11g centos7

静默安装Oracle 11g centos7

作者: frankie_cheung | 来源:发表于2021-07-29 17:21 被阅读0次

    yum安装

    yum install -y compat-libcap*;
    yum install -y compat-libstdc++-33*;
    yum install -y compat-libstdc++-33*.i686; 
    yum install -y gcc*;
    yum install -y glibc-devel-*.i686;
    yum install -y libstdc++-devel*.i686;
    yum install -y libaio*.i686;
    yum install -y libaio-devel*;
    yum install -y unixODBC*;
    yum install -y unixODBC*.i686;
    yum install -y ksh;
    

    检查包、依赖安装情况

    rpm -q binutils compat-libcap1 compat-libstdc++-33 gcc gcc-c++ glibc glibc-devel ksh;
    rpm -q libgcc libstdc++ libstdc++-devel libaio libaio-devel make sysstat unixODBC unixODBC-devel;
    

    修改系统配置文件

    1. vi /etc/sysctl.conf
    kernel.shmmax = 68719476736
    kernel.shmall = 4294967296
    fs.file-max = 6815744
    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
    fs.aio-max-nr = 1048576
    
    1. vi /etc/security/limits.conf
    oracle soft nproc 2047
    oracle hard nproc 16384
    oracle soft nofile 1024
    oracle hard nofile 65536
    oracle hard stack 10240
    
    1. vi /etc/pam.d/login
    session required /lib64/security/pam_limits.so
    session required pam_limits.so
    
    1. vi /etc/profile
    if [ $USER = "oracle" ]; then
    if [ $SHELL = "/bin/ksh" ]; then
    ulimit -p 16384
    ulimit -n 65536
    else
    ulimit -u 16384 -n 65536
    fi
    fi
    
    1. vi /etc/selinux/config
      关闭selinux
      SELINUX=disabled
      记得reboot

    创建用户

    groupadd oinstall
    
    groupadd dba
    
    useradd -g oinstall -G dba -d /data/oracle oracle
    
    passwd oracle
    

    记得密码,后面需要

    创建安装目录

    cd /data/oracle/; mkdir -p app/oracle;
    chown -R oracle:oinstall app/;
    

    修改oracle用户环境变量

    su – oracle
    vim ~/.bash_profile

    export ORACLE_BASE=/data/oracle/app/oracle
    export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
    export ORACLE_SID=orcl
    export PATH=$PATH:$HOME/.local/bin:$HOME/bin:$ORACLE_HOME/bin
    export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
    

    解压oracle.zip

    unzip linux.x64_11gR2_database_1of2.zip
    unzip linux.x64_11gR2_database_2of2.zip
    mv database/ /data/oracle/
    chown -R oracle:oinstall database/
    chmod -R 777 database/
    

    压缩包下载:适用于 Linux x86-64 的 Oracle Database 11g 第 2 版 | Oracle 中国

    静默安装

    1. 编辑响应文件db_install.rsp
    oracle.install.responseFileVersion=/data/oracle/database/response
    oracle.install.option=INSTALL_DB_SWONLY
    ORACLE_HOSTNAME=hecs-x-medium-2-linux-20210702101106
    UNIX_GROUP_NAME=oinstall
    INVENTORY_LOCATION=/data/oracle/app/oraInventory
    SELECTED_LANGUAGES=en,zh_CN,zh_TW
    ORACLE_HOME=/data/oracle/app/oracle/product/11.2.0/db_1
    ORACLE_BASE=/data/oracle/app/oracle
    oracle.install.db.InstallEdition=EE
    oracle.install.db.isCustomInstall=false
    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=DSA
    oracle.install.db.config.starterdb.SID=orcl
    oracle.install.db.config.starterdb.characterSet=ZHS16GBK
    DECLINE_SECURITY_UPDATES=true
    
    
    1. 安装oracle
    cd /data/oracle/database;
    ./runInstaller -silent -ignorePrereq -responseFile /data/oracle/database/response/db_install.rsp
    

    显示如下,敲回车

    [oracle@hecs-x-medium-2-linux-20210702101106 database]$ ./runInstaller -silent -ignorePrereq -responseFile /data/oracle/database/response/db_install.rsp
    Starting Oracle Universal Installer...
    
    Checking Temp space: must be greater than 120 MB.   Actual 20686 MB    Passed
    Checking swap space: must be greater than 150 MB.   Actual 511 MB    Passed
    Preparing to launch Oracle Universal Installer from /tmp/OraInstall2021-07-29_03-53-54PM. Please wait ...[oracle@hecs-x-medium-2-linux-20210702101106 database]$ You can find the log of this install session at:
     /data/oracle/app/oraInventory/logs/installActions2021-07-29_03-53-54PM.log
    The following configuration scripts need to be executed as the "root" user.
     #!/bin/sh
     #Root scripts to run
    
    /data/oracle/app/oraInventory/orainstRoot.sh
    /data/oracle/app/oracle/product/11.2.0/db_1/root.sh
    To execute the configuration scripts:
             1. Open a terminal window
             2. Log in as "root"
             3. Run the scripts
             4. Return to this window and hit "Enter" key to continue
    
    Successfully Setup Software.
    
    
    su - root
    cd /data/oracle/app/oraInventory; ./orainstRoot.sh
    cd /data/oracle/app/oracle/product/11.2.0/db_1/;./root.sh
    
    
    1. 安装监听
    su - oracle
    /data/oracle/app/oracle/product/11.2.0/db_1/bin/netca /silent /responseFile /data/oracle/database/response/netca.rsp
    
    1. 编辑响应文件dbca.rsp
      vim /data/oracle/database/response/dbca.rsp
    [GENERAL]
    RESPONSEFILE_VERSION = "11.2.0"
    OPERATION_TYPE = "createDatabase"
    [CREATEDATABASE]
    GDBNAME = "DSA"
    SID = "orcl"
    TEMPLATENAME = "General_Purpose.dbc"
    CHARACTERSET = "ZHS16GBK"
    
    1. 安装库
    /data/oracle/app/oracle/product/11.2.0/db_1/bin/dbca -silent -responseFile /data4/oracle/database/response/dbca.rsp
    
    [oracle@hecs-x-medium-2-linux-20210702101106 ~]$ /data/oracle/app/oracle/product/11.2.0/db_1/bin/dbca -silent -responseFile /data/oracle/database/response/dbca.rsp
    Enter SYS user password:
    
    Enter SYSTEM user password:
    
    Copying database files
    1% complete
    3% complete
    37% complete
    Creating and starting Oracle instance
    40% complete
    45% complete
    50% complete
    55% complete
    56% complete
    60% complete
    62% complete
    Completing Database Creation
    66% complete
    70% complete
    73% complete
    74% complete
    85% complete
    96% complete
    100% complete
    Look at the log file "/data/oracle/app/oracle/cfgtoollogs/dbca/DSA/DSA.log" for further details.
    
    

    输入密码为上面Oracle用户的密码

    登录Oracle

    sqlplus / as sysdba

    安装问题汇总:

    1.swap没有文件。

    [oracle@hecs-x-medium-2-linux-20210702101106 database]$ ./runInstaller -silent -ignorePrereq -responseFile /data/oracle/database/response/db_install.rsp
    Starting Oracle Universal Installer...
    
    Checking Temp space: must be greater than 120 MB.   Actual 21202 MB    Passed
    Checking swap space: 0 MB available, 150 MB required.    Failed <<<<
    

    处理方法:

    
    检查 Swap 空间在设置 Swap 文件之前,有必要先检查一下系统里有没有既存的 Swap 文件。运行以下命令
    swapon -s
    
    检查文件系统在设置 Swap 文件之前,同样有必要检查一下文件系统,看看是否有足够的硬盘空间来设置 Swap 。运行以下命令:
    
    df -hal
    创建并允许 Swap 文件下面使用 dd 命令来创建 Swap 文件。检查返回的信息,还剩余足够的硬盘空间即可。
    
    dd if=/dev/zero of=/swapfile bs=1024 count=512k
    
    格式化并激活 Swap 文件上面已经创建好 Swap 文件,还需要格式化后才能使用。运行命令
    mkswap /swapfile
    
    激活 Swap ,运行命令:
    swapon /swapfile
    
    以上步骤做完,再次运行命令:
    swapon -s
    
    

    2.使用了root去安装Oracle

    [root@hecs-x-medium-2-linux-20210702101106 database]# ./runInstaller -silent -ignorePrereq -responseFile /data/oracle/database/response/db_install.rsp
    
    The user is root. Oracle Universal Installer cannot continue installation if the user is root.
    : No such file or directory
    
    

    处理方法:
    su - oracle

    相关文章

      网友评论

          本文标题:静默安装Oracle 11g centos7

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