安装Oracle11GR2所需要的依赖包
下面的命令可以在yum安装软件包的时候安装 32位和 64位
echo "multilib_policy=all" >> /etc/yum.conf
安装Oracle依赖包
yum -y install gcc gcc-c++ make binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel elfutils-libelf-devel-static glibc glibc-common glibc-devel ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel numactl-devel sysstat unixODBC unixODBC-devel kernel-headers pcre-devel readline* compat-libstdc++-33* compat-libcap cpp glibc-headers libXi libXtst mpfr
yum -y install pdksh ##报错,百度搜原因:pdksh是一个老包了,新的oracle都使用ksh包
改执行
yum -y install rlwrap ##没包
rpm -ivh compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm
rpm -ivh compat-libcap1-1.10-7.el7.x86_64.rpm
rpm -ivh elfutils-libelf-devel-static-0.176-2.el7.x86_64.rpm --nodeps
tar -zxf rlwrap-0.42.tar.gz
cd rlwrap-0.42/
./configure && make && make install
修改主机名 vim /etc/hosts,关闭防火墙,并重启计算机
echo '192.168.47.131 orclone' >> /etc/hosts
echo '192.168.47.132 orcltwo' >> /etc/hosts
systemctl stop firewalld
systemctl disable firewalld
reboot
创建用户 组 及文件夹
创建用户组:创建用户组:创建用户并添加到用户组:
groupadd oinstall
groupadd dba
useradd -g oinstall -G dba oracle
passwd oracle
==================
密码 *********
创建安装目录及权限 /u01/software 、存放Oracle安装包
mkdir -p /u01/app/oracle/product/11.2.0/dbhome_1
mkdir -p /u01/app/oracle/{oradata,inventory,fast_recovery_area}
mkdir -p /u01/software
chown -R oracle:oinstall /u01/
chmod -R 775 /u01/
静默安装Oracle11GR2数据库上传数据库安装包并解压
修改内核文件: vim /etc/sysctl.conf
echo 'fs.aio-max-nr = 1048576' >> /etc/sysctl.conf
echo 'fs.file-max = 6815744' >> /etc/sysctl.conf
echo 'kernel.shmall = 2097152' >> /etc/sysctl.conf
echo 'kernel.shmmax = 1073741824' >> /etc/sysctl.conf
echo 'kernel.shmmni = 4096' >> /etc/sysctl.conf
echo 'kernel.sem = 250 32000 100 128' >> /etc/sysctl.conf
echo 'net.ipv4.ip_local_port_range = 9000 65500' >> /etc/sysctl.conf
echo 'net.core.rmem_default = 262144' >> /etc/sysctl.conf
echo 'net.core.rmem_max = 4194304' >> /etc/sysctl.conf
echo 'net.core.wmem_default = 262144' >> /etc/sysctl.conf
echo 'net.core.wmem_max = 1048576' >> /etc/sysctl.conf
cat /etc/sysctl.conf
sysctl -p
====================================================================
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 1073741824
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
修改用户限制:vim /etc/security/limits.conf
echo 'oracle soft nproc 2047' >> /etc/security/limits.conf
echo 'oracle hard nproc 16384' >> /etc/security/limits.conf
echo 'oracle soft nofile 1024' >> /etc/security/limits.conf
echo 'oracle hard nofile 65536' >> /etc/security/limits.conf
echo 'oracle soft stack 10240' >> /etc/security/limits.conf
tail -6 /etc/security/limits.conf
=====================================================
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
修改/etc/pam.d/login 文件:vim /etc/pam.d/login
echo 'session required /lib64/security/pam_limits.so' >> /etc/pam.d/login
echo 'session required pam_limits.so' >> /etc/pam.d/login
tail -3 /etc/pam.d/login
==================================================
session required /lib64/security/pam_limits.so
session required pam_limits.so
修改/etc/profile 文件:vim /etc/profile
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
source /etc/profile
设置oracle 用户环境变量
先切换到oracle用户:su - oracle
编辑:vim .bash_profile
echo 'export ORACLE_BASE=/u01/app/oracle' >> .bash_profile
echo 'export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1' >> .bash_profile
echo 'export ORACLE_SID=orclt' >> .bash_profile
echo 'export ORACLE_UNQNAME=$ORACLE_SID' >> .bash_profile
echo 'export PATH=$ORACLE_HOME/bin:$PATH' >> .bash_profile
echo 'export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK' >> .bash_profile
echo "alias sqlplus='rlwrap sqlplus'" >> .bash_profile
echo "alias rman='rlwrap rman'" >> .bash_profile
source .bash_profile
============================================================
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
export ORACLE_SID=orcl
export ORACLE_UNQNAME=$ORACLE_SID
export PATH=$ORACLE_HOME/bin:$PATH
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
alias sqlplus='rlwrap sqlplus'
alias rman='rlwrap rman'
图形化安装
cd database/
LANG=en_US ./runInstaller -jreLoc /etc/alternatives/jre_1.8.0