首页 > 数据库 > Oracle > 正文

centos7.7安装oracle11g脚本(推荐)

2020-07-28 13:36:24
字体:
来源:转载
供稿:网友

最近需要安装oracle,然后网上查了一下教程,在centos7.7上安装成功,运行正常。这里记录一下。

环境:

硬件4核/8G RAM/100G 存储

centos7.7(64bit)

oracle11g(官网下载的)

步骤(转载):

第一个脚本preinstalloracle.sh,以root用户运行。执行完后需要重启电脑,需要注意看一下hostname是否修改好了

 #!/bin/bash#以root用户运行#注意修改第三行的ip为自己的ip地址echo "172.16.1.110 orcl orcl" >> /etc/hostscat >> /etc/sysconfig/network <<EOFnetwork=yeshostname=orclEOF

第二个脚本secinstalloracle.sh,以root用户运行

 #!/bin/bash#以root用户运行#内核参数设置kernel.shmall=2097152其中16G物理内存建议设为4194304类推8G应为2097152#kernel.shmmax=4294967296一般设置为物理内存的一半,8G:4294967296也可以全部用完8*1024*1024*1024yum install -y binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel glibc glibc-common glibc-devel gcc gcc-c++ libaio-devel libaio libgcc libstdc++ libstdc++-devel make sysstat unixODBC unixODBC-devel ksh numactl-devel zip unzipcat >> /etc/sysctl.conf <<EOFfs.file-max = 6815744fs.aio-max-nr = 1048576kernel.shmall = 2097152    kernel.shmmax = 4294967296  kernel.shmmni = 4096kernel.sem = 250 32000 100 128net.ipv4.ip_local_port_range = 9000 65500net.core.rmem_default = 4194304net.core.rmem_max = 4194304net.core.wmem_default = 262144net.core.wmem_max = 1048576EOFsysctl -p #使配置文件生效cat >> /etc/security/limits.conf <<EOForacle      soft  nproc      2047oracle      hard  nproc      16384oracle      soft  nofile     1024oracle      hard  nofile     65536EOFcat >> /etc/pam.d/login <<EOFsession  required   /lib/security/pam_limits.sosession  required   pam_limits.soEOFcat >> /etc/profile <<EOFif [ $USER = "oracle" ]; then  if [ $SHELL = "/bin/ksh" ]; then   ulimit -p 16384   ulimit -n 65536  else   ulimit -u 16384 -n 65536  fifiEOFgroupadd oinstallgroupadd dbauseradd -g oinstall -G dba oracle mkdir -p /u01/app/oracle/product/11.2.0/db_1mkdir -p /u01/app/oracle/oradatamkdir -p /u01/app/oraInventorymkdir -p /u01/app/oracle/fast_recovery_areachown -R oracle:oinstall /u01/app/oraclechown -R oracle:oinstall /u01/app/oraInventorychmod -R 755 /u01/app/oraclechmod -R 755 /u01/app/oraInventorysystemctl disable firewalldsystemctl stop firewalldsetenforce 0sed -i 's/=enforcing/=disabled/g' /etc/selinux/configmv p13390677_112040_Linux-x86-64_1of7.zip /home/oracle  mv p13390677_112040_Linux-x86-64_2of7.zip /home/oraclecp thiinstalloracle.sh /home/oracle/cp fouinstalloracle.sh /home/oracle/

第三个脚本thiinstalloracle.sh,以oracle用户运行,su - oracle

 #!/bin/bash#以oracle用户运行,su - oraclecat >> .bash_profile <<EOFORACLE_BASE=/u01/app/oracleORACLE_HOME=/$ORACLE_BASE/product/11.2.0/db_1ORACLE_SID=orcl export NLS_LANG=AMERICAN_AMERICA.UTF8PATH=/$PATH:/$ORACLE_HOME/binexport ORACLE_BASE ORACLE_HOME ORACLE_SID PATHumask 022EOFsource .bash_profileunzip p13390677_112040_Linux-x86-64_1of7.zip unzip p13390677_112040_Linux-x86-64_2of7.zipchown -R oracle:oinstall databasecd database/responsecp db_install.rsp db_install.rsp.baksed -i "s/^oracle.install.option=/oracle.install.option=INSTALL_DB_SWONLY/g" db_install.rspsed -i "s/^ORACLE_HOSTNAME=/ORACLE_HOSTNAME= orcl/g" db_install.rspsed -i "s/^UNIX_GROUP_NAME=/UNIX_GROUP_NAME=oinstall/g" db_install.rspsed -i "s/^INVENTORY_LOCATION=/INVENTORY_LOCATION=//u01//app//oraInventory/g" db_install.rspsed -i "s/^SELECTED_LANGUAGES=en/SELECTED_LANGUAGES=en,zh_CN/g" db_install.rspsed -i "s/^ORACLE_HOME=/ORACLE_HOME=//u01//app//oracle//product//11.2.0//db_1/g" db_install.rspsed -i "s/^ORACLE_BASE=/ORACLE_BASE=//u01//app//oracle/g" db_install.rspsed -i "s/^oracle.install.db.InstallEdition=/oracle.install.db.InstallEdition=EE/g" db_install.rspsed -i "s/^oracle.install.db.DBA_GROUP=/oracle.install.db.DBA_GROUP=dba/g" db_install.rspsed -i "s/^oracle.install.db.OPER_GROUP=/oracle.install.db.OPER_GROUP=dba/g" db_install.rspsed -i "s/^DECLINE_SECURITY_UPDATES=/DECLINE_SECURITY_UPDATES=true/g" db_install.rspcd ..
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表