CentOS Linux release 7.2.1511 (Core)
Oracle Database 11g Release 2 (11.2.0.4)
二、安装前准备
2.1 修改主机名
修改/etc/sysconfig/network配置文件中的HOSTNAME变量
[root@linuxidc ~]# hostnamectl set-hostname oracledb
####永久性修改
[root@linuxidc ~]#vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME= oracledb
[root@linuxidc ~]# hostname
oracledb
2.2 添加主机名与IP对应记录
[root@linuxidc ~]# vi /etc/hosts
172.17.22.70 oracledb
2.3 关闭Selinux
[root@oracledb ~]# sed -i "s/SELINUX=enforcing/SELINUX=disabled/" /etc/selinux/config
[root@oracledb ~]# setenforce 0
2.4 firewall开启1521端口
[root@sdba ~]# firewall-cmd --permanent --zone=public --add-port=1521/tcp
success
[root@sdba ~]# firewall-cmd --reload
success
2.5下载Oracle 11g
2.6 检查硬件配置要求
最小内存 1 GB of RAM
虚拟内存容量
Available RAM
Swap Space Required
Between 1 GB and 2 GB
1.5 times the size of RAM
Between 2 GB and 16 GB
Equal to the size of RAM
More than 16 GB
16 GB
硬盘空间要求
数据库软件硬盘空间需求:
Installation Type
Requirement for Software Files (GB)
Enterprise Edition
3.95
Standard Edition
3.88
数据文件硬盘空间需求:
Installation Type
Requirement for Data Files (GB)
Enterprise Edition
1.7
Standard Edition
1.5
检查的命令
#内存
grep MemTotal /proc/meminfo
#交换空间
grep SwapTotal /proc/meminfo
#磁盘空间
df -ah
2.7 安装所需的软件包
通过查看Oracle安装文档中列出的Package Requirements可以查看在不同平台上需要的软件包。
packages for Oracle Linux 7
binutils-2.23.52.0.1-12.el7.x86_64
compat-libcap1-1.10-3.el7.x86_64
gcc-4.8.2-3.el7.x86_64
gcc-c++-4.8.2-3.el7.x86_64
glibc-2.17-36.el7.i686
glibc-2.17-36.el7.x86_64
glibc-devel-2.17-36.el7.i686
glibc-devel-2.17-36.el7.x86_64
ksh
libaio-0.3.109-9.el7.i686
libaio-0.3.109-9.el7.x86_64
libaio-devel-0.3.109-9.el7.i686
libaio-devel-0.3.109-9.el7.x86_64
libgcc-4.8.2-3.el7.i686
libgcc-4.8.2-3.el7.x86_64
libstdc++-4.8.2-3.el7.i686
libstdc++-4.8.2-3.el7.x86_64
libstdc++-devel-4.8.2-3.el7.i686
libstdc++-devel-4.8.2-3.el7.x86_64
libXi-1.7.2-1.el7.i686
libXi-1.7.2-1.el7.x86_64
libXtst-1.2.2-1.el7.i686
libXtst-1.2.2-1.el7.x86_64
make-3.82-19.el7.x86_64
sysstat-10.1.5-1.el7.x86_64
Oracle ODBC Drivers
On Oracle Linux 6, Red Hat Enterprise Linux 6, and Asianux Server 4:
unixODBC-2.3.1-6.el7.x86_64 or later
unixODBC-2.3.1-6.el7.i686 or later
unixODBC-devel-2.3.1-6.el7.x86_64 or later
unixODBC-devel-2.3.1-6.el7.i686 or later
安装软件包
yum -y install binutils
yum -y install compat-libcap1
yum install -y gcc gcc-c++ glibc.i686 glibc.x86_64 glibc-devel.i686 glibc-devel.x86_64
yum install -y libaio.i686 libaio.x86_64 libaio-devel.i686 libaio-devel.x86_64
yum install -y libgcc.i686 libgcc.x86_64 libstdc++.i686 libstdc++.x86_64 libstdc++-devel.i686 libstdc++-devel.x86_64
yum install -y libXi.i686 libXi.x86_64 libXtst.i686 libXtst.x86_64
yum install -y make
yum install -y sysstat
yum install -y unixODBC.i686 unixODBC.x86_64 unixODBC-devel.i686 unixODBC-devel.x86_64
ksh无用 yum install -y ksh 需要安装pdksh,另外还需要安装elfutils-libelf-devel
wget
rpm -ivh pdksh-5.2.14-37.el5_8.1.x86_64.rpm
yum install -y elfutils-libelf-devel
否则会提示缺少package
2.8创建安装oracle所需用户与用户组
root用户:创建Oracle安装组oinstall,数据库管理员组dba,及oracle用户
[root@oracledb ~]# groupadd -g 200 oinstall
[root@oracledb ~]# groupadd -g 201 dba
[root@oracledb ~]# useradd -u 440 -g oinstall -G dba -d /home/oracle oracle
[root@oracledb ~]# passwd oracle
2.9 更改kernel参数
[root@oracledb ~]# vi /etc/sysctl.conf
#末尾添加如下
net.ipv4.ip_local_port_range= 9000 65500
fs.file-max = 6815744
kernel.shmall = 10523004
kernel.shmmax = 6465333657
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.core.rmem_default=262144
net.core.wmem_default=262144
net.core.rmem_max=4194304
net.core.wmem_max=1048576
fs.aio-max-nr = 1048576
执行以下命令使更改生效
[root@oracledb ~]# sysctl -p
2.10 修改系统资源限制
[root@oracledb ~]# vi /etc/security/limits.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
[root@oracledb ~]# vi /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
[root@oracledb ~]# vi /etc/pam.d/login #下面添加一条pam_limits.so
session required pam_limits.so
2.11 创建安装目录及设置权限
创建如下的目录
[oracle@oracledb /]$ tree /u01/
/u01/
└── oracle
├── app
└── oradata
root创建
[root@oracledb ~]# mkdir –p /u01/oracle
[root@oracledb ~]# chown –R oracle:oinstall /u01
oracle创建
[root@localhost ~]# su - oracle
[oracle@localhost ~]$ chmod 755 /u01/oracle
[oracle@localhost ~]$ mkdir /u01/oracle/app
[oracle@localhost ~]$ chmod 755 /u01/oracle/app/
[oracle@localhost ~]$ mkdir /u01/oracle/oradata
[oracle@localhost ~]$ chmod 755 /u01/oracle/oradata/
[oracle@localhost ~]$ vi ./.bash_profile
# 在文件末尾添加
umask 022
export ORACLE_BASE=/u01/oracle/app
2.12 设置oracle环境变量
[oracle@oracledb ~]$ vi ~/.bash_profile
export ORACLE_BASE=/u01/oracle/app
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export PATH=$PATH:$ORACLE_HOME/bin
export ORACLE_SID=orcl
[oracle@oracledb ~]$ source .bash_profile #立即生效