CentOS 5安装oracle 11g R2数据库

联系:手机(+86 13429648788) QQ(107644445)QQ咨询惜分飞

标题:CentOS 5安装oracle 11g R2数据库

作者:惜分飞©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]

1、检查操作系统是否支持对应版本的oracle
Centos相当如对应的Red Hat Enterprise Linux版本
具体请查阅oracle安装文档

2、检查内核,内存,交换区大小,硬盘大小是否符合要求
cat /proc/version(linux核心版本)lsb_release –id(linux版本)
grep MemTotal /proc/meminfo(检查内存)
grep SwapTotal /proc/meminfo(检查交换区)
df -h /tmp(检查tmp空间大小)

3、检查相应的rpm包的情况
rpm –qa | grep pagename(grep是搜索)
主要包有:
binutils-2.17.50.0.6
compat-libstdc++-33-3.2.3
compat-libstdc++-33-3.2.3 (32 bit)
elfutils-libelf-0.125
elfutils-libelf-devel-0.125
gcc-4.1.2
gcc-c++-4.1.2
glibc-2.5-24
glibc-2.5-24 (32 bit)
glibc-common-2.5
glibc-devel-2.5
glibc-devel-2.5 (32 bit)
glibc-headers-2.5
ksh-20060214
libaio-0.3.106
libaio-0.3.106 (32 bit)
libaio-devel-0.3.106
libaio-devel-0.3.106 (32 bit)
libgcc-4.1.2
libgcc-4.1.2 (32 bit)
libstdc++-4.1.2
libstdc++-4.1.2 (32 bit)
libstdc++-devel 4.1.2
make-3.81
numactl-devel-0.9.8.x86_64
sysstat-7.0.2
unixODBC-2.2.11
unixODBC-2.2.11 (32 bit)
unixODBC-devel-2.2.11
unixODBC-devel-2.2.11 (32 bit)
pdksh-5.2.14(官方文档没有给出,但是安装检测时提示需要)

4、安装缺少的rpm包
rpm –ivh pagename(根据提示,如果缺少依赖包,也需要加上去)
yum install pagename(联网时直接安装)

5、添加组和用户
/usr/sbin/groupadd oinstall(添加oinstall组)
/usr/sbin/groupadd -g 502 dba(添加dba组)
/usr/sbin/useradd -u 502 -g oinstall -G dba oracle(添加用户oracle,主组oinstall,辅助组dba)
passwd oracle(修改oracle用户密码)

6、创建文件夹并修改组和用户所属关系和相关权限
mkdir -p /u01/oracle(创建文件u01/oracle)
chown -R oracle:oinstall /u01(使得u01文件夹输入oracle用户和oinstall组)
chmod -R 775 /u01(修改u01文件夹访问权限)—可选(最好执行下)

7、添加/etc/hosts中dns解析信息
12.1.1.8 xifenfei

8、在/etc/security/limits.conf中添加用户限制信息
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle hard stack 10240

9、 添加 /etc/pam.d/login
session required /lib/security/pam_limits.so
session required pam_limits.so

10、修改或者添加/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 = 1048586
net.ipv4.tcp_wmem = 262144 262144 262144
net.ipv4.tcp_rmem = 4194304 4194304 4194304
—/sbin/sysctl –p(重新加载这些参数,不用重启系统)
参数意义解释:
kernel.shmmax 是核心参数中最重要的参数之一,用于定义单个共享内存段的最大值,shmmax 设置应该足够大,能在一个共享内存段下容纳下整个的SGA ,设置的过低可能会导致需要创建多个共享内存段,这样可能导致系统性能的下降。当然Oralce 的建议是希望一个大的共享内存段能容纳整个SGA,这样在任何时候都不会有甚至轻微的性能下降的隐患。Oracle 安装文档建议32Bit Linux系统设置kernel.shmmax 为32Bit操作系统内存最大的限制值,也就是4G 。所以一般来说,1-4G 的物理内存,可以直接设置shmmax 为最大物理内存即可,那么SGA 肯定在一个共享内存段中,32Bit Linux 系统物理内存大于4G 的设置为4G 即可。总之,一般设置shmmax >=SGA(32Bit 系统是否支持到1.7G 以上SGA 需要注意) 。如果是64Bit的 Linux 操作系统,shmmax 设置为大于SGA_MAX_SIZE 即可。
kernel.shmall 参数取的这个值是ORACLE默认的值,kernel.shmall 参数是控制共享内存页数。Linux 共享内存页大小为4KB, 共享内存段的大小= 共享内存页大小*共享内存页数。一个共享内存段的最大大小是16G,需要共享内存页数16GB/4KB=16777216KB/4KB=4194304(页)。如果你的内存不超过8G,那么8GB/4KB=8388608KB/4KB=2097152 (页)。个人认为如果你的内存大小不超过8G,就默认使用2097152大小;如果内存大小为16G,则需要调大kernel.shmall参数至4194304,这时可以将shmmax 参数调整到16G了, 同时增大你的SGA_MAX_SIZE 和SGA_TARGET 为12G左右(您想设置的SGA 最大大小,当然也可以是2G~14G 等,还要协调PGA参数及OS 等其他内存使用,不能设置太满)kernel.shmmni 内核参数是共享内存段的最大数量(注意这个参数不是shmmin,是shmmni, shmmin 表示内存段最小大小)。shmmni 缺省值4096 ,一般肯定是够用了。

11、编辑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
–注意空格,在用户切换时使用su – username,这样才会加载后面的环境变量的配置信息(不要使用su username切换)

12、配置环境变量
在oracle用户下的.bash_profile文件中添加下面信息
ORACLE_HOSTNAME=xifenfei(在/etc/hosts中配置的dns信息)
ORACLE_BASE=/u01
ORACLE_HOME=$ORACLE_BASE/oracle
ORACLE_SID=orcl
PATH=$ORACLE_HOME/bin:$PATH
NLS_LANG=AMERICAN_AMERICA.UTF8(为了防止乱码数据库要是utf8编码,如果数据库选择了gbk的编码,这里则使用ZHS16GBK)
export ORACLE_BASE ORACLE_HOME ORACLE_SID PATH NLS_LANG ORACLE_HOSTNAME

13、在安装过程中为了防止出现如下错误提示
Could not execute auto check for display colors using command /usr/bin/xdpyinfo. Check if the DISPLAY variable is set.安装之前使用root用户执行:xhost local:oracle

14、使用向导安装,根据提示解决出现的问题
15、完成安装并执行提示脚本(全部默认就可以了)

Note:注意检查nobody用户的存在(id nobody)—-一般情况下系统都存在

此条目发表在 Oracle安装升级 分类目录。将固定链接加入收藏夹。

CentOS 5安装oracle 11g R2数据库》有 4 条评论

  1. 惜分飞 说:
    As an authorized user (for example, root), retrieve the file that configures repository locations:
    # cd /etc/yum.repos.d
    # wget http://public-yum.oracle.com/public-yum-el5.repo
    Using a text editor, modify the file, changing the field enabled=0 to enabled=1 to reflect repositories 
    that correspond to the machine's operating system release.
    Here is an excerpt of public-yum-el5.repo with the changed line in boldface.
    
    .
    .
    .
    [ol5_u7_base]
    name=Oracle Linux $releasever - U7 - $basearch - base
    baseurl=http://public-yum.oracle.com/repo/OracleLinux/OL5/7/base/$basearch/
    gpgkey=http://public-yum.oracle.com/RPM-GPG-KEY-oracle-el5
    gpgcheck=1
    enabled=1
    
    [el5_addons]
    name=Enterprise Linux $releasever - $basearch - addons
    baseurl=http://public-yum.oracle.com/repo/EnterpriseLinux/EL5/addons/$basearch/
    gpgkey=http://public-yum.oracle.com/RPM-GPG-KEY-oracle-el5
    gpgcheck=1
    enabled=0
    .
    .
    .
    Because the target system is running Oracle Linux Release 5 Update 7 for x86_64, 
    there is one repository to enable, [ol5_u7_base]. 
    For some distributions that include the Oracle Unbreakable Enterprise Kernel 
    (specifically Oracle Linux 5.5 and 5.6),the repository [el5_addons] is also needed to 
    resolve a dependency for kernel-uek-headers.
    
    Next, install the oracle-validated RPM using the yum install command.
    The output in Listing 1 shows how the installation checks dependencies and 
    then downloads and installs the required packages.
    
    Listing 1: Installing the oracle-validated RPM
    # 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
    --> Processing Dependency: libXp.so.6 for package: oracle-validated
    --> Processing Dependency: gdb for package: oracle-validated
    --> Processing Dependency: /usr/lib/libodbccr.so for package: oracle-validated
    --> Processing Dependency: /usr/lib64/libc.so for package: oracle-validated
    --> Processing Dependency: gcc-c++ for package: oracle-validated
    --> Processing Dependency: gcc for package: oracle-validated
    --> Processing Dependency: /usr/lib64/libodbccr.so for package: oracle-validated
    --> Processing Dependency: unixODBC-devel for package: oracle-validated
    --> Processing Dependency: libaio-devel for package: oracle-validated
    --> Processing Dependency: elfutils-libelf-devel for package: oracle-validated
    --> Processing Dependency: sysstat for package: oracle-validated
    --> Processing Dependency: kernel-headers for package: oracle-validated
    --> Processing Dependency: /usr/lib64/libaio.so for package: oracle-validated
    --> Processing Dependency: glibc-headers for package: oracle-validated
    --> Processing Dependency: /usr/lib/libodbc.so.1 for package: oracle-validated
    --> Processing Dependency: /usr/lib/libaio.so for package: oracle-validated
    --> Processing Dependency: /usr/lib/libc.so for package: oracle-validated
    --> Processing Dependency: compat-gcc-34-c++ for package: oracle-validated
    --> Processing Dependency: compat-gcc-34 for package: oracle-validated
    --> Processing Dependency: /usr/lib/gcc/x86_64-redhat-linux/4.1.1/libstdc++.a 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-headers.x86_64 0:2.6.18-274.el5 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       ol5_u7_base    24 k
    Installing for dependencies:
     compat-db                      x86_64   4.2.52-5.1         ol5_u7_base   1.6 M
     compat-gcc-34                  x86_64   3.4.6-4.1          ol5_u7_base   4.3 M
     compat-gcc-34-c++              x86_64   3.4.6-4.1          ol5_u7_base    13 M
     elfutils-libelf-devel          x86_64   0.137-3.el5        ol5_u7_base    24 k
     elfutils-libelf-devel-static   x86_64   0.137-3.el5        ol5_u7_base    64 k
     gcc                            x86_64   4.1.2-51.el5       ol5_u7_base   5.3 M
     gcc-c++                        x86_64   4.1.2-51.el5       ol5_u7_base   3.8 M
     gdb                            x86_64   7.0.1-37.el5       ol5_u7_base   2.4 M
     glibc-devel                    i386     2.5-65             ol5_u7_base   2.0 M
     glibc-devel                    x86_64   2.5-65             ol5_u7_base   2.4 M
     glibc-headers                  x86_64   2.5-65             ol5_u7_base   594 k
     kernel-headers                 x86_64   2.6.18-274.el5     ol5_u7_base   1.3 M
     libXp                          i386     1.0.0-8.1.el5      ol5_u7_base    22 k
     libaio-devel                   i386     0.3.106-5          ol5_u7_base    12 k
     libaio-devel                   x86_64   0.3.106-5          ol5_u7_base    11 k
     libstdc++-devel                x86_64   4.1.2-51.el5       ol5_u7_base   2.8 M
     sysstat                        x86_64   7.0.2-11.el5       ol5_u7_base   187 k
     unixODBC                       i386     2.2.11-7.1         ol5_u7_base   830 k
     unixODBC                       x86_64   2.2.11-7.1         ol5_u7_base   835 k
     unixODBC-devel                 i386     2.2.11-7.1         ol5_u7_base   743 k
     unixODBC-devel                 x86_64   2.2.11-7.1         ol5_u7_base   799 k
    
    Transaction Summary
    ================================================================================
    Install      22 Package(s)
    Upgrade       0 Package(s)
    
    Total size: 42 M
    Total download size: 594 k
    Is this ok [y/N]: y
    Downloading Packages:
    glibc-headers-2.5-65.x86_64.rpm                          | 594 kB     00:00     
    warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID 1e5e0159
    ol5_u7_base/gpgkey                                       | 1.4 kB     00:00     
    Importing GPG key 0x1E5E0159 "Oracle OSS group (Open Source Software group) 
    <build@oss.oracle.com>" from http://public-yum.oracle.com/RPM-GPG-KEY-oracle-el5
    Is this ok [y/N]: y
    Running rpm_check_debug
    Running Transaction Test
    Finished Transaction Test
    Transaction Test Succeeded
    Running Transaction
      Installing     : unixODBC                                                1/22 
      Installing     : libstdc++-devel                                         2/22 
      Installing     : kernel-headers                                          3/22 
      Installing     : gdb                                                     4/22 
      Installing     : compat-db                                               5/22 
      Installing     : sysstat                                                 6/22 
      Installing     : glibc-headers                                           7/22 
      Installing     : glibc-devel                                             8/22 
      Installing     : compat-gcc-34                                           9/22 
      Installing     : glibc-devel                                            10/22 
      Installing     : unixODBC-devel                                         11/22 
      Installing     : libaio-devel                                           12/22 
      Installing     : libaio-devel                                           13/22 
      Installing     : unixODBC                                               14/22 
      Installing     : libXp                                                  15/22 
      Installing     : gcc                                                    16/22 
      Installing     : gcc-c++                                                17/22 
      Installing     : compat-gcc-34-c++                                      18/22 
      Installing     : unixODBC-devel                                         19/22 
      Installing     : elfutils-libelf-devel                                  20/22 
      Installing     : oracle-validated                                       21/22 
      Installing     : elfutils-libelf-devel-static                           22/22 
    
    Installed:
      oracle-validated.x86_64 0:1.1.0-14.el5                                               
    
    Dependency Installed:
      compat-db.x86_64 0:4.2.52-5.1                                                        
      compat-gcc-34.x86_64 0:3.4.6-4.1                                                     
      compat-gcc-34-c++.x86_64 0:3.4.6-4.1                                                 
      elfutils-libelf-devel.x86_64 0:0.137-3.el5                                           
      elfutils-libelf-devel-static.x86_64 0:0.137-3.el5                                    
      gcc.x86_64 0:4.1.2-51.el5                                                            
      gcc-c++.x86_64 0:4.1.2-51.el5                                                        
      gdb.x86_64 0:7.0.1-37.el5                                                            
      glibc-devel.i386 0:2.5-65                                                            
      glibc-devel.x86_64 0:2.5-65                                                          
      glibc-headers.x86_64 0:2.5-65                                                        
      kernel-headers.x86_64 0:2.6.18-274.el5                                               
      libXp.i386 0:1.0.0-8.1.el5                                                           
      libaio-devel.i386 0:0.3.106-5                                                        
      libaio-devel.x86_64 0:0.3.106-5                                                      
      libstdc++-devel.x86_64 0:4.1.2-51.el5                                                
      sysstat.x86_64 0:7.0.2-11.el5                                                        
      unixODBC.i386 0:2.2.11-7.1                                                           
      unixODBC.x86_64 0:2.2.11-7.1                                                         
      unixODBC-devel.i386 0:2.2.11-7.1                                                     
      unixODBC-devel.x86_64 0:2.2.11-7.1                                                   
    
    Complete!
    The yum installation logs messages about kernel changes in the file 
    /var/log/oracle-validated/results/orakernel.log,and it makes backups of 
    current system settings in the directory /var/log/oracle-validated/backup.
    

      [引用]  [回复]

  2. 惜分飞 说:

    使用Oracle-Validated安装时,需要完善
    vi /etc/pam.d/login

    session    required     pam_limits.so
    

    vi /etc/profile file

    if [ $USER = "oracle" ]; then
            if [ $SHELL = "/bin/ksh" ]; then
                  ulimit -p 16384
                  ulimit -n 65536
            else
                  ulimit -u 16384 -n 65536
            fi
    fi

      [引用]  [回复]

  3. 惜 分飞 说:
    [oracle@rh2 ~]$ cat  /etc/sysctl.conf
    # Kernel sysctl configuration file for Oracle Enterprise Linux
    #
    # For binary values, 0 is disabled, 1 is enabled.  See sysctl(8) and
    # sysctl.conf(5) for more details.
    
    # Controls IP packet forwarding
    net.ipv4.ip_forward = 0
    
    # Controls source route verification
    net.ipv4.conf.default.rp_filter = 1
    
    # Do not accept source routing
    net.ipv4.conf.default.accept_source_route = 0
    
    # Controls the System Request debugging functionality of the kernel
    
    # Controls whether core dumps will append the PID to the core filename
    # Useful for debugging multi-threaded applications
    kernel.core_uses_pid = 1
    
    # Controls the use of TCP syncookies
    net.ipv4.tcp_syncookies = 1
    
    # Controls the maximum size of a message, in bytes
    
    # Controls the default maxmimum size of a mesage queue
    
    # Controls the maximum shared segment size, in bytes
    
    # Controls the maximum number of shared memory segments, in pages
    
    # 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
    
    ---/etc/security/limits.conf
    [oracle@rh2 ~]$ 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
    

      [引用]  [回复]

  4. 惜 分飞 说:

    getconf PAGE_SIZE查看页大小
    kernel.shmall = kernel.shmmax/PAGE_SIZE

      [引用]  [回复]

发表评论

电子邮件地址不会被公开。 必填项已用 * 标注

您可以使用这些 HTML 标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>