// 注释 # root用户 $oracle用户
1. 关闭安全措施
# chkconfig iptables off // 永久关闭防火墙
# serviceiptables stop // 暂时关闭防火墙,重启系统后会自动打开
# sed -i "s/SELINUX=enforcing/SELINUX=disabled/" /etc/selinux/config // 关闭Selinux
2. 验证硬件
2.1 内存:
要求:内存最小1G,推荐2G或者更高。
查看命令:# grep MemTotal /proc/meminfo
2.2 Swap:
要求:
RAW
|
Swap |
1G至2G | 1.5倍 |
2G至16G | 同RAW相等 |
16G以上 | 16G |
查看命令:# grep SwapTotal /proc/meminfo
# free
3. 验证软件
3.1 操作系统
- Asianux Server 3 SP2
- Oracle Linux 4 Update 7
- Oracle Linux 5 Update 2 (with Red Hat Compatible Kernel)
- Oracle Linux 5 Update 5
- Oracle Linux 6
- Oracle Linux 6 (with Red Hat Compatible Kernel)
- Red Hat Enterprise Linux 4 Update 7
- Red Hat Enterprise Linux 5 Update 2
- Red Hat Enterprise Linux 5 Update 5 (with the Oracle Unbreakable Enterprise Kernel for Linux)
- Red Hat Enterprise Linux 6
- Red Hat Enterprise Linux 6 (with the Oracle Unbreakable Enterprise Kernel for Linux)
- SUSE Linux Enterprise Server 10 SP2
- SUSE Linux Enterprise Server 11
CentOS7本文按照Red Hat Enterprise Linux 6来配置。
# cat /proc/version // 查看版本
3.2 内核
- On Oracle Linux 4 and Red Hat Enterprise Linux 4 2.6.9 or later
- On Oracle Linux 5 Update 2 with Red Hat Compatible Kernel 2.6.18 or later
- On Oracle Linux 5 Update 5 with Red Hat Compatible Kernel 2.6.18 or later
- On Oracle Linux 5 Update 5 with Unbreakable Enterprise Kernel 2.6.32-100.0.19 or later
- On Oracle Linux 6 2.6.32-100.28.5.el6.x86_64 or later
- On Oracle Linux 6 with Red Hat Compatible Kernel 2.6.32-71.el6.x86_64 or later
- On Red Hat Enterprise Linux 5 Update 2 2.6.18 or later
- On Red Hat Enterprise Linux 5 Update 5 2.6.18 or later
- On Red Hat Enterprise Linux 5 Update 5 with Unbreakable Enterprise Kernel 2.6.32 or later
- On Red Hat Enterprise Linux 6 2.6.32-71.el6.x86_64 or later
- On Red Hat Enterprise Linux 6 with Unbreakable Enterprise Kernel 2.6.32-100.28.5.el6.x86_64 or later
- On Asianux Server 3 2.6.18 or later
- On SUSE Linux Enterprise Server 10 2.6.16.21 or later
- On SUSE Linux Enterprise Server 11 2.6.27.19 or later
# uname-r
3.3 验证需要的包:
# rpm -qa binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel elfutils-libelf-devel-static gcc gcc-c++ glibc glibc-common glibc-devel glibc-headers glibc-static kernel-headers pdksh libaio libaio-devel libgcc libgomp libstdc++ libstdc++-devel libstdc++-static make numactl-devel sysstat unixODBC unixODBC-devel // 验证命令26个包
- kernel-headers-3.10.0-123.el7.x86_64
- gcc-c++-4.8.2-16.el7.x86_64
- numactl-devel-2.0.9-2.el7.x86_64
- glibc-headers-2.17-55.el7.x86_64
- glibc-common-2.17-55.el7.x86_64
- binutils-2.23.52.0.1-16.el7.x86_64
- unixODBC-devel-2.3.1-10.el7.x86_64
- libaio-0.3.109-12.el7.x86_64
- make-3.82-21.el7.x86_64
- elfutils-libelf-0.158-3.el7.x86_64
- elfutils-libelf-devel-0.158-3.el7.x86_64
- sysstat-10.1.5-4.el7.x86_64
- glibc-static-2.17-55.el7.x86_64
- glibc-devel-2.17-55.el7.x86_64
- glibc-2.17-55.el7.x86_64
- elfutils-libelf-devel-static-0.158-3.el7.x86_64
- libaio-0.3.109-12.el7.i686
- gcc-4.8.2-16.el7.x86_64
- libgcc-4.8.2-16.el7.i686
- libstdc++-static-4.8.2-16.el7.x86_64
- libaio-devel-0.3.109-12.el7.x86_64
- libstdc++-4.8.2-16.el7.x86_64
- libaio-devel-0.3.109-12.el7.i686
- unixODBC-2.3.1-10.el7.x86_64
- libstdc++-devel-4.8.2-16.el7.x86_64
- compat-libstdc++-33-3.2.3-71.el7.x86_64
- libgcc-4.8.2-16.el7.x86_64
- libgomp-4.8.2-16.el7.x86_64
#rpm -ivh 安装包名 // 安装程序包
4. 创建组和用户
# groupadd dba
# groupadd oinstall
# useradd -m -g oinstall -G dba oracle
# passwd oracle
// 如果nobody用户不存在(id nobody命令查看),则创建:
# useradd nobody
# groupadd oinstall
# useradd -m -g oinstall -G dba oracle
# passwd oracle
// 如果nobody用户不存在(id nobody命令查看),则创建:
# useradd nobody
5. 配置内核
注:配置大于系统数据需要配置更改,否则不需要配置。
要求配置:
参数 | 最小值 | 文件 | 命令 |
semmsl
semmns semopm semmni |
50
32000 100 128 |
/proc/sys/kernel/sem
|
# /sbin/sysctl -a | grep sem
|
shmall
|
2097152
|
/proc/sys/kernel/shmall
|
# /sbin/sysctl -a | grep shm |
shmmax
|
4294967296
|
/proc/sys/kernel/shmmax
// 最大共享内存,官方文档建议是内存的1/2 // 我的服务器是8G内存,所以为4*1024*1024*1024 // 最小值为536870912(1G内存/2) |
# /sbin/sysctl -a | grep shm |
shmmni
|
4096
|
/proc/sys/kernel/shmmni
|
# /sbin/sysctl -a | grep shm |
file-max
|
6815744
|
/proc/sys/fs/file-max
|
# /sbin/sysctl -a | grep file-max |
ip_local_port_range
|
9000 65500
|
/proc/sys/net/ipv4/ip_local_port_range
|
# /sbin/sysctl -a | grep ip_local_port_range |
rmem_default |
262144
|
/proc/sys/net/core/rmem_default
|
# /sbin/sysctl -a | grep rmem_default |
rmem_max |
4194304
|
/proc/sys/net/core/rmem_max
|
# /sbin/sysctl -a | grep rmem_max |
wmem_default |
262144
|
/proc/sys/net/core/wmem_default
|
# /sbin/sysctl -a | grep wmem_default
|
wmem_max |
1048576
|
/proc/sys/net/core/wmem_max
|
# /sbin/sysctl -a | grep wmem_max
|
aio-max-nr | 1048576 |
# vi /etc/sysctl.conf
按照系统值对比添加:
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 536870912
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
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 536870912
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
保存后生效命令:
# /sbin/sysctl -p
6. 创建安装目录
# mkdir -p /opt/oracle/product/11.2.0.1
# chown -R oracle:oinstall /opt/oracle
# chown -R oracle:oinstall /opt/oracle
# mkdir /var/oracle
# chown oracle:oinstall /var/oracle
# chmod 755 /var/oracle
# chown oracle:oinstall /var/oracle
# chmod 755 /var/oracle
7. 配置环境变量
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
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
使用Oracle用户登陆:
su - oracle
vi ~/.bash_profile
以下是配置文件的内容,里面已有的部分就不必在次添加了。
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
umask 022
# +--------------------------+
# | SETUP ORACLE ENVIRONMENT |
# +--------------------------+
su - oracle
vi ~/.bash_profile
以下是配置文件的内容,里面已有的部分就不必在次添加了。
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
umask 022
# +--------------------------+
# | SETUP ORACLE ENVIRONMENT |
# +--------------------------+
TMP=/tmp
TMPDIR=/tmp
export TMP TMPDIR
# 如果安装出现相关问题请屏蔽下面5行,
# 安装好后再取消屏蔽这些环境变量设置
export ORACLE_HOME=/opt/oracle/product/11.2.0.1
export ORACLE_BASE=/opt/oracle
export ORACLE_SID=afcsc
export TNS_ADMIN=$ORACLE_HOME/network/admin
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
export PATH=$PATH:$ORACLE_HOME/bin
# +--------------------------+
# | LINUX STUFF |
# +--------------------------+
export LANG=AMERICAN_AMERICA.ZHS16GBK
unset USERNAME
# +-------------+
# | "GREETINGS" |
# +-------------+
echo ".bash_profile executed"
TMPDIR=/tmp
export TMP TMPDIR
# 如果安装出现相关问题请屏蔽下面5行,
# 安装好后再取消屏蔽这些环境变量设置
export ORACLE_HOME=/opt/oracle/product/11.2.0.1
export ORACLE_BASE=/opt/oracle
export ORACLE_SID=afcsc
export TNS_ADMIN=$ORACLE_HOME/network/admin
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
export PATH=$PATH:$ORACLE_HOME/bin
# +--------------------------+
# | LINUX STUFF |
# +--------------------------+
export LANG=AMERICAN_AMERICA.ZHS16GBK
unset USERNAME
# +-------------+
# | "GREETINGS" |
# +-------------+
echo ".bash_profile executed"
执行:source ~/.bash_profile
8. 设置进程数和最大会话数
编辑文件:
# vi /etc/security/limits.conf 加入以下语句:
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
9. 关联设置
编辑文件:vi /etc/pam.d/login 加入以下语句:
session required pam_limits.so
(注意:根据最后一条session规则的注释,应该加在最后一条规则之前)
编辑文件:vi /etc/pam.d/login 加入以下语句:
session required pam_limits.so
(注意:根据最后一条session规则的注释,应该加在最后一条规则之前)
9. 解压缩
将linux.x64_11gR2_database_1of2.zip和linux.x64_11gR2_database_2of2.zip移动到移动到/tmp目录下进行解压缩。
$ cd /tmp
$ unzip linux.x64_11gR2_database_1of2.zip
$ unzip linux.x64_11gR2_database_2of2.zip
10. 安装
$ cd /tmp/database/
$ ./runInstaller
注意:
选择advance install
数据库home设置为/opt/oracle/product/11.2.0.1
数据库全局名称设置为afcsc
字符集选Simplified Chinese ZHS16GBK
选择advance install
数据库home设置为/opt/oracle/product/11.2.0.1
数据库全局名称设置为afcsc
字符集选Simplified Chinese ZHS16GBK
检查后会运行图形化安装界面。
安装过程中连接库时会出现两个错误:
- 第一个:
问题:glibc是2.17的库,连接找的是2.14的库。
解决办法:改成静态链接。
查看 /usr/lib64/libc.a是否存在。
修改oracle安装目录下:$ORACLE_HOME/ctx/lib/ins_ctx.mk
ctxhx: $(CTXHXOBJ)
$(LINK_CTXHX) $(CTXHXOBJ) $(INSO_LINK)
$(LINK_CTXHX) $(CTXHXOBJ) $(INSO_LINK)
修改为:
ctxhx: $(CTXHXOBJ)
-static $(LINK_CTXHX) $(CTXHXOBJ) $(INSO_LINK) /usr/lib64/libc.a
-static $(LINK_CTXHX) $(CTXHXOBJ) $(INSO_LINK) /usr/lib64/libc.a
然后点击retry通过。
- 第二个:
解决办法:
修改/opt/oracle/product/11.2.0.1/sysman/lib/ins_emagent
$(MK_EMAGENT_NMECTL)
修改为:
$(MK_EMAGENT_NMECTL) -lnnz11
然后点击retry通过。
注:安装需要远程图形化连接安装oracle,具体方式和软件这里不说了。