在CentOS7中安装Oracle11g

2017-01-04 19:29:16来源:作者:人点击

在CentOS7中安装Oracle11g,本教程适合进行汇文系统的准备

  1. 下载 Oracle 11g的安装文件备用(2个zip文件)安装所必须的软件包
    binutilscompat-libcap1compat-libstdc++-33.i686compat-libstdc++-33.x86_64gccgcc-c++glibc.i686 glibc.x86_64 glibc-devel.i686 glibc-devel.x86_64 kshlibaio.i686 libaio.x86_64 libaio-devel.i686 libaio-devel.x86_64 libgcc.i686 libgcc.x86_64 libstdc++.i686 libstdc++.x86_64 libstdc++-devel.i686 libstdc++-devel.x86_64 libXi.i686 libXi.x86_64 libXtst.i686 libXtst.x86_64 pammakesysstatunixODBC
    创建必须的组与用户
    # groupadd oinstall# groupadd dba# useradd -g oinstall -G dba oracle
    修改系统配置文件,添加关于内核的参数
    # cat /usr/lib/sysctl.d/oradb.conffs.aio-max-nr = 1048576fs.file-max = 6815744kernel.shmall = 2097152kernel.shmmax = 536870912kernel.shmmni = 4096kernel.sem = 250 32000 100 128net.ipv4.ip_local_port_range = 9000 65500net.core.rmem_default = 262144net.core.rmem_max = 4194304net.core.wmem_default = 262144net.core.wmem_max = 1048576# cat /etc/security/limits.d/oradb.conforacle soft nproc 2047oracle hard nproc 16384oracle soft nofile 1024oracle hard nofile 65536oracle soft stack  10240
    创建必须的目录
    # mkdir -p /u01/app/# chown -R oracle:oinstall /u01/app/# chmod -R 775 /u01/app/
    创建oracle响应文件用于静默安装
    将oracle安装文件解压到 /home/oracle/database 下
    $ cat /home/oracle/database/response/libsys.rsporacle.install.option=INSTALL_DB_AND_CONFIGUNIX_GROUP_NAME=oinstallINVENTORY_LOCATION=/u01/app/oraInventorySELECTED_LANGUAGES=en,fr,es,de,it,zh_CN,zh_TWORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1ORACLE_BASE=/u01/app/oracleoracle.install.db.InstallEdition=EEoracle.install.db.DBA_GROUP=dbaoracle.install.db.OPER_GROUP=oinstalloracle.install.db.config.starterdb.type=GENERAL_PURPOSEoracle.install.db.config.starterdb.globalDBName=orcloracle.install.db.config.starterdb.SID=orcloracle.install.db.config.starterdb.characterSet=AL32UTF8oracle.install.db.config.starterdb.memoryLimit=512oracle.install.db.config.starterdb.password.ALL=XXXXxxxxoracle.install.db.config.starterdb.storageType=FILE_SYSTEM_STORAGEoracle.install.db.config.starterdb.fileSystemStorage.dataLocation=/home/oracle/oradataSECURITY_UPDATES_VIA_MYORACLESUPPORT=falseDECLINE_SECURITY_UPDATES=true
    静默安装oracle
    $ ./runInstaller -silent -responseFile /home/oracle/database/response/libsys.rsp
    等待提示完成,运行指示的脚本创建 systemd service 文件,并设置开机即启动

    $ cat /home/oracle/scripts/startup.sh===== CUT HERE =====#!/bin/bashexport TMP=/tmpexport TMPDIR=$TMPexport PATH=/usr/sbin:/usr/local/bin:$PATHexport ORACLE_SID=orclORAENV_ASK=NO. oraenvORAENV_ASK=YES# Start Listenerlsnrctl start# Start Databasesqlplus / as sysdba << EOFSTARTUP;EXIT;EOF===== CUT HERE =====$ cat /home/oracle/scripts/shutdown.sh===== CUT HERE =====#!/bin/bashexport TMP=/tmpexport TMPDIR=$TMPexport PATH=/usr/sbin:/usr/local/bin:$PATHexport ORACLE_SID=orclORAENV_ASK=NO. oraenvORAENV_ASK=YES# Stop Databasesqlplus / as sysdba << EOFSHUTDOWN IMMEDIATE;EXIT;EOF# Stop Listenerlsnrctl stop===== CUT HERE =====# cat /usr/lib/systemd/system/dbora.service===== CUT HERE =====[Unit]Description=The Oracle Database ServiceAfter=syslog.target network.target[Service]# systemd ignores PAM limits, so set any necessary limits in the service.# Not really a bug, but a feature.# https://bugzilla.redhat.com/show_bug.cgi?id=754285LimitMEMLOCK=infinityLimitNOFILE=65535#Type=simple# idle: similar to simple, the actual execution of the service binary is delayed#       until all jobs are finished, which avoids mixing the status output with shell output of services.RemainAfterExit=yesUser=oracleGroup=oinstallExecStart=/home/oracle/scripts/startup.sh >> /home/oracle/scripts/startup_shutdown.log 2>&1 &ExecStop=/home/oracle/scripts/shutdown.sh >> /home/oracle/scripts/startup_shutdown.log 2>&1[Install]WantedBy=multi-user.target===== CUT HERE =====# systemctl enable dbora
    开放防火墙
    # firewall-cmd --zone=public --add-port=1521/tcp --permanent

     

最新文章

123

最新摄影

微信扫一扫

第七城市微信公众平台