Oracle专题一之Oracle的安装

10g安装

  1. 配置YUM源(国内阿里的还不错,也可以配置挂载的yum源)

  2. yum install -y binutils compat-db control-center gcc* glibc libXp libstdc++ libstdc++-devel make openmotif sysstat control-center

  3. root用户设置内核参数
    vi /etc/sysctl.conf
    kernel.shmall = 2097152(共享内存,单位是页面数,每个页面数是4K,就是块大小,操作系统ext3的,一个块是4K,设置共享内存8G,官方推荐值,生产中可以自行改大,8GB/4KB=8388608KB /4KB=2097152(页))
    kernel.shmmax = 2147483648 (单个共享内存段的最大尺寸,单位字节,单次提取最多2G,不是数据仓库完全够用2G=210241024*1024(byte))
    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.rmem_max = 262144(读内存最大值)
    net.core.wmem_default = 262144(默认写存大小)
    net.core.wmem_max = 262144(写内存最大值)

  4. 修改Linux版本号
    vi /etc/redhat-release (修改版本号,oracle10g只支持到redhat版本4,如果不修改,检测安装环境会报错)
    Red Hat Enterprise Linux Server release 3 (Tikanga))

  5. 使内核生效
    vi /etc/security/limits.conf

        oracle          soft    nproc           2047
        oracle          hard    nproc           16384
        oracle          soft    nofile          1024
        oracle          hard    nofile          65536
    
        #core - 限制内核文件的大小
    

#date - 最大数据大小
   #fsize - 最大文件大小
   #memlock - 最大锁定内存地址空间
   #nofile - 打开文件的最大数目
   #rss - 最大持久设置大小
   #stack - 最大栈大小
   #cpu - 以分钟为单位的最多 CPU 时间
   #noproc - 进程的最大数目
   #as - 地址空间限制
   #maxlogins - 此用户允许登录的最大数目)
```

    /sbin/sysctl –p
    vi /etc/pam.d/login
    在下面添加以下信息
    session    required     /lib/security/pam_limits.so
  1. 用户环境变量
    groupadd oinstall
    groupadd dba
    useradd -g oinstall -G dba oracle
    passwd oracle
    su -l oracle
    vi .bash_profile
    stty erase ^H //删除键
    ORACLE_BASE=/oracle/app
    ORACLE_HOME=$ORACLE_BASE/oracle/product/10.2.0/db_1 //家目录
    ORACLE_SID=ecom //实例名(与Oracle实例名相同)
    PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
    LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
    NLS_LANG=AMERICAN_AMERICA.ZHS16GBK //字符集
    export ORACLE_BASE ORACLE_HOME ORACLE_SID PATH LD_LIBRARY_PATH NLS_LANG
    source .bash_profile

  2. 开始安装
    mkdir -p /oracle/app
    chmod 777 /oracle
    chown -R oracle:oinstall /oracle
    unzip oracle_database_linux32.zip



    Oracle专题一之Oracle的安装_第1张图片

    Oracle专题一之Oracle的安装_第2张图片

    Oracle专题一之Oracle的安装_第3张图片

    Oracle专题一之Oracle的安装_第4张图片

    Oracle专题一之Oracle的安装_第5张图片

    Oracle专题一之Oracle的安装_第6张图片

    Oracle专题一之Oracle的安装_第7张图片

    Oracle专题一之Oracle的安装_第8张图片

    Oracle专题一之Oracle的安装_第9张图片

    在上面图片出来之后 切换到root下执行以下脚本



    Oracle专题一之Oracle的安装_第10张图片

    按ok 退出
    Oracle专题一之Oracle的安装_第11张图片
  3. 输入dbca 进入安装


    Oracle专题一之Oracle的安装_第12张图片

    Oracle专题一之Oracle的安装_第13张图片

    Oracle专题一之Oracle的安装_第14张图片

    Oracle专题一之Oracle的安装_第15张图片

    Oracle专题一之Oracle的安装_第16张图片

    Oracle专题一之Oracle的安装_第17张图片

    Oracle专题一之Oracle的安装_第18张图片

    Oracle专题一之Oracle的安装_第19张图片

    Oracle专题一之Oracle的安装_第20张图片

    Oracle专题一之Oracle的安装_第21张图片

    Oracle专题一之Oracle的安装_第22张图片

    Oracle专题一之Oracle的安装_第23张图片

    Oracle专题一之Oracle的安装_第24张图片

    Oracle专题一之Oracle的安装_第25张图片

    Oracle专题一之Oracle的安装_第26张图片

    Oracle专题一之Oracle的安装_第27张图片

    Oracle专题一之Oracle的安装_第28张图片

    Oracle专题一之Oracle的安装_第29张图片

    Oracle专题一之Oracle的安装_第30张图片

11g脚本安装

  • prepare.sh
#!/bin/sh

cat <  /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=DB88
EOF

hostname DB88

cat <  /etc/hosts
127.0.0.1    localhost localhost.localdomain localhost4 localhost4.localdomain4
::1          localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.8.88  DB88
EOF

`sed -i 's/ONBOOT=no/ONBOOT=yes/g' /etc/sysconfig/network-scripts/ifcfg-eth0`

service iptables stop 
 
setenforce 0 

`sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config`

yum -y install  binutils-* \
compat-libstdc++-* \
compat-libcap1-* \
elfutils-libelf-* \
elfutils-libelf-devel-* \
gcc* \
gcc-c++-* \
glibc* \
glibc-common-* \
glibc-devel-* \
glibc-headers-* \
ksh-* \
libaio-* \
libaio-devel-* \
libgcc-* \
libstdc++-* \
libstdc++-devel* \
make-* \
sysstat-* \
unixODBC-* \
unixODBC-devel-* \
numactl-devel-* \
pdksh-* \
kernel-headers* \
wget

groupadd oinstall   

groupadd dba

useradd -g oinstall -G dba oracle

echo "oracle" | passwd --stdin oracle

echo "umask 022" >>/home/oracle/.bash_profile 
echo "stty erase ^H" >>/home/oracle/.bash_profile 
echo "PATH=\$PATH:\$HOME/bin" >>/home/oracle/.bash_profile 
echo "TMP=/tmp" >>/home/oracle/.bash_profile 
echo "TMPDIR=\$TMP" >>/home/oracle/.bash_profile 
echo "ORACLE_BASE=/home/oracle/app/oracle" >>/home/oracle/.bash_profile 
echo "ORACLE_HOME=\$ORACLE_BASE/product/11.2.0/db_1" >>/home/oracle/.bash_profile 
echo "ORACLE_SID=ecom" >>/home/oracle/.bash_profile           
echo "ORACLE_TERM=xterm" >>/home/oracle/.bash_profile 
echo "PATH=\$PATH:\$HOME/bin:\$ORACLE_HOME/bin" >>/home/oracle/.bash_profile 
echo "LD_LIBRARY_PATH=\$ORACLE_HOME/lib:/lib:/usr/lib" >>/home/oracle/.bash_profile 
echo "CLASSPATH=\$ORACLE_HOME/JRE:\$ORACLE_HOME/jlib:\$ORACLE_HOME/rdbms/jlib" >>/home/oracle/.bash_profile 
echo 'NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS"'>>/home/oracle/.bash_profile 
echo "NLS_LANG=AMERICAN_AMERICA.ZHS16GBK" >>/home/oracle/.bash_profile 
echo "export EDITOR=vi" >>/home/oracle/.bash_profile 
echo "export TMP TMPDIR ORACLE_TERM CLASSPATH NLS_DATE_FORMAT ORACLE_BASE ORACLE_HOME ORACLE_SID PATH LD_LIBRARY_PATH NLS_LANG EDITOR" >>/home/oracle/.bash_profile 

mkdir -p /home/oracle/app/oracle

chmod -R 777 /home/oracle/app/oracle

chown -R oracle:oinstall /home/oracle
 
cd /tmp

unzip linux.x64_11gR2_database_1of2.zip    

unzip linux.x64_11gR2_database_2of2.zip     
rm -rf linux.x64_11gR2_database_1of2.zip  linux.x64_11gR2_database_2of2.zip 

chmod -R 777 /tmp/database

chown -R oracle.oinstall /tmp/database

  • prelimits.sh
#!/bin/bash
#Purpose:Change the /etc/security/limits.conf.
#Usage:Log on as the superuser('root'),and then execute the command:#./prelimits.sh
#Author:TJ

echo "Now modify the /etc/security/limits.conf,but backup it named /etc/security/limits.conf.bak before"
cp /etc/security/limits.conf /etc/security/limits.conf.bak
echo "oracle soft nproc 2047" >>/etc/security/limits.conf
echo "oracle hard nproc 16384" >>/etc/security/limits.conf
echo "oracle soft nofile 1024" >>/etc/security/limits.conf
echo "oracle hard nofile 65536" >>/etc/security/limits.conf
echo "grid soft nproc 2047" >>/etc/security/limits.conf
echo "grid hard nproc 16384" >>/etc/security/limits.conf
echo "grid soft nofile 1024" >>/etc/security/limits.conf
echo "grid hard nofile 65536" >>/etc/security/limits.conf
echo "Modifing the /etc/security/limits.conf has been succeed."

  • prelogin.sh
#!/bin/bash
#Purpose:Modify the /etc/pam.d/login.
#Usage:Log on as the superuser('root'),and then execute the command:#./prelimits.sh
#Author:TJ

echo "Now modify the /etc/pam.d/login,but with a backup named /etc/pam.d/login.bak"
cp /etc/pam.d/login /etc/pam.d/login.bak

echo "session required /lib/security/pam_limits.so" >>/etc/pam.d/login
echo "session required pam_limits.so" >>/etc/pam.d/login

echo "Modifing the /etc/pam.d/login has been succeed."
  • preprofile.sh
#!/bin/bash
#Purpose:Modify the /etc/profile.
#Usage:Log on as the superuser('root'),and then execute the command:#./preprofile.sh
#Author:TJ

echo "Now modify the  /etc/profile,but with a backup named  /etc/profile.bak"
cp /etc/profile /etc/profile.bak
echo 'if [ $USER = "oracle" ]||[ $USER = "grid" ]; then' >>  /etc/profile
echo 'if [ $SHELL = "/bin/ksh" ]; then' >> /etc/profile
echo 'ulimit -p 16384' >> /etc/profile
echo 'ulimit -n 65536' >> /etc/profile
echo 'else' >> /etc/profile
echo 'ulimit -u 16384 -n 65536' >> /etc/profile
echo 'fi' >> /etc/profile
echo 'fi' >> /etc/profile
echo "Modifing the /etc/profile has been succeed."
  • presysctl.sh
#!/bin/bash
#Purpose:Modify the /etc/sysctl.conf.
#Usage:Log on as the superuser('root'),and then execute the command:#./6presysctl.sh
#Author:TJ

echo "Now modify the /etc/sysctl.conf,but with a backup named /etc/sysctl.bak"
cp /etc/sysctl.conf /etc/sysctl.conf.bak

echo "fs.aio-max-nr = 1048576" >> /etc/sysctl.conf
echo "fs.file-max = 6815744" >> /etc/sysctl.conf
echo "kernel.shmall = 2097152" >> /etc/sysctl.conf
echo "kernel.shmmax = 1054472192" >> /etc/sysctl.conf
echo "kernel.shmmni = 4096" >> /etc/sysctl.conf
echo "kernel.sem = 250 32000 100 128" >> /etc/sysctl.conf
echo "net.ipv4.ip_local_port_range = 9000 65500" >> /etc/sysctl.conf
echo "net.core.rmem_default = 262144" >> /etc/sysctl.conf
echo "net.core.rmem_max = 4194304" >> /etc/sysctl.conf
echo "net.core.wmem_default = 262144" >> /etc/sysctl.conf
echo "net.core.wmem_max = 1048586" >> /etc/sysctl.conf
echo "net.ipv4.tcp_wmem = 262144 262144 262144" >> /etc/sysctl.conf
echo "net.ipv4.tcp_rmem = 4194304 4194304 4194304" >> /etc/sysctl.conf

echo "Modifing the /etc/sysctl.conf has been succeed."
echo "Now make the changes take effect....."
/sbin/sysctl -p

你可能感兴趣的:(Oracle专题一之Oracle的安装)