入职新坑使用的都是oracle12C,决定好好的研究下,oracle数据库版本升级太快,现在官网已经到了oracle 19C,现在oracle12c也慢慢的被大家认可,一些新特性也很实用,今天把oracle-database-server-12cR2-preinstall安装oracle12c官方参数分享给大家。详细的安装过程我会发在另一篇文章中。
首先我们要知道oracle-database-server-12cR2-preinstall为我们做了什么
(1)自动安装oracle所需的RPM包
(2)自动创建oracle用户和dba、oinstall组
(3)自动配置/etc/sysctl.conf内核参数
(4)自动配置/etc/security/limits.conf参数
(5)关闭NUMA=OFF (关闭非一致内存访问)
(6)关闭NOZEROCONF=yes
(7)修改系统启动版本信息
稍后我会贴上oracle-database-server-12cR2-preinstall更改的日志
wget -O /etc/yum.repos.d/oracle.repo http://public-yum.oracle.com/public-yum-ol7.repo
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
yum clean all
yum makecache
yum -y install oracle-database-server-12cR2-preinstall
报错GPG key retrieval failed: [Errno 14] curl#37 - "Couldn't open file /etc/pki/rpm-gpg/RPM-GPG-KEY-oracle"
vim /etc/yum.repos.d/oracle.repo
把gpgcheck=1,改为gpgcheck=0
继续执行:yum -y install oracle-database-server-12cR2-preinstall
Transaction check error:
file /usr/lib/systemd/system-preset/90-default.preset from install of redhat-release-server-1:7.8-2.0.1.el7.x86_64 conflicts with file from package centos-release-7-6.1810.2.el7.centos.x86_64
file /etc/os-release from install of oraclelinux-release-7:7.8-1.0.7.el7.x86_64 conflicts with file from package centos-release-7-6.1810.2.el7.centos.x86_64
file /etc/redhat-release from install of oraclelinux-release-7:7.8-1.0.7.el7.x86_64 conflicts with file from package centos-release-7-6.1810.2.el7.centos.x86_64
file /etc/rpm/macros.dist from install of oraclelinux-release-7:7.8-1.0.7.el7.x86_64 conflicts with file from package centos-release-7-6.1810.2.el7.centos.x86_64
file /etc/system-release from install of oraclelinux-release-7:7.8-1.0.7.el7.x86_64 conflicts with file from package centos-release-7-6.1810.2.el7.centos.x86_64
file /etc/system-release-cpe from install of oraclelinux-release-7:7.8-1.0.7.el7.x86_64 conflicts with file from package centos-release-7-6.1810.2.el7.centos.x86_64
报错 oracle需要redhat版本信息,因为oracle官方要求使用redhat,我们删除centos版本信息
rpm -e --nodeps centos-release-7-6.1810.2.el7.centos.x86_64
版本信息由centos变成了redhat
[root@localhost ~]# cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)
[root@localhost packages]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.8 (Maipo)
继续执行:yum -y install oracle-database-server-12cR2-preinstall
安装成功
[root@localhost ~]# cd /var/log/oracle-database-server-12cR2-preinstall/results/
[root@localhost results]# ll
total 8
-rw-r--r--. 1 root root 5918 Jun 30 18:29 orakernel.log
[root@localhost results]# cat orakernel.log
Adding group oinstall with gid 54321
Adding group dba with gid 54322
Adding group oper with gid 54323
Adding group backupdba with gid 54324
Adding group dgdba with gid 54325
Adding group kmdba with gid 54326
Adding group racdba with gid 54330
Adding user oracle with user id 54321, initial login group oinstall, supplementary groups oinstall,dba,oper,backupdba,dgdba,kmdba,racdba and home directory /home/oracle
Changing ownership of /home/oracle to oracle:oinstall
Please set password for user - oracle
uid=54321(oracle) gid=54321(oinstall) groups=54321(oinstall),54322(dba),54323(oper),54324(backupdba),54325(dgdba),54326(kmdba),54330(racdba)
User creation passed
Saving a copy of the initial sysctl.conf
Verifying kernel parameters as per Oracle recommendations...
Trying to remove instances of - setting for fs.file-max is
Adding fs.file-max = 6815744
Trying to remove instances of - setting for kernel.sem is
Adding kernel.sem = 250 32000 100 128
Trying to remove instances of - setting for kernel.shmmni is
Adding kernel.shmmni = 4096
Trying to remove instances of - setting for kernel.shmall is
Adding kernel.shmall = 1073741824
Trying to remove instances of - setting for kernel.shmmax is
Adding kernel.shmmax = 4398046511104
Trying to remove instances of - setting for kernel.panic_on_oops is
Adding kernel.panic_on_oops = 1
Trying to remove instances of - setting for net.core.rmem_default is
Adding net.core.rmem_default = 262144
Trying to remove instances of - setting for net.core.rmem_max is
Adding net.core.rmem_max = 4194304
Trying to remove instances of - setting for net.core.wmem_default is
Adding net.core.wmem_default = 262144
Trying to remove instances of - setting for net.core.wmem_max is
Adding net.core.wmem_max = 1048576
Trying to remove instances of - setting for net.ipv4.conf.all.rp_filter is
Adding net.ipv4.conf.all.rp_filter = 2
Trying to remove instances of - setting for net.ipv4.conf.default.rp_filter is
Adding net.ipv4.conf.default.rp_filter = 2
Trying to remove instances of - setting for fs.aio-max-nr is
Adding fs.aio-max-nr = 1048576
Trying to remove instances of - setting for net.ipv4.ip_local_port_range is
Adding net.ipv4.ip_local_port_range = 9000 65500
Setting kernel parameters as per oracle recommendations...
Altered file /etc/sysctl.conf
Saved a copy of the current file in /etc/sysctl.d/99-oracle-database-server-12cR2-preinstall-sysctl.conf
Check /etc/sysctl.d for backups
Verification & setting of kernel parameters passed
Setting user limits using /etc/security/limits.d/oracle-database-server-12cR2-preinstall.conf
Verifying oracle user OS limits as per Oracle recommendations...
Adding oracle soft nofile 1024
Adding oracle hard nofile 65536
Adding oracle soft nproc 16384
Adding oracle hard nproc 16384
Adding oracle soft stack 10240
Adding oracle hard stack 32768
Adding oracle hard memlock 134217728
Adding oracle soft memlock 134217728
Setting oracle user OS limits as per Oracle recommendations...
Altered file /etc/security/limits.d/oracle-database-server-12cR2-preinstall.conf
Original file backed up at /var/log/oracle-database-server-12cR2-preinstall/backup/Jun-30-2020-18-29-26
Verification & setting of user limits passed
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/Jun-30-2020-18-29-26...
Verifying kernel boot parameters as per Oracle recommendations...
old boot params: "rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet"
new boot params: "rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet numa=off"
old boot params: "rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet numa=off"
new boot params: "rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet numa=off transparent_hugepage=never"
Setting kernel boot parameters as per Oracle recommendations...
G_DIR=/boot/grub2
Default kernel is -> 3.10.0-957.el7.x86_64
Default saved_entry is -> CentOS Linux (3.10.0-957.el7.x86_64) 7 (Core)
Default saved_entry_line is -> linux16 /vmlinuz-3.10.0-957.el7.x86_64
Saving a copy of grubenv... in /var/log/oracle-database-server-12cR2-preinstall/backup/Jun-30-2020-18-29-26
Generating grub configuration file ...
File descriptor 199 (/run/lock/subsys/oracle-preinstall.lock) leaked on vgs invocation. Parent PID 21452: /usr/sbin/grub2-probe
File descriptor 199 (/run/lock/subsys/oracle-preinstall.lock) leaked on vgs invocation. Parent PID 21452: /usr/sbin/grub2-probe
Found linux image: /boot/vmlinuz-3.10.0-957.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-957.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-899082b00c344ba59af41e3b04ea3084
Found initrd image: /boot/initramfs-0-rescue-899082b00c344ba59af41e3b04ea3084.img
File descriptor 199 (/run/lock/subsys/oracle-preinstall.lock) leaked on vgs invocation. Parent PID 21654: /usr/sbin/grub2-probe
File descriptor 199 (/run/lock/subsys/oracle-preinstall.lock) leaked on vgs invocation. Parent PID 21654: /usr/sbin/grub2-probe
done
The saved kernel 3.10.0-957.el7.x86_64 is now at position - 0
Boot parameters will be effected on next reboot
Altered file /etc/default/grub
Copy of the changed file is in - /etc/default/grub-oracle-database-server-12cR2-preinstall.orabackup
Copy of the original file is in - /var/log/oracle-database-server-12cR2-preinstall/backup/Jun-30-2020-18-29-26
Verification & setting of boot parameters passed
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
Taking a backup of old config files under /var/log/oracle-database-server-12cR2-preinstall/backup/Jun-30-2020-18-29-26
可以看到oracle-database-server-12cR2-preinstall已经把安装前的准备工作做好了,先将官方修改的参数贴在下面
[root@localhost ~]# id oracle
uid=54321(oracle) gid=54321(oinstall) groups=54321(oinstall),54322(dba),54323(oper),54324(backupdba),54325(dgdba),54326(kmdba),54330(racdba)
[root@localhost ~]# cat /etc/sysctl.conf
# sysctl settings are defined through files in
# /usr/lib/sysctl.d/, /run/sysctl.d/, and /etc/sysctl.d/.
#
# Vendors settings live in /usr/lib/sysctl.d/.
# To override a whole file, create a new file with the same in
# /etc/sysctl.d/ and put new settings there. To override
# only specific settings, add a file with a lexically later
# name in /etc/sysctl.d/ and put new settings there.
#
# For more information, see sysctl.conf(5) and sysctl.d(5).
# oracle-database-server-12cR2-preinstall setting for fs.file-max is 6815744
fs.file-max = 6815744
# oracle-database-server-12cR2-preinstall setting for kernel.sem is '250 32000 100 128'
kernel.sem = 250 32000 100 128
# oracle-database-server-12cR2-preinstall setting for kernel.shmmni is 4096
kernel.shmmni = 4096
# oracle-database-server-12cR2-preinstall setting for kernel.shmall is 1073741824 on x86_64
kernel.shmall = 1073741824
# oracle-database-server-12cR2-preinstall setting for kernel.shmmax is 4398046511104 on x86_64
kernel.shmmax = 4398046511104
# oracle-database-server-12cR2-preinstall setting for kernel.panic_on_oops is 1 per Orabug 19212317
kernel.panic_on_oops = 1
# oracle-database-server-12cR2-preinstall setting for net.core.rmem_default is 262144
net.core.rmem_default = 262144
# oracle-database-server-12cR2-preinstall setting for net.core.rmem_max is 4194304
net.core.rmem_max = 4194304
# oracle-database-server-12cR2-preinstall setting for net.core.wmem_default is 262144
net.core.wmem_default = 262144
# oracle-database-server-12cR2-preinstall setting for net.core.wmem_max is 1048576
net.core.wmem_max = 1048576
# oracle-database-server-12cR2-preinstall setting for net.ipv4.conf.all.rp_filter is 2
net.ipv4.conf.all.rp_filter = 2
# oracle-database-server-12cR2-preinstall setting for net.ipv4.conf.default.rp_filter is 2
net.ipv4.conf.default.rp_filter = 2
# oracle-database-server-12cR2-preinstall setting for fs.aio-max-nr is 1048576
fs.aio-max-nr = 1048576
# oracle-database-server-12cR2-preinstall setting for net.ipv4.ip_local_port_range is 9000 65500
net.ipv4.ip_local_port_range = 9000 65500
oracle12c 不在修改/etc/security/limits.conf而是启用/etc/security/limits.d/oracle-database-server-12cR2-preinstall.conf
[root@localhost ~]# cat /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
[root@localhost ~]# cat /etc/sysconfig/network
# Created by anaconda
# oracle-database-server-12cR2-preinstall : Add NOZEROCONF=yes
NOZEROCONF=yes
禁用ZEROCONF。ZEROCONF又被叫做 IPv4 Link-Local (IPv4LL)和 Automatic Private IP Addressing (APIPA)。它是一个动态配置协议,系统可以通过它来连接到网络。官方On Oracle Linux/Redhat Linux, "NOZEROCONF=yes" must be included in /etc/sysconfig/network,注意:但是在RAC 和 Oracle Clusterware 最佳实践和初学者指南 (Linux) (Doc ID 1525820.1)中,并没有NOZEROCONF的描述。
[root@localhost limits.d]# cat /etc/default/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="rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet numa=off transparent_hugepage=never"
GRUB_DISABLE_RECOVERY="true"
关闭 NUMA=OFF;NUMA(Non-Uniform Memory Access)CPU亲和策略导致的内存分配不平均,所以oracle官方建议关闭NUMA
[root@localhost ~]# cd /boot/grub2
[root@localhost grub2]# ll
total 40
-rw-r--r--. 1 root root 64 Jun 30 17:54 device.map
drwxr-xr-x. 2 root root 25 Jun 30 17:54 fonts
-rw-r--r--. 1 root root 4314 Jun 30 18:29 grub.cfg
-rw-r--r--. 1 root root 4253 Jun 30 18:29 grub.cfg-oracle-database-server-12cR2-preinstall.orabackup
-rw-r--r--. 1 root root 1024 Jun 30 18:29 grubenv
drwxr-xr-x. 2 root root 8192 Jun 30 17:54 i386-pc
drwxr-xr-x. 2 root root 4096 Jun 30 17:54 locale
[root@localhost grub2]# cat grub.cfg
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub2-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#
### BEGIN /etc/grub.d/00_header ###
set pager=1
if [ -s $prefix/grubenv ]; then
load_env
fi
if [ "${next_entry}" ] ; then
set default="${next_entry}"
set next_entry=
save_env next_entry
set boot_once=true
else
set default="${saved_entry}"
fi
if [ x"${feature_menuentry_id}" = xy ]; then
menuentry_id_option="--id"
else
menuentry_id_option=""
fi
export menuentry_id_option
if [ "${prev_saved_entry}" ]; then
set saved_entry="${prev_saved_entry}"
save_env saved_entry
set prev_saved_entry=
save_env prev_saved_entry
set boot_once=true
fi
function savedefault {
if [ -z "${boot_once}" ]; then
saved_entry="${chosen}"
save_env saved_entry
fi
}
function load_video {
if [ x$feature_all_video_module = xy ]; then
insmod all_video
else
insmod efi_gop
insmod efi_uga
insmod ieee1275_fb
insmod vbe
insmod vga
insmod video_bochs
insmod video_cirrus
fi
}
terminal_output console
if [ x$feature_timeout_style = xy ] ; then
set timeout_style=menu
set timeout=5
# Fallback normal timeout code in case the timeout_style feature is
# unavailable.
else
set timeout=5
fi
### END /etc/grub.d/00_header ###
### BEGIN /etc/grub.d/00_tuned ###
set tuned_params=""
set tuned_initrd=""
### END /etc/grub.d/00_tuned ###
### BEGIN /etc/grub.d/01_users ###
if [ -f ${prefix}/user.cfg ]; then
source ${prefix}/user.cfg
if [ -n "${GRUB2_PASSWORD}" ]; then
set superusers="root"
export superusers
password_pbkdf2 root ${GRUB2_PASSWORD}
fi
fi
### END /etc/grub.d/01_users ###
### BEGIN /etc/grub.d/10_linux ###
menuentry 'Oracle Linux Server (3.10.0-957.el7.x86_64) 7.8' --class oracle --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-957.el7.x86_64-advanced-37a21a5c-ba34-449e-9d9b-4ce20615eefb' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_msdos
insmod xfs
set root='hd0,msdos1'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 --hint='hd0,msdos1' f6eb647a-b3b4-45bc-8125-951724eb307d
else
search --no-floppy --fs-uuid --set=root f6eb647a-b3b4-45bc-8125-951724eb307d
fi
linux16 /vmlinuz-3.10.0-957.el7.x86_64 root=/dev/mapper/centos-root ro rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet numa=off transparent_hugepage=never
initrd16 /initramfs-3.10.0-957.el7.x86_64.img
}
menuentry 'Oracle Linux Server (0-rescue-899082b00c344ba59af41e3b04ea3084) 7.8' --class oracle --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-0-rescue-899082b00c344ba59af41e3b04ea3084-advanced-37a21a5c-ba34-449e-9d9b-4ce20615eefb' {
load_video
insmod gzio
insmod part_msdos
insmod xfs
set root='hd0,msdos1'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 --hint='hd0,msdos1' f6eb647a-b3b4-45bc-8125-951724eb307d
else
search --no-floppy --fs-uuid --set=root f6eb647a-b3b4-45bc-8125-951724eb307d
fi
linux16 /vmlinuz-0-rescue-899082b00c344ba59af41e3b04ea3084 root=/dev/mapper/centos-root ro rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet numa=off transparent_hugepage=never
initrd16 /initramfs-0-rescue-899082b00c344ba59af41e3b04ea3084.img
}
### END /etc/grub.d/10_linux ###
### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###
### BEGIN /etc/grub.d/20_ppc_terminfo ###
### END /etc/grub.d/20_ppc_terminfo ###
### BEGIN /etc/grub.d/30_os-prober ###
### END /etc/grub.d/30_os-prober ###
### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
### END /etc/grub.d/40_custom ###
### BEGIN /etc/grub.d/41_custom ###
if [ -f ${config_directory}/custom.cfg ]; then
source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f $prefix/custom.cfg ]; then
source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###
重启发现启动界面已经替换为 Oracle linux server 7.8 ,这是因为kernel版本3.10.0-957.el7.x86_64在oracle linux和redhat 中是7.8版本。这一步好像无关痛痒,手动配置时可以忽略。
可以看出oracle-database-server-12cR2-preinstall 修改了很多系统配置为oracle数据库运行提供支持
我们在自己安装的时候可以参考官方给的参数数据。