1、基础环境检查
操作系统及Oracle版本
Linux版本:CentOS release 6.5 (Final)
Oracle版本:Oracle Database 11g Release 2 (11.2.0.4.0) for Linux
x86-64
2、硬件检测:
物理内存不少于1G
硬盘可以空间不少于5G
swap分区空间不少于2G
支持256色以上显卡
cpu主频不小于550mHZ
cat /etc/issue
uname -r (版本)
grep MemTotal /proc/meminfo (内存大小)
grep SwapTotal /proc/meminfo (交换区大小)
grep "model name" /proc/cpuinfo (CPU信息)
free (可用内存)
3、系统环境配置
关闭selinux
[root@testdb ~]# vi /etc/sysconfig/selinux
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - SELinux is fully disabled.
SELINUX=disabled
# SELINUXTYPE= type of policy in use. Possible values
are:
# targeted - Only targeted network daemons are protected.
# strict - Full SELinux protection.
SELINUXTYPE=targeted
关闭防火墙
1
2
[root@testdb ~]#service iptables stop
[root@testdb ~]#chkconfig iptables off
4、Oracle安装准备
安装目录
mkdir /oracle
mkdir -p /oracle/app/oracle
mkdir -p /oracle/app/oraInventory
用户/组创建
groupadd oinstall
groupadd dba
useradd oracle -g oinstall -G dba //主组为oinstall,副组dba
passwd oracle //设置密码linkage123
chown -R oracle:oinstall /oracle/app/
chmod -R 755 /oracle/app/
参数配置
[root@localhost ~]# vi /etc/security/limits.conf
#添加如下
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
# vi /etc/sysctl.conf
#for oracle
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 4194304
kernel.shmmax = 5368709120 #物理内存的一半
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 = 1048586
# sysctl -p
1
echo "session required pam_limits.so"
>>/etc/pam.d/login
vim /etc/profile 文件,并添加或编辑以下数据:
#For Oracle
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh"
]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
umask 0022
fi
设置环境变量
编辑/home/oracle/.bash_profile,添加如下内容:
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR
ORACLE_BASE=/oracle/app; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/oracle/product/11.2.0/db_1; export
ORACLE_HOME
ORACLE_SID=linkaged; export ORACLE_SID
#NLS_LANG=AMERICAN_AMERICA.ZHS16GBK; export NLS_LANG
PATH=$ORACLE_HOME/bin:/usr/sbin:$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
umask 022
安装补丁包
yum install -y compat-libcap1
yum install -y compat-libstdc++
yum install -y gcc
yum install -y libstdc++-devel
yum install -y libstdc++-devel*.i686
yum install -y libaio-0*.i686
yum install -y libaio-devel*
yum install -y libaio-devel*.i686
yum install -y ksh
yum install -y elfutils-libelf-devel
yum install -y gcc-c++*
yum install -y compat-libstdc++-33
5、安装oracle软件
切换到oracle账户登录,解压oracle的安装包至/tmp目录,得到database文件夹,
1
2
unzip p10404530_112030_Linux-x86-64_1of7.zip -d /tmp
unzip p10404530_112030_Linux-x86-64_2of7.zip -d /tmp
将其中的database/response/db_install.rsp复制一份出来放在/oracle/app目录下,
这是一份模板,需根据自己环境对原文件内容进行修改,需要注意的修改点有:
------------------------------------------------------------------------------
# Specify the installation option.
# It can be one of the following:
# 1. INSTALL_DB_SWONLY
# 2. INSTALL_DB_AND_CONFIG
# 3. UPGRADE_DB
#-------------------------------------------------------------------------------
oracle.install.option=INSTALL_DB_SWONLY ----我这里仅安装软件
SECURITY_UPDATES_VIA_MYORACLESUPPORT=false
DECLINE_SECURITY_UPDATES=true
如果是首次安装,还需要创建文件vi /etc/oraInst.loc,其内容如下:
inventory_loc=/oracle/app/oraInventory
inst_group=oinstall
更改文件的权限
chown oracle:oinstall /etc/oraInst.loc
chmod 664 /etc/oraInst.loc
静默安装Oracle
1
$./runInstaller -silent -responseFile
/oracle/app/db_install.rsp -ignorePrereq
安装过程根据提示,另外开一个终端,以root身份登陆(另开一个SSH即可),执行root.sh即可,然后按下回车键即可完成安装。
创建监听
$netca /silent /responsefile
/home/oracle/database/response/netca.rsp
创建数据库实例orcl
$ nohup dbca -silent -responseFile
/oracle/app/dbca.rsporacle静默安装完成。