首页 > 服务器 > Web服务器 > 正文

VMware下CentOS静默安装oracle12.2详细图文教程

2024-09-01 13:56:05
字体:
来源:转载
供稿:网友

环境准备:

VMware+CentOS,jdk

一、校验系统磁盘大小

1.命令 df -h

保证可用磁盘大小15GB(包括oracle安装时需要空间7.5GB + oracle安装zip包接近3G+安装包解压文件3G)

VMware,CentOS,oracle12.2

如果磁盘不满足,安装会失败,需要扩容!

二、安装准备

1.创建运行oracle数据库的系统用户和用户组

groupadd oinstallgroupadd dbauseradd -g oinstall -g dba -m oracle

passwd oracle #不用管提示,连续输入两次密码就可成功

VMware,CentOS,oracle12.2

2.创建oracle数据库安装目录,并将目录赋权给oracle用户

mkdir -p /opt/oracle/database #oracle安装包解压的文件mkdir -p /opt/oracle/product/oraInventory #mkdir -p /opt/oracle/product/12.2.0/db_1 #oracle安装目录chown -R oracle:oinstall /opt/oracle #更改oracle目录的属主chmod 755 -R /opt/oracle #更改oracle目录的权限

VMware,CentOS,oracle12.2

3.安装oracle数据库依赖的软件包

3.1.安装

yum -y install 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 pdksh numactl-devel glibc-headers

3.2.查看是否安装成功

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"

VMware,CentOS,oracle12.2

4.关闭selinux,需要重启生效(可以在最后安装oracle之前再重启) vim /etc/selinux/config

VMware,CentOS,oracle12.2

5.修改内核参数 vim /etc/sysctl.conf

添加如下内容:

net.ipv4.icmp_echo_ignore_broadcasts = 1

net.ipv4.conf.all.rp_filter = 1

fs.file-max = 6815744

fs.aio-max-nr = 1048576

kernel.shmall = 2097152

kernel.shmmax = 2147483648

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= 1048576

VMware,CentOS,oracle12.2

sysctl  -p #使配置生效

VMware,CentOS,oracle12.2

6.对oracle用户设置限制,提高系统运行性能

vim /etc/security/limits.conf

添加如下内容:

oracle soft nproc 2047oracle hard nproc 16384oracle soft nofile 1024oracle hard nofile 65536

VMware,CentOS,oracle12.2

7.配置用户环境变量

vim /home/oracle/.bash_profile

添加如下内容:

export ORACLE_BASE=/opt/oracle

export ORACLE_HOME=$ORACLE_BASE/product/12.2.0/db_1

export ORACLE_SID=orcl

export ORACLE_TERM=xterm

export PATH=$ORACLE_HOME/bin:/usr/sbin:$PATH

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib

export LANG=C

export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK

VMware,CentOS,oracle12.2

source /home/oracle/.bash_profile #使配置失效

8.解压oracle安装文件的压缩包,在/opt/oracle/目录下解压

unzip 文件名(unzip不存在,可用命令进行安装: yum install unzip)加压较慢,需要等会

VMware,CentOS,oracle12.2

9.配置应答文件

vim /opt/oracle/database/response/db_install.rsp

10.配置oraInventory目录位置

存放oracle软件安装的目录信息,oracle的安装和升级都需要用到这个目录(最好放在ORACLE_BASE对应的目录下边)

vim /etc/oraInst.loc

添加或修改成如下内容:

inventory_loc=/opt/oracle/product/oraInventory

inst_group=oinstall

VMware,CentOS,oracle12.2

11.重启CentOS,reboot

12.关闭防火墙,systemctl stop firewalld

三、静默安装Oracle12

1.已oracle用户登陆linux系统

2.静默安装

/opt/oracle/database/runInstaller -silent -force -ignorePrereq -responseFile /opt/oracle/database/response/db_install.rsp

执行过程需要等待几分钟。

VMware,CentOS,oracle12.2

可监控日志:

tail -f/opt/oracle/product/oraInventory/logs/installActions2018-11-22_11-04-03AM.log

VMware,CentOS,oracle12.2

3.切换root用户登陆

4.执行两个sh文件

4.1. sh /opt/oracle/product/oraInventory/orainstRoot.sh

VMware,CentOS,oracle12.2

如果目录下没有改脚本,可以新建一个,脚本内容为:

# cat /oracle/oraInventory/orainstRoot.sh#!/bin/shAWK=/bin/awkCHMOD=/bin/chmodCHGRP=/bin/chgrpCP=/bin/cpECHO=/bin/echoMKDIR=/bin/mkdirRUID=`/usr/bin/id|$AWK -F ′ print$2 ′ |$AWK−F ′print$2′|$AWK−F '{print $2}'|$AWK -F '{print $1}'`if [ ${RUID} != "root" ];then  $ECHO "This script must be executed as root"  exit 1fiif [ -d "/etc" ]; then$CHMOD 755 /etc;else$MKDIR -p /etc;fiif [ -f "/oracle/oraInventory/oraInst.loc" ]; then$CP /oracle/oraInventory/oraInst.loc /etc/oraInst.loc;$CHMOD 644 /etc/oraInst.locelseINVPTR=/etc/oraInst.locINVLOC=/oracle/oraInventoryGRP=oinstallPTRDIR="`dirname $INVPTR`";# Create the software inventory location pointer fileif [ ! -d "$PTRDIR" ]; then $MKDIR -p $PTRDIR;fi$ECHO "Creating the Oracle inventory pointer file ($INVPTR)";$ECHO  inventory_loc=$INVLOC > $INVPTR$ECHO  inst_group=$GRP >> $INVPTRchmod 644 $INVPTR# Create the inventory directory if it doesn't existif [ ! -d "$INVLOC" ];then $ECHO "Creating the Oracle inventory directory ($INVLOC)"; $MKDIR -p $INVLOC;fifi$ECHO "Changing permissions of /oracle/oraInventory.Adding read,write permissions for group.Removing read,write,execute permissions for world.";$CHMOD -R g+rw,o-rwx /oracle/oraInventory;if [ $? != 0 ]; then $ECHO "OUI-35086:WARNING: chmod of /oracle/oraInventoryAdding read,write permissions for group.,Removing read,write,execute permissions for world. failed!";fi$ECHO "Changing groupname of /oracle/oraInventory to oinstall.";$CHGRP -R oinstall /oracle/oraInventory;if [ $? != 0 ]; then $ECHO "OUI-10057:WARNING: chgrp of /oracle/oraInventory to oinstall failed!";fi$ECHO "The execution of the script is complete."

4.2. sh /opt/oracle/product/12.2.0/db_1/root.sh

VMware,CentOS,oracle12.2

5.切换oracle用户登陆

6.安装监听

$ORACLE_HOME/bin/netca /silent /responseFile /opt/oracle/database/response/netca.rsp

VMware,CentOS,oracle12.2

7.启动监听程序

lsnrctl start

VMware,CentOS,oracle12.2

8.查看监听状态

lsnrctl status

VMware,CentOS,oracle12.2

9.通过dbca创建数据库

/opt/oracle/product/12.2.0/db_1/bin/dbca -silent -createDatabase -templateName General_Purpose.dbc -gdbname orcl -sid orcl -responseFile NO_VALUE -characterSet ZHS16GBK -memoryPercentage 30 -emConfiguration LOCAL

(删除:dbca -silent -deleteDatabase -sourcedb orcl -sid orcl)

10.启动实例(创建完,一般会自动启动)

sqlplus / as sysdbaSQL> startupSQL> select instance_name,version from v$instance;

查看数据库文件dbf

SQL> select name from v$datafile;

总结

以上所述是小编给大家介绍的VMware下CentOS静默安装oracle12.2详细图文教程,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对VEVB武林网网站的支持!


注:相关教程知识阅读请移步到服务器教程频道。
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表