在CentOS7中安装Oracle 11g

来源:互联网 发布:网络电视剧生死征途 编辑:程序博客网 时间:2024/05/16 15:00

本教程适合进行汇文系统的准备

  1. 下载 Oracle 11g的安装文件备用(2个zip文件)
  2. 安装所必须的软件包
    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
  3. 创建必须的组与用户
    # groupadd oinstall# groupadd dba# useradd -g oinstall -G dba oracle
  4. 修改系统配置文件,添加关于内核的参数
    # 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
  5. 创建必须的目录
    # mkdir -p /u01/app/# chown -R oracle:oinstall /u01/app/# chmod -R 775 /u01/app/
  6. 创建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=ZHS16GBKoracle.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
  7. 静默安装oracle
    $ ./runInstaller -silent -responseFile /home/oracle/database/response/libsys.rsp
  8. 等待提示完成,运行指示的脚本
  9. 创建 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
  10. 开放防火墙
    # firewall-cmd --zone=public --add-port=1521/tcp --permanent

0 0
原创粉丝点击