代码改变世界

OEL上使用yum install oracle-validated 简化主机配置工作

2016-12-30 08:22  AlfredZhao  阅读(...)  评论(...编辑  收藏

环境:OEL 5.7 + Oracle 10.2.0.5 RAC

如果你正在用OEL(Oracle Enterprise Linux)系统部署Oracle,那么可以使用yum安装oracle-validated包来简化主机配置的部分工作。

配置好yum本地源后,直接执行一条命令

yum install oracle-validated

检查发现它会自动做以下几件事:
1)安装oracle依赖包
2)/etc/sysctl.conf 增加oracle用户内容
3)/etc/security/limits.conf 增加oracle用户内容
4)创建Oracle 用户和相关组
这极大的简化了系统主机配置阶段我们要做的工作内容。
当然我们需要根据实际情况最好要确认/etc/sysctl.conf /etc/security/limits.conf内容合理性。

1. 安装oracle依赖包

yum install oracle-validated

[root@oradb28 yum.repos.d]# yum install oracle-validated
Loaded plugins: rhnplugin, security
This system is not registered with ULN.
ULN support will be disabled.
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package oracle-validated.x86_64 0:1.1.0-14.el5 set to be updated
ISO/filelists                                                                                                                                                                               | 3.1 MB     00:00     
--> Processing Dependency: gdb for package: oracle-validated
--> Processing Dependency: sysstat for package: oracle-validated
--> Processing Dependency: /usr/lib/libaio.so for package: oracle-validated
--> Processing Dependency: glibc-headers for package: oracle-validated
--> Processing Dependency: unixODBC-devel for package: oracle-validated
--> Processing Dependency: /usr/lib64/libodbccr.so for package: oracle-validated
--> Processing Dependency: gcc-c++ for package: oracle-validated
--> Processing Dependency: libaio-devel for package: oracle-validated
--> Processing Dependency: gcc for package: oracle-validated
--> Processing Dependency: elfutils-libelf-devel for package: oracle-validated
--> Processing Dependency: compat-gcc-34-c++ for package: oracle-validated
--> Processing Dependency: /usr/lib/gcc/x86_64-redhat-linux/4.1.1/libstdc++.a for package: oracle-validated
--> Processing Dependency: /usr/lib/libodbc.so.1 for package: oracle-validated
--> Processing Dependency: compat-gcc-34 for package: oracle-validated
--> Processing Dependency: /usr/lib/libc.so for package: oracle-validated
--> Processing Dependency: /usr/lib64/libaio.so for package: oracle-validated
--> Processing Dependency: /usr/lib64/libc.so for package: oracle-validated
--> Processing Dependency: /usr/lib/libodbccr.so for package: oracle-validated
--> Processing Dependency: kernel-headers for package: oracle-validated
--> Processing Dependency: libXp.so.6 for package: oracle-validated
--> Processing Dependency: libdb-4.2.so()(64bit) for package: oracle-validated
--> Processing Dependency: libodbc.so.1()(64bit) for package: oracle-validated
--> Running transaction check
---> Package compat-db.x86_64 0:4.2.52-5.1 set to be updated
---> Package compat-gcc-34.x86_64 0:3.4.6-4.1 set to be updated
---> Package compat-gcc-34-c++.x86_64 0:3.4.6-4.1 set to be updated
---> Package elfutils-libelf-devel.x86_64 0:0.137-3.el5 set to be updated
--> Processing Dependency: elfutils-libelf-devel-static-x86_64 = 0.137-3.el5 for package: elfutils-libelf-devel
---> Package gcc.x86_64 0:4.1.2-51.el5 set to be updated
---> Package gcc-c++.x86_64 0:4.1.2-51.el5 set to be updated
---> Package gdb.x86_64 0:7.0.1-37.el5 set to be updated
---> Package glibc-devel.i386 0:2.5-65 set to be updated
---> Package glibc-devel.x86_64 0:2.5-65 set to be updated
---> Package glibc-headers.x86_64 0:2.5-65 set to be updated
---> Package kernel-uek-headers.x86_64 0:2.6.32-200.13.1.el5uek set to be updated
---> Package libXp.i386 0:1.0.0-8.1.el5 set to be updated
---> Package libaio-devel.i386 0:0.3.106-5 set to be updated
---> Package libaio-devel.x86_64 0:0.3.106-5 set to be updated
---> Package libstdc++-devel.x86_64 0:4.1.2-51.el5 set to be updated
---> Package sysstat.x86_64 0:7.0.2-11.el5 set to be updated
---> Package unixODBC.i386 0:2.2.11-7.1 set to be updated
---> Package unixODBC.x86_64 0:2.2.11-7.1 set to be updated
---> Package unixODBC-devel.i386 0:2.2.11-7.1 set to be updated
---> Package unixODBC-devel.x86_64 0:2.2.11-7.1 set to be updated
--> Running transaction check
---> Package elfutils-libelf-devel-static.x86_64 0:0.137-3.el5 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

===================================================================================================================================================================================================================
 Package                                                         Arch                                      Version                                                    Repository                              Size
===================================================================================================================================================================================================================
Installing:
 oracle-validated                                                x86_64                                    1.1.0-14.el5                                               ISO                                     24 k
Installing for dependencies:
 compat-db                                                       x86_64                                    4.2.52-5.1                                                 ISO                                    1.6 M
 compat-gcc-34                                                   x86_64                                    3.4.6-4.1                                                  ISO                                    4.3 M
 compat-gcc-34-c++                                               x86_64                                    3.4.6-4.1                                                  ISO                                     13 M
 elfutils-libelf-devel                                           x86_64                                    0.137-3.el5                                                ISO                                     24 k
 elfutils-libelf-devel-static                                    x86_64                                    0.137-3.el5                                                ISO                                     64 k
 gcc                                                             x86_64                                    4.1.2-51.el5                                               ISO                                    5.3 M
 gcc-c++                                                         x86_64                                    4.1.2-51.el5                                               ISO                                    3.8 M
 gdb                                                             x86_64                                    7.0.1-37.el5                                               ISO                                    2.4 M
 glibc-devel                                                     i386                                      2.5-65                                                     ISO                                    2.0 M
 glibc-devel                                                     x86_64                                    2.5-65                                                     ISO                                    2.4 M
 glibc-headers                                                   x86_64                                    2.5-65                                                     ISO                                    594 k
 kernel-uek-headers                                              x86_64                                    2.6.32-200.13.1.el5uek                                     ISO                                    724 k
 libXp                                                           i386                                      1.0.0-8.1.el5                                              ISO                                     22 k
 libaio-devel                                                    i386                                      0.3.106-5                                                  ISO                                     12 k
 libaio-devel                                                    x86_64                                    0.3.106-5                                                  ISO                                     11 k
 libstdc++-devel                                                 x86_64                                    4.1.2-51.el5                                               ISO                                    2.8 M
 sysstat                                                         x86_64                                    7.0.2-11.el5                                               ISO                                    187 k
 unixODBC                                                        i386                                      2.2.11-7.1                                                 ISO                                    830 k
 unixODBC                                                        x86_64                                    2.2.11-7.1                                                 ISO                                    835 k
 unixODBC-devel                                                  i386                                      2.2.11-7.1                                                 ISO                                    743 k
 unixODBC-devel                                                  x86_64                                    2.2.11-7.1                                                 ISO                                    799 k

Transaction Summary
===================================================================================================================================================================================================================
Install      22 Package(s)
Upgrade       0 Package(s)

Total download size: 42 M
...这里省略后面安装的输出提示,按提示输入y直接安装即可。

2. /etc/sysctl.conf 增加oracle用户内容

cat /etc/sysctl.conf 确认如下是自动增加的内容:

# For 11g, Oracle-Validated setting for fs.file-max is 6815744
# For 10g, uncomment 'fs.file-max = 327679', and comment 'fs.file-max = 6553600' entry and re-run sysctl -p
# fs.file-max = 327679
fs.file-max = 6815744

# Oracle-Validated setting for kernel.msgmni is 2878
kernel.msgmni = 2878

# Oracle-Validated setting for kernel.msgmax is 8192
kernel.msgmax = 8192

# Oracle-Validated setting for kernel.msgmnb is 65536
kernel.msgmnb = 65536

# Oracle-Validated setting for kernel.sem is '250 32000 100 142'
kernel.sem = 250 32000 100 142

# Oracle-Validated setting for kernel.shmmni is 4096
kernel.shmmni = 4096

# Oracle-Validated setting for kernel.shmall is 1073741824
kernel.shmall = 1073741824

# Oracle-Validated setting for kernel.shmmax is 4398046511104 on x86_64 and 4294967295 on i386 architecture. Refer Note id 567506.1
kernel.shmmax = 4398046511104

# Oracle-Validated setting for kernel.sysrq is 1
kernel.sysrq = 1

# Oracle-Validated setting for net.core.rmem_default is 262144
net.core.rmem_default = 262144

# For 11g, Oracle-Validated setting for net.core.rmem_max is 4194304
# For 10g, uncomment 'net.core.rmem_max = 2097152', comment 'net.core.rmem_max = 4194304' entry and re-run sysctl -p
# net.core.rmem_max = 2097152
net.core.rmem_max = 4194304

# Oracle-Validated setting for net.core.wmem_default is 262144
net.core.wmem_default = 262144

# For 11g, Oracle-Validated setting for net.core.wmem_max is 1048576
# For 10g, uncomment 'net.core.wmem_max = 262144', comment 'net.core.wmem_max = 1048576' entry for this parameter and re-run sysctl -p
# net.core.wmem_max = 262144
net.core.wmem_max = 1048576

# Oracle-Validated setting for fs.aio-max-nr is 3145728
fs.aio-max-nr = 3145728

# For 11g, Oracle-Validated setting for net.ipv4.ip_local_port_range is 9000 65500
# For 10g, uncomment 'net.ipv4.ip_local_port_range = 1024 65000', comment 'net.ipv4.ip_local_port_range = 9000 65500' entry and re-run sysctl -p
# net.ipv4.ip_local_port_range = 1024 65000
net.ipv4.ip_local_port_range = 9000 65500

# Oracle-Validated setting for vm.min_free_kbytes is 51200 to avoid OOM killer
vm.min_free_kbytes = 51200

可以看到每条内核参数都有清晰明了的注释,我这里是安装10g RAC,那么就按照注释说明,将那些For 10g的参数启用即可。

3. /etc/security/limits.conf 增加oracle用户内容

cat /etc/security/limits.conf 确认如下是自动增加的内容:

# Oracle-Validated setting for nofile soft limit is 131072
oracle   soft   nofile    131072

# Oracle-Validated setting for nofile hard limit is 131072
oracle   hard   nofile    131072

# Oracle-Validated setting for nproc soft limit is 131072
oracle   soft   nproc    131072

# Oracle-Validated setting for nproc hard limit is 131072
oracle   hard   nproc    131072

# Oracle-Validated setting for core soft limit is unlimited
oracle   soft   core    unlimited

# Oracle-Validated setting for core hard limit is unlimited
oracle   hard   core    unlimited

# Oracle-Validated setting for memlock soft limit is 50000000
oracle   soft   memlock    50000000

# Oracle-Validated setting for memlock hard limit is 50000000
oracle   hard   memlock    50000000

由于我接下来要安装Oracle10g RAC,只用到一个oracle用户,所以这里不需要修改,如果你装的是11g RAC,则需要手工添加grid用户的资源使用限制条目。

4. 创建Oracle 用户和相关组

查看已经创建了oracle用户,组oinstall和dba

[root@oradb28 cdrom]# id oracle
uid=54321(oracle) gid=54321(oinstall) groups=54321(oinstall),54322(dba) context=root:system_r:unconfined_t:SystemLow-SystemHigh

安装RAC需要确定各节点oracle用户和组的uid,gid保持一致,由于它自动生成的uid和gid的对应数字很大,所以一般都一致。

这样一来,在OEL系统上安装Oracle前的主机配置系列工作将得到简化,我们不必再去过多的考虑需要哪些依赖包和内核参数设置的问题了。