Centos7 Minimal安装Oracle 11gR2

Posted code -ss

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Centos7 Minimal安装Oracle 11gR2相关的知识,希望对你有一定的参考价值。

Centos7 Minimal安装Oracle 11gR2

环境vm12+新装的centos7 x64 Minimal


#root 一些软件
yum install wget unzip net-tool -y

#root 安装环境自动配置
cd /etc/yum.repos.d
wget http://public-yum.oracle.com/public-yum-ol7.repo
wget http://public-yum.oracle.com/RPM-GPG-KEY-oracle-ol7 -O /etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
yum install oracle-rdbms-server-11gR2-preinstall -y


#root 配置oracle系统配置文件
cat >> /etc/oraInst.loc <<EOF
inventory_loc=/home/oracle/ora11g/oraInventory
inst_group=oinstall
EOF

#root 授权
chmod 664 /etc/oraInst.loc

#root 加载内核参数 sysctl -p
sysctl -f

#root 备份一下
#/var/log/oracle-rdbms-server-11gR2-preinstall

#root 移除安装环境配置软件
yum remove oracle-rdbms-server-11gR2-preinstall
#安装缺少的一个依赖
rpm -e ksh-20120801-34.el7.x86_64
wget http://vault.centos.org/5.11/os/x86_64/CentOS/pdksh-5.2.14-37.el5_8.1.x86_64.rpm
rpm -ivh pdksh-5.2.14-37.el5_8.1.x86_64.rpm

######root if虚拟机没有或者不够swap空间
dd if=/dev/zero of=/data/swap4g bs=1M count=4096
mkswap /data/swap4g
chmod 600 /data/swap4g
swapon /data/swap4g

#root 设置密码
passwd oracle


#oracle
cat >> /home/oracle/.bash_profile <<EOF
ORACLE_HOSTNAME=$(hostname)
ORACLE_BASE=/home/oracle/ora11g
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
ORACLE_SID=orcl
NLS_LANG="american_america.UTF8"
PATH=$ORACLE_HOME/bin:$PATH

export ORACLE_BASE
export ORACLE_HOME
export ORACLE_SID
export ORACLE_TERM
export PATH
export NLS_LANG

alias sysdba=sqlplus "/ nolog"
EOF
#生效
source /home/oracle/.bash_profile 
echo $PATH

#这两个文件上传在/home/oracle/
unzip linux.x64_11gR2_database_1of2.zip
unzip linux.x64_11gR2_database_2of2.zip

#oracle 配置初始化安装文件
sed -i s/oracle.install.option=.*/oracle.install.option=INSTALL_DB_SWONLY/g db_install.rsp
sed -i "s/ORACLE_HOSTNAME=.*/ORACLE_HOSTNAME=$(hostname)/g" db_install.rsp
sed -i s/UNIX_GROUP_NAME=.*/UNIX_GROUP_NAME=oinstall/g db_install.rsp
sed -i s/INVENTORY_LOCATION=.*/INVENTORY_LOCATION=\/home\/oracle\/ora11g\/oraInventory/g db_install.rsp
sed -i s/SELECTED_LANGUAGES=.*/SELECTED_LANGUAGES=en,zh_CN/g db_install.rsp
sed -i s/ORACLE_HOME=.*/ORACLE_HOME=\/home\/oracle\/ora11g\/product\/11.2.0\/db_1/g db_install.rsp
sed -i s/ORACLE_BASE=.*/ORACLE_BASE=\/home\/oracle\/ora11g/g db_install.rsp
sed -i s/oracle.install.db.InstallEdition=.*/oracle.install.db.InstallEdition=EE/g db_install.rsp
sed -i s/oracle.install.db.isCustomInstall=.*/oracle.install.db.isCustomInstall=true/g db_install.rsp
sed -i s/oracle.install.db.DBA_GROUP=.*/oracle.install.db.DBA_GROUP=dba/g db_install.rsp
sed -i s/oracle.install.db.OPER_GROUP=.*/oracle.install.db.OPER_GROUP=oinstall/g db_install.rsp
sed -i s/oracle.install.db.config.starterdb.type=.*/oracle.install.db.config.starterdb.type=GENERAL_PURPOSE/g db_install.rsp
sed -i s/oracle.install.db.config.starterdb.globalDBName=.*/oracle.install.db.config.starterdb.globalDBName=orcl.lan/g db_install.rsp
sed -i s/oracle.install.db.config.starterdb.SID=.*/oracle.install.db.config.starterdb.SID=orcl/g db_install.rsp
sed -i s/oracle.install.db.config.starterdb.characterSet=.*/oracle.install.db.config.starterdb.characterSet=AL32UTF8/g db_install.rsp
sed -i s/oracle.install.db.config.starterdb.memoryOption=.*/oracle.install.db.config.starterdb.memoryOption=true/g db_install.rsp
sed -i s/oracle.install.db.config.starterdb.password.ALL=.*/oracle.install.db.config.starterdb.password.ALL=oracle/g db_install.rsp
sed -i s/oracle.install.db.config.starterdb.control=.*/oracle.install.db.config.starterdb.control=DB_CONTROL/g db_install.rsp
sed -i s/oracle.install.db.config.starterdb.dbcontrol.enableEmailNotification=.*/oracle.install.db.config.starterdb.dbcontrol.enableEmailNotification=true/g db_install.rsp
sed -i s/DECLINE_SECURITY_UPDATES=.*/DECLINE_SECURITY_UPDATES=true/g db_install.rsp

#oracle 配置监听应答文件
sed -i s/INSTALL_TYPE=.*/INSTALL_TYPE=""custom""/g netca.rsp

#oracle 配置数据库应答文件
sed -i s#GDBNAME =.*#GDBNAME = "orcl"#g dbca.rsp
sed -i s#SID =.*#SID = "orcl"#g dbca.rsp
sed -i s/#SYSPASSWORD =.*/SYSPASSWORD = "oracle"/g dbca.rsp
sed -i s/#SYSTEMPASSWORD =.*/SYSPASSWORD = "oracle"/g dbca.rsp
#oracle
/home/oracle/database/runInstaller -silent -ignorePrereq -responseFile /home/oracle/database/response/db_install.rsp

#root 检测安完成后,会提示用root用户执行以下面的命令去完成最后的安装
sh /home/oracle/ora11g/product/11.2.0/db_1/root.sh

#oracle 创建实例
dbca -silent -responseFile /home/oracle/database/response/dbca.rsp
不管退格 输入密码oracle
#oracle 创建监听
netca /silent /responseFile /home/oracle/database/response/netca.rsp

#oracle
sqlplus / as sysdba
#sqlplus 查看状态
select status from v$instance;

查看监听netstat等等
远程连接的话注意配置防火墙

 

以上是关于Centos7 Minimal安装Oracle 11gR2的主要内容,如果未能解决你的问题,请参考以下文章

CentOS7安装Oracle11g R2

Centos7安装Oracle 11gR2

centos 7 minimal安装之后怎么设置

1-VirtualBox安装Centos7 minimal

CentOS7 minimal版 安装gnome桌面

Centos7 minimal 系列之rabbitmq安装