Install Oracle Database 12cR2 On Oracle Enterprise Linux7.3

前端之家收集整理的这篇文章主要介绍了Install Oracle Database 12cR2 On Oracle Enterprise Linux7.3前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

请仔细阅读Oracle官方手册Database Installation Guide for Linux

安装操作系统之后如果想安装VBox的增强功能可能出现的报错如下:

[root@oel73 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.116 oel73

2. 关闭SElinux

vi /etc/selinux/config ==>SELINUX=disabled

3. 关闭FIREWALL

systemctl stop firewalld
systemctl status firewalld
systemctl disable firewalld

机器性能修改运行级别3(multi-user.target)或者5(graphical.target)

systemctl get-default
systemctl set-default multi-user.target

4. Disable Transparent HugePages(如果安装了oracle-database-server-12cR2-preinstall则不需要此步骤)

[root@oel73 ~]# 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@oel73 ~]# 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=ol/root rd.lvm.lv=ol/swap rhgb quiet"
GRUB_DISABLE_RECOVERY="true"

修改GRUB_CMDLINE_LINUX为如下的选项

GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=ol/root rd.lvm.lv=ol/swap rhgb quiet transparent_hugepage=never"

重新生成grub.cfg文件

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/oracle-release
uname -r

10. 检查共享内存段(大小为系统内存的一半)

df -h /dev/shm

11. 配置本地yum源

mount /dev/sr0 /mnt
cd /etc/yum.repos.d
mv public-yum-ol7.repo public-yum-ol7.repo.bak
vi oel73.repo
[oel73]
name=Oracle Linux $releasever Latest ($basearch)
baseurl=file:///mnt
enabled=1
gpgcheck=0

12. 创建组和用户(如果安装了oracle-database-server-12cR2-preinstall则不需要手动创建用户和组)

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. 修改用户限制(如果安装了oracle-database-server-12cR2-preinstall则不需要手动limits.conf)

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

确保加载了最新版本的 PAM,然后在/etc/pam.d/login 文件添加或编辑以下行(如果还没有这些内容):

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. 修改内核参数(如果安装了oracle-database-server-12cR2-preinstall则不需要手动修改内核参数)

如果系统给出的参数值比官方文档给出的大,则不需要更改!

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. 安装必须的软件包

Oracle Linux可以直接安装下面一个安装包

yum install oracle-database-server-12cR2-preinstall

相关日志:

/var/log/oracle-database-server-12cR2-preinstall/results/orakernel.log

oracle-database-server-12cR2-preinstall这个软件包做了什么工作?

官方文档解释如下:
1. Automatically downloads and installs any additional RPM packages needed for installing Oracle Grid Infrastructure and Oracle Database,and resolves any dependencies

  1. Creates an oracle user,and creates the oraInventory (oinstall) and OSDBA (dba) groups for that user

  2. As needed,sets sysctl.conf settings,system startup parameters,and driver parameters to values based on recommendations from the Oracle RDBMS Pre-Install program

  3. Sets hard and soft resource limits

  4. Sets other recommended parameters,depending on your kernel version

可以看到主要做了自动安装依赖包,创建用户和组,设置内核参数,系统启动参数和一些驱动参数,设置用户资源限制,设置其他以及依赖的内核参数。
在日志中发现,他只会创建oracle用户,dba,oinstall两个组,如果已经存在则跳过。修改内核参数等文件之前会先自动备份
定义用户资源限制的文件为/etc/security/limits.d/oracle-database-server-12cR2-preinstall.conf

# oracle-database-server-12cR2-preinstall setting for nofile soft limit is 1024
oracle   soft   nofile    1024

# oracle-database-server-12cR2-preinstall setting for nofile hard limit is 65536
oracle   hard   nofile    65536

# oracle-database-server-12cR2-preinstall setting for nproc soft limit is 16384
# refer orabug15971421 for more info.
oracle   soft   nproc    16384

# oracle-database-server-12cR2-preinstall setting for nproc hard limit is 16384
oracle   hard   nproc    16384

# oracle-database-server-12cR2-preinstall setting for stack soft limit is 10240KB
oracle   soft   stack    10240

# oracle-database-server-12cR2-preinstall setting for stack hard limit is 32768KB
oracle   hard   stack    32768

# oracle-database-server-12cR2-preinstall setting for memlock hard limit is maximum of 128GB on x86_64 or 3GB on x86 OR 90 % of RAM
oracle   hard   memlock    134217728

# oracle-database-server-12cR2-preinstall setting for memlock soft limit is maximum of 128GB on x86_64 or 3GB on x86 OR 90% of RAM
oracle   soft   memlock    134217728

可以看到上面设置比官方文档多了memlock的设置

系统引导参数的变化

Saving a copy of /etc/default/grub file in /etc/default/grub-initial.orabackup
Saving a copy of /etc/default/grub in /var/log/oracle-database-server-12cR2-preinstall/backup/Mar-08-2017-19-22-39...
Verifying kernel boot parameters as per Oracle recommendations...
old boot params: "crashkernel=auto rd.lvm.lv=ol/root rd.lvm.lv=ol/swap rhgb quiet transparent_hugepage=never"
new boot params: "crashkernel=auto rd.lvm.lv=ol/root rd.lvm.lv=ol/swap rhgb quiet transparent_hugepage=never numa=off"

可以看到transparent_hugepage=never是我之前手工添加的,后面又多了关闭numa。其实他会自动添加这两个参数

Trying to add NOZEROCONF parameter...
Taking a backup of existing file to /etc/sysconfig/network.orabackup
Successfully added parameter NOZEROCONF to /etc/sysconfig/network
Setting /etc/sysconfig/network parameters passed

Disabling Transparent Hugepages.
Refer Oracle Note:1557478.1

Disabling defrag.
Refer Oracle Note:1557478.1

上面又在网络配置里面加了NOZEROCONF=yes,关闭了Transparent Hugepages,defrag。

如果使用Oracle Enterprise Linux还是强烈建议安装这个软件包,能省去很多手工的工作,这些配置都是符合Oracle最佳实践的。

修改完之后重启机器

18. 安装数据库软件及建库

su - oracle
$ ./runInstaller
原文链接:https://www.f2er.com/oracle/210223.html

猜你在找的Oracle相关文章