Linux 7下脚本安装配置oracle 11g r2教程

本教程为大家分享了oracle 11g r2安装教程,供大家参考,具体内容如下

一、环境脚本简单配置

#!/bin/bash
mv /etc/yum.repos.d/* /tmp
mv iso.repo /etc/yum.repos.d/
tar zxvf a.tar.gz
mv 7Server /root/
sed -i '3 s/^#//' /etc/yum.repos.d/iso.repo
sed -i '4 s/^/#/' /etc/yum.repos.d/iso.repo
yum install createrepo -y
yum install unzip -y
yum install gcc* -y
yum install xhost -y
yum -y install elfutils*
createrepo /root/7Server/
sed -i '3 s/^/#/' /etc/yum.repos.d/iso.repo
sed -i '4 s/^#//' /etc/yum.repos.d/iso.repo

#!/bin/bash
IP=`ip addr |grep 'inet'|grep 'eno'|awk '{print $2}'|awk -F / '{print $1}'`
echo $IP ol7.localdomain ol7 >> /etc/hosts
hostnamectl set-hostname ol7.localdomain
sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/sysconfig/selinux
yum -y install oracle-rdbms-*
yum -y install rlwrap
mkdir -p /u01/app/oracle/product/11.2.0.4/db_1
chown -R oracle:oinstall /u01
chmod -R 775 /u01
systemctl stop firewalld
systemctl disable firewalld
cat >>/home/oracle/.bash_profile<<EOF
# Oracle Settings
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR
ORACLE_HOSTNAME=ol7.localdomain1; export ORACLE_HOSTNAME
ORACLE_UNQNAME=DB11G; export ORACLE_UNQNAME
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=\$ORACLE_BASE/product/11.2.0.4/db_1; export ORACLE_HOME
ORACLE_SID=DB11G; export ORACLE_SID
ORACLE_TERM=xterm; export ORACLE_TERM
PATH=/usr/sbin:\$PATH; export PATH
PATH=\$ORACLE_HOME/bin:\$PATH; export PATH

LD_LIBRARY_PATH=\$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
CLASSPATH=\$ORACLE_HOME/JRE:\$ORACLE_HOME/jlib:\$ORACLE_HOME/rdbms/jlib; export CLASSPATH

alias sql='rlwrap sqlplus'
alias sqlplus='rlwrap sqlplus'
alias lsnrctl='rlwrap lsnrctl'
alias rman='rlwrap rman'

alias envo='env | grep ORACLE'
alias cdob='cd \$ORACLE_BASE'
alias cdoh='cd \$ORACLE_HOME'
alias tns='cd \$ORACLE_HOME/network/admin'

EOF

二、安装

1.使用xmanager安装,服务器是最小化安装的

[root@ol7 oracle]# xhost +
access control disabled, clients can connect from any host
[root@ol7 oracle]# exit
exit
[oracle@ol7 ~]$ export DISPLAY=192.168.3.21:0.0
[oracle@ol7 ~]$ cd database/
[oracle@ol7 database]$ ./runInstaller 
Starting Oracle Universal Installer...

中间就是一些鼠标操作

2.安装完软件,dbca建库就完了

三、总结

 因为自己每次都要配置环境,安装,所以就用了个简单得脚本实现环境的配置。

相关推荐