请仔细阅读Oracle官方手册Database Installation Guide for Linux
[root@rh73 log]# vi vBoxadd-install.log
/tmp/vBox.0/Makefile.include.header:97: *** Error: unable to find the sources of your current Linux kernel. Specify KERN_DIR=<directory> and run Make again. Stop.
请执行以下命令安装软件包,重新安装增强功能,重启操作系统即可:
yum install -y gcc make kernel-headers kernel-devel
1. 设置/etc/hosts
192.168.56.200 rh73
2. 关闭SElinux
vi /etc/selinux/config ==>SELINUX=disabled
3. 关闭FIREWALL
systemctl stop firewalld
systemctl status firewalld
systemctl disable firewalld
systemctl get-default
systemctl set-default multi-user.target
4. Disable Transparent HugePages
[root@rh73 ~]# cat /sys/kernel/mm/transparent_hugepage/enabled
[always] madvise never
4.1 Oracle官方推荐(详见ALERT: Disable Transparent HugePages on SLES11,RHEL6,RHEL7,OL6,OL7,and UEK2 and above (文档 ID 1557478.1))
Add the following lines in /etc/rc.local and reboot the server (this still can be done on Redhat 7 although rc.local is being deprecated):
if test -f /sys/kernel/mm/transparent_hugepage/enabled; then
echo never > /sys/kernel/mm/transparent_hugepage/enabled
fi
if test -f /sys/kernel/mm/transparent_hugepage/defrag; then
echo never > /sys/kernel/mm/transparent_hugepage/defrag
fi
重启操作系统验证
注意:如果生产系统,需要配置Hugepage,具体请参考MOS。
4.2 RedHat给出的解决方案
[root@rh73 ~]# vi /etc/sysconfig/grub
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's,release .*$,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=rhel_rh73/root rd.lvm.lv=rhel_rh73/swap rhgb quiet"
GRUB_DISABLE_RECOVERY="true"
修改GRUB_CMDLINE_LINUX为如下的选项
GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=rhel_rh73/root rd.lvm.lv=rhel_rh73/swap rhgb quiet transparent_hugepage=never"
grub2-mkconfig -o /boot/grub2/grub.cfg
重启操作系统验证
cat /proc/cmdline
cat /sys/kernel/mm/transparent_hugepage/enabled
5. 检查物理内存(>=1G)
grep MemTotal /proc/meminfo
6.检查SWAP大小
RAM | Swap Space |
---|---|
Between 1 GB and 2 GB | 1.5 times the size of the RAM |
Between 2 GB and 16 GB | Equal to the size of the RAM |
More than 16 GB | 16 GB |
grep SwapTotal /proc/meminfo
7. 检查/tmp(>1G)
df -h /tmp
8. 检查空闲的内存
free
9. 确定系统架构,内核版本,操作系统版本
uname -m
cat /etc/redhat-release
uname -r
10. 检查共享内存段(大小为系统内存的一半)
df -h /dev/shm
11. 配置本地yum源
mount /dev/sr0 /mnt
cd /etc/yum.repos.d
vi redhat.repo
[rhel73]
name=Red Hat Enterprise Linux
baseurl=file:///mnt
enabled=1
gpgcheck=0
12. 创建组和用户
groupadd -g 54321 oinstall
groupadd -g 54322 dba
groupadd -g 54323 oper
groupadd -g 54324 backupdba
groupadd -g 54325 dgdba
groupadd -g 54326 kmdba
groupadd -g 54330 racdba
useradd -u 54321 -g oinstall -G dba,oper,backupdba,dgdba,kmdba,racdba oracle
passwd oracle
13. 创建软件安装目录
mkdir /u01
chown oracle:oinstall /u01 -R
chmod 775 /u01 -R
14. 修改用户限制
vi /etc/security/limits.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
oracle hard stack 10240
session required pam_limits.so
验证当前 ulimit,如果需要则增大。可以采用多种方式完成此操作,推荐方法是在 /etc/profile 中添加以下行:
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -u 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
15. 修改内核参数
如果系统给出的参数值比官方文档给出的大,则不需要更改!
Modify your kernel settings in /etc/sysctl.conf (RedHat) as follows. If the current value for any parameter is higher than the value listed in this table,do not change the value of that parameter. Range values (such as net.ipv4.ip_local_port_range) must match exactly.
vi /etc/sysctl.conf
kernel.msgmax = 65536
kernel.shmmax = 68719476736
kernel.shmall = 4294967296
fs.file-max = 6815744
fs.aio-max-nr = 1048576
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
kernel.panic_on_oops=1
使内核参数生效
sysctl -p
16. 设置oracle用户环境变量
# vi /home/oracle/.bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/12.2.0/dbhome_1
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:/sbin:/bin:/usr/sbin:/usr/bin:$PATH
export ORACLE_SID=PROD
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/lib32:/lib:/usr/lib
17. 安装必须的软件包
官方文档里面要求装的包(RHEL7):
binutils-2.23.52.0.1-12.el7 (x86_64)
compat-libcap1-1.10-3.el7 (x86_64)
compat-libstdc++-33-3.2.3-71.el7 (i686)
compat-libstdc++-33-3.2.3-71.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)
libxcb-1.9-5.el7 (i686)
libxcb-1.9-5.el7 (x86_64)
libX11-1.6.0-2.1.el7 (i686)
libX11-1.6.0-2.1.el7 (x86_64)
libXau-1.0.8-2.1.el7 (i686)
libXau-1.0.8-2.1.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)
net-tools-2.0-0.17.20131004git.el7 (x86_64) (for Oracle RAC and Oracle Clusterware)
nfs-utils-1.3.0-0.21.el7.x86_64 (for Oracle ACFS)
smartmontools-6.2-4.el7 (x86_64)
sysstat-10.1.5-1.el7 (x86_64)
rpm -qa --queryformat "%{NAME}-%{VERSION}-%{RELEASE} (%{ARCH})\n" | grep package_name
yum install -y package_name
compat-libstdc++软件包没有,不需要安装。如果是安装12.1的时候会报错,可以忽略。12.2没有影响
修改完之后重启机器
18. 安装数据库软件及建库
su - oracle
$ ./runInstaller