技术源于专注

专注于数据库技术

博客园 首页 新随笔 联系 订阅 管理
Oracle 11g Redhat 5安装
 一、检查硬件是否满足要求

检查一内存 On Linux x86:

  • At least 1 GB of RAM 内存至少1G

    To determine the RAM size, enter the following command:

    # grep MemTotal /proc/meminfo
    

    If the size of the RAM is less than the required size, then you must install more memory before continuing.

  • The following table describes the relationship between installed RAM and the configured swap space recommendation:

    Note:

    On Linux, the HugePages feature allocates non-swappable memory for large page tables using memory-mapped files. If you enable HugePages, then you should deduct the memory allocated to HugePages from the available RAM before calculating swap space.
    RAMSwap Space
    Between 1 GB and 2 GB 1.5 times the size of RAM
    Between 2 GB and 16 GB Equal to the size of RAM
    More than 16 GB 16 GB

On Linux x86-64:(注意用虚拟机安装的时候必须>1G 否则后面安装检测无法通过)

  • At least 4 GB of RAM

    To determine the RAM size, enter the following command:

    # grep MemTotal /proc/meminfo
    

    If the size of the RAM is less than the required size, then you must install more memory before continuing.

  • The following table describes the relationship between installed RAM and the configured swap space recommendation:

    Note:

    On Linux, the HugePages feature allocates non-swappable memory for large page tables using memory-mapped files. If you enable HugePages, then you should deduct the memory allocated to HugePages from the available RAM before calculating swap space.
    RAMSwap Space
    Between 4 GB and 8 GB 2 times the size of RAM
    Between 8 GB and 32 GB 1.5 times the size of RAM
    More than 32 GB 32 GB
检查2 /dev/shm
Automatic Memory Management 内存自动管理
 
Starting with Oracle Database 11g, the Automatic Memory Management feature requires more shared memory (/dev/shm)and file descriptors. The size of the shared memory should be at least the greater of MEMORY_MAX_TARGET and MEMORY_TARGET for each Oracle instance on the computer. If MEMORY_MAX_TARGET or MEMORY_TARGET is set to a non zero value, and an incorrect size is assigned to the shared memory, it will result in an ORA-00845 error at startup. On Linux systems, if the operating system /dev/shm mount size is too small for the Oracle system global area (SGA) and program global area (PGA), even then it will result in an ORA-00845 error.
ORACLE 从11g版本开始,引入了一个自动内存管理(Automatic Memory Management)特性,该特性需要更多的共享内存(/dev/shm),因此如果决定应用该特性的话, 必须要确保共享内存大于ORACLE 中初始化参数MEMORY_MAX_TARGET 和MEMORY_TARGET(特别提示,这两个参数即自动内存管理特性对应的初始化参数)的值。
如果在初始化参数中设置了MEMORY_MAX_TARGET 和MEMORY_TARGET 两参数为非0 值,并且不符合系统共享内存,则ORACLE 数据库启动时,就会触发ORA-00845:MEMORY_TARGET not supported on this system 错误。

The number of file descriptors for each Oracle instance should be at least 512*PROCESSES. Also, the limit of descriptors for each process should be at least 512. If file descriptors are not sized correctly, you will notice ORA-27123 from various Oracle processes and potentially Linux Error EMFILE (Too many open files) errors in non-Oracle processes.

To determine the amount of shared memory available, enter the following command:

什么是/dev/shm

它就是所谓的tmpfs,从名字可以看出是一个临时的文件系统,有人说跟ramdisk(虚拟磁盘),但不一样。使用/dev/shm的好处就是读取数据相当快,因为典型的 tmpfs 文件系统会完全驻留在 RAM 中,读写几乎可以是瞬间的。同时,要注意的是,在/dev/shm中的文件在系统重启后会被清除掉。

tmpfs默认大小一般为物理内存的一半,当然可以修改tmpfs的大小。一般在fstab上可以看到

tmpfs /dev/shm tmpfs defaults 0 0

如果要将tmpfs的大小修改为4G,可以对上面的做适当的修改即可,如:

tmpfs /dev/shm tmpfs defaults,size=4096M 0 0

The workaround, if you encounter the ORA-00845 error, is to increase the /dev/shm mountpoint size. For example:

# mount -t tmpfs shmfs -o size=7g /dev/shm
 
To make this change persistent across system restarts, add an entry in /etc/fstab similar to the following:
下面这种方法需要重启服务器
 
shmfs /dev/shm tmpfs size=7g 0
# df -h /dev/shm/
检查3 /tmp

The following are the disk space requirements for installing Oracle Database 11g Release 2 (11.2):

  • 1 GB of space in the /tmp directory

    To determine the amount of space available in the /tmp directory, enter the following command:

    # df -h /tmp
    

    If the free space available in the /tmp directory is less than what is required, then complete one of the following steps:

    • Delete unnecessary files from the /tmp directory to meet the disk space requirement.

    • Set the TMP and TMPDIR environment variables when setting the oracle user's environment.

      See Also:

      "Configuring the oracle User's Environment" for more information about setting TMP and TMPDIR
    • Extend the file system that contains the /tmp directory. If necessary, contact the system administrator for information about extending file systems.

  • To determine the amount of free disk space on the system, enter the following command:

    # df -h
    
  • The following tables describe the disk space requirements for software files, and data files for each installation type on Linux x86:

    Installation TypeRequirement for Software Files (GB)
    Enterprise Edition 3.95
    Standard Edition 3.88
    Installation TypeDisk Space for Data Files (GB)
    Enterprise Edition 1.7
    Standard Edition 1.5
  • The following tables describe the disk space requirements for software files, and data files for each installation type on Linux x86-64:

    Installation TypeRequirement for Software Files (GB)
    Enterprise Edition 4.35
    Standard Edition 3.73
    Installation TypeDisk Space for Data Files (GB)
    Enterprise Edition 1.68
    Standard Edition 1.48
 
Additional disk space, either on a file system or on an Oracle ASM disk group is required for the fast recovery area if you choose to configure automated backups.
二. 检查以下包是否安装
  The following packages (or later versions) must be installed:
binutils-2.17.50.0.6-12.el5 (s390x)
compat-libstdc++-33-3.2.3-61 (s390)
compat-libstdc++-33-3.2.3-61 (s390x)
gcc-4.1.2-46.el5 (s390x)
gcc-c++-4.1.2-46.el5 (s390x)
glibc-2.5-42(s390)
glibc-2.5-42 (s390x)
glibc-devel-2.5-42 (s390)
glibc-devel-2.5-42 (s390x)
ksh
libaio-0.3.106-3.2 (s390)
libaio-0.3.106-3.2 (s390x)
libaio-devel-0.3.106-3.2 (s390)
libaio-devel-0.3.106-3.2 (s390x)
libgcc-4.1.2-46.el5 (s390)
libgcc-4.1.2-46.el5 (s390x)
libstdc++-4.1.2-46.el5 (s390)
libstdc++-4.1.2-46.el5 (s390x)
libstdc++-devel-4.1.2-46.el5 (s390x)
make-3.81
sysstat-7.0.2-3.el5 (s390x)
unixODBC-2.2.11 (32 bit) or later
unixODBC-devel-2.2.11 (32 bit) or later
推荐使用这种 如果安装机器可接入互联网以下可采用以下方法yum安装(http://public-yum.oracle.com/)
# cd /etc/yum.repos.d
如果yum安装出现key文件不存在
wget https://public-yum.oracle.com/RPM-GPG-KEY-oracle-el5 -O /etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
[root@ORACLETEST1 yum.repos.d]# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
安装以下包(如果机器未接入互联网)
libaio-devel-0.3.106-5.i386.rpm
libaio-devel-0.3.106-5.x86_64.rpm
sysstat-7.0.2-11.el5.x86_64.rpm
unixODBC-devel-2.2.11-10.el5.i386.rpm
unixODBC-devel-2.2.11-10.el5.x86_64.rpm
 
三修改内核参数
编辑内核参数文件文件
内核参数说明
Kernel
Parameter
Setting To Get
You Started
Purpose
aio-max-nr
1048576
The total number of concurrent outstanding I/O requests
shmmni
4096
Maximum number of shared memory segments
shmall
2097152
Maximum total shared memory (4 Kb pages)
shmmax
4294967295
Maximum size of a single shared memory segment. Set to either (4GB -1) or 1/2 the size of physical memory (in bytes) whichever is lower
semmsl
250
Maximum number of semaphores per set
semmns
32000
Maximum number of semaphores
semopm
100
Maximum operations per semop call
semmni
128
Maximum number of semaphore sets
file-max
6815744
Maximum number of open files
ip_local_port_range
9000 - 65500
Range of ports to use for client connections
rmem_default
262144
Default TCP/IP receive window
rmem_max
4194304
Maximum TCP/IP receive window
wmem_default
262144
Maximum TCP/IP send window
wmem_max
1048576
Maximum TCP/IP send window
  
[root@oracle2 ~]# vi /etc/sysctl.conf
 Controls the maximum shared segment size, in bytes
kernel.shmmax = 4294967295
# Controls the maximum number of shared memory segments, in pages
kernel.shmall = 2097152
fs.aio-max-nr = 1048576
fs.file-max = 6815744
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
 
保存配置
[root@oracle2 ~]# /sbin/sysctl -p 
注:修改这些内核参数后需要重启一下服务器
四. 添加帐户和组
[root@oracle2 ~]# groupadd -g 502 dba
[root@oracle2 ~]# groupadd -g 501 oinstall
[root@oracle2 ~]# useradd -c 'Oracle software owner' -d /home/oracle -g oinstall -G dba -m -u 501 -s /bin/bash oracle
[root@oracle2 ~]# passwd oracle
Changing password for user oracle.
New UNIX password:
BAD PASSWORD: it is based on a dictionary word
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
 
五.修改资源文件限制
编辑文件添加以下内容
 [root@oracle2 ~]# vi /etc/security/limits.conf
oracle           soft    nproc   2047
oracle           hard    nproc   16384
oracle           soft    nofile  1024
oracle           hard    nofile  65536
vi /etc/pam.d/login
session    required     pam_selinux.so open
session    required     /lib/security/pam_limits.so
session    required     pam_limits.so
六.创建安装软件所需要的目录
[root@oracle2 ~]# mkdir -p /u01/app /u01/app/oracle /u01/app/oracle/oradata
[root@oracle2 ~]#  chown -R oracle:oinstall /u01/app /u01/app/oracle /u01/app/oracle/oradata
[root@oracle2 ~]# chmod 755 -R /u01/app/oracle/ /u01/app /u01/app/oracle/oradata/
 
七.修改用户配置文件
切换到oracle
su - oracle
vi .bash_profile
PATH=$ORACLE_HOME/bin:$PATH
export PATH
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
ORACLE_SID=ORADB1
export ORACLE_BASE ORACLE_HOME ORACLE_SID
alias home='cd $ORACLE_HOME'
alias base='cd $ORACLE_BASE'
SQLPATH=/u01/app/oracle/product/11.2.0/db_1/sqlplus/admin
 
八.安装oracle 软件
将oracle11g安装软件拷贝到服务器/data目录下
chown -R oracle:oinstall /data
以oracle用户登录
解压安装包
[oracle@oracle2 data]$ unzip linux.x64_11gR2_database_1of2.zip 
[oracle@oracle2 data]$ unzip linux.x64_11gR2_database_2of2.zip 
[oracle@oracle2 database]$ su - root
Password: 
[root@oracle2 ~]# xhost +
access control disabled, clients can connect from any host
[oracle@oracle2 database]$ ./runInstaller 
安装完成以root帐户执行以下脚本
[root@oracle2 ~]# /u01/app/oraInventory/orainstRoot.sh
 
[root@oracle2 ~]#/u01/app/oracle/product/11.2.0/db_1/root.sh
安装过程中如果出现 [ConfigureListener.isPortFree:1088]  Returning is Port 1521 free: false
此类错误将host文件中的hostname(本地计算机名对应IP设置为127.0.0.1)
rman 和sqlplus 环境支持上下键及回退键
安装rlwrap
如果安装rlarwap出现以下错误
You need the GNU readline library(ftp://ftp.gnu.org/gnu/readline/ ) to build
安装readline
yum -y install readline readline-devel
./configure
make
make check
make install
在oracle 用户环境设置以下内容
alias sqlplus='rlwrap sqlplus'
alias rman='rlwrap rman'
 
posted on 2013-09-08 14:50  NETDATA  阅读(2146)  评论(0编辑  收藏  举报