Home | 简体中文 | 繁体中文 | 杂文 | Github | 知乎专栏 | 51CTO学院 | CSDN程序员研修院 | OSChina 博客 | 腾讯云社区 | 阿里云栖社区 | Facebook | Linkedin | Youtube | 打赏(Donations) | About
知乎专栏多维度架构

第 81 章 Installing Oracle Database

目录

81.1. Installing Oracle Database 10g Release 2 on Linux x86
81.2. 11gR2
81.3. Installing Oracle Client 11g
81.4. Silence Install - Database
81.4.1. Response File
81.4.2. OS 配置脚本
81.4.3. 运行 runInstaller
81.5. Silence Install - Client
81.6. oracle 817 script
81.7. Script for automatic startup on boot
81.8. Run level shell script to start Oracle 10g services on RedHat Enterprise Linux (RHAS 4)

81.1. Installing Oracle Database 10g Release 2 on Linux x86

reference: http://www.oracle.com/technology/pub/articles/smiley_10gdb_install.html

To make these changes, cut and paste the following commands as root:

过程 81.1. Configure linux step by step

  1. Verifying Your Installation

    rpm -q binutils compat-db control-center gcc gcc-c++ glibc glibc-common \
    gnome-libs libstdc++ libstdc++-devel make pdksh sysstat xscreensaver libaio openmotif21
    			

    installing package

    yum install compat-gcc-32 compat-gcc-32-c++ compat-gcc-32-g77 compat-libf2c-32 compat-libstdc++-296 compat-libstdc++-33 compat-db compat-readline43
    			
  2. Verifying System Requirements

    grep MemTotal /proc/meminfo
    grep SwapTotal /proc/meminfo
    			

    Swap = mem * 2

  3. Create the Oracle Groups and User Account

    groupadd oinstall
    groupadd dba
    useradd -m -g oinstall -G dba oracle
    passwd oracle
    id oracle
    			
  4. Create Directories

    mkdir -p /u01/app/oracle
    chown -R oracle:oinstall /u01/app/oracle
    chmod -R 775 /u01/app/oracle
    			
  5. Configuring the Linux Kernel Parameters

    			
    cat >> /etc/sysctl.conf <<EOF
    kernel.shmall = 2097152
    kernel.shmmax = 536870912
    kernel.shmmni = 4096
    kernel.sem = 250 32000 100 128
    fs.file-max = 65536
    net.ipv4.ip_local_port_range = 1024 65000
    net.core.rmem_default=262144
    net.core.wmem_default=262144
    net.core.rmem_max=262144
    net.core.wmem_max=262144
    EOF
    /sbin/sysctl -p
    			
    			

    Run the following commands as root to verify your settings:

    /sbin/sysctl -a | grep shm
    /sbin/sysctl -a | grep sem
    /sbin/sysctl -a | grep file-max
    /sbin/sysctl -a | grep ip_local_port_range
    /sbin/sysctl -a | grep rmem_default
    /sbin/sysctl -a | grep rmem_max
    /sbin/sysctl -a | grep wmem_default
    /sbin/sysctl -a | grep wmem_max
    			
  6. Setting Shell Limits for the oracle User

    			
    cat >> /etc/security/limits.conf <<EOF
    oracle soft nproc 2047
    oracle hard nproc 16384
    oracle soft nofile 1024
    oracle hard nofile 65536
    EOF
    			
    			
  7. /etc/profile

    			
    cat >> /etc/profile <<EOF
    if [ \$USER = "oracle" ]; then
     if [ \$SHELL = "/bin/ksh" ]; then
     ulimit -p 16384
     ulimit -n 65536
     else
     ulimit -u 16384 -n 65536
     fi
     umask 022
    fi
    EOF
    
    cat >> /etc/csh.login <<EOF
    if ( \$USER == "oracle" ) then
     limit maxproc 16384
     limit descriptors 65536
     umask 022
    endif
    EOF
    			
    			
  8. .bash_profile

    # su - oracle
    $ vim .bash_profile
    
    export ORACLE_BASE=/u01/app/oracle
    export ORACLE_HOME=$ORACLE_BASE/product/10.2.0.1
    export ORACLE_SID=orcl
    export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
    export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
    			

过程 81.2. Installing Oracle

  1. 编辑 /10201_database_linux32/database/install/oraparam.ini 添加

    vim 10201_database_linux32/database/install/oraparam.ini
    
    ### #[Certified Versions]
    
    Linux=redhat-3,SuSE-9,redhat-4,centos-5,UnitedLinux-1.0,asianux-1,asianux-2
    
    [Linux-centos-5.1-optional]
    TEMP_SPACE=80
    SWAP_SPACE=150
    MIN_DISPLAY_COLORS=256
    			
  2. install

    			
    gunzip xxxx.cpio.gz
    cpio -idmv < xxxx.cpio
    export LANG=en_US
    ./runInstaller
    			
    			
  3. dbstart

    # su - oracle
    # dbstart
    
    提示打开 /ade/vikrkuma_new/oracle/bin/tnslsnr 失败
    			

    编辑 /u01/app/oracle/product/10.2.0.1/bin/dbstart

    # Set this to bring up Oracle Net Listener
    ORACLE_HOME_LISTNER=/ade/vikrkuma_new/oracle
    
    应该是在78行,将其改为:
    
    # Set this to bring up Oracle Net Listener
    ORACLE_HOME_LISTNER=$ORACLE_HOME
    			

    /etc/oratable 将最后一行的最后一个字符由 “N” 改为 “Y”

    orcl: /u01/app/oracle/product/10.2.0.1:Y
    			

过程 81.3. Configuring Storage

  1. Partition the Disks

    fdisk -l /dev/sdb
    			
  2. Filesystems

    ZFS or btrfs

  3. Create the Mount Point

    			
    mkdir /u02
    			
    			

    Add the New Filesystem to /etc/fstab

    			
    /dev/sdb1 /u02 xfs defaults 1 1
    			
    			

    Mount the New Filesystem

    			
    mount /u02
    df -h /u02
    			
    			
  4. Create Oracle Directories and Set Permissions

    			
    mkdir -p /u02/oradata/demo1
    chown -R oracle:oinstall /u02/oradata
    chmod -R 775 /u02/oradata
    			
    			
  5. Create a New Tablespace in the New Filesystem

    			
    Ex:
    $ sqlplus
    
    SQL*Plus: Release 10.2.0.1.0 - Production on Sun Nov 27 15:50:50 2005
    
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    
    Enter user-name: system
    Enter password:
    
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
    With the Partitioning, OLAP and Data Mining options
    
    SQL> create tablespace data1
      2  datafile '/u02/oradata/demo1/data1_01.dbf' size 100m
      3  extent management local
      4  segment space management auto;
    
    Tablespace created.
    
    Now you can use the new tablespace to store database objects such as tables and indexes.
    
    Ex:
    SQL> create table demotab (id number(5) not null primary key,
     2 name varchar2(50) not null,
     3 amount number(9,2))
     4 tablespace data1;
    
    Table created.