zoukankan      html  css  js  c++  java
  • test

                    Cenos 6.8 安装oracle-11g文档

    一、 安装环境:

    1.系统:Cenos 6.8 Linux tech-dev2 2.6.32-642.el6.x86_64 

    2.Oracle版本:linux.x64_11gR2_database_1of2

                    linux.x64_11gR2_database_2of2

    二、 前期准备:

    1.Install some packages first

    [root@tech-dev2 /]# yum -y install binutils compat-libstdc++-33 compat-libstdc++-33.i686 ksh elfutils-libelf elfutils-libelf-devel glibc glibc-common glibc-devel gcc gcc-c++ libaio libaio.i686 libaio-devel libaio-devel.i686 libgcc libstdc++ libstdc++.i686 libstdc++-devel libstdc++-devel.i686 make sysstat unixODBC unixODBC-devel compat-libstdc++-33-3.2.3-69.el6.x86_64

    2. Edit Kernel parameters

       [root@tech-dev2 /]#vi /etc/sysctl.conf

    # comment out

    #net.bridge.bridge-nf-call-ip6tables = 0

    #net.bridge.bridge-nf-call-iptables = 0

    #net.bridge.bridge-nf-call-arptables = 0

    # add follows to the end

    net.ipv4.ip_local_port_range = 9000 65500
    fs.file-max = 6815744
    kernel.shmall = 10523004
    kernel.shmmax = 6465333657
    kernel.shmmni = 4096
    kernel.sem = 250 32000 100 128
    net.core.rmem_default=262144
    net.core.wmem_default=262144
    net.core.rmem_max=4194304
    net.core.wmem_max=1048576
    fs.aio-max-nr = 1048576

    [root@tech-dev2 /]# /sbin/sysctl -p

    net.ipv4.ip_forward = 0
    net.ipv4.conf.default.rp_filter = 1
    net.ipv4.conf.default.accept_source_route = 0
    kernel.sysrq = 0
    kernel.core_uses_pid = 1
    net.ipv4.tcp_syncookies = 1
    net.ipv4.ip_local_port_range = 9000 65500
    fs.file-max = 65536
    kernel.shmall = 10523004
    kernel.shmmax = 6465333657
    kernel.shmmni = 4096
    kernel.sem = 250 32000 100 128
    net.core.rmem_default = 262144
    net.core.wmem_default = 262144
    net.core.rmem_max = 4194304
    net.core.wmem_max = 1048576
    fs.aio-max-nr = 1048576

     3. Create user and groups for Oracle Database

       [root@tech-dev2 /]# groupadd -g 200 oinstall

    [root@tech-dev2 /]# groupadd -g 201 dba

    /home/oraclehome 不可提前创建


    [root@tech-dev2 /]# useradd -u 440 -g oinstall -G dba -d /home/oraclehome oracle

    4. [root@tech-dev2 /]# passwd oracle
    Changing password for user oracle.
    New password:
    Retype new password:
    passwd: all authentication tokens updated successfully.

     5.[root@tech-dev2 /]#vi /etc/pam.d/login

    # near line 14: add

    session    required     pam_selinux.so open

    session    required     pam_namespace.so

    session    required     pam_limits.so

    session    optional     pam_keyinit.so force revoke

    session    include      system-auth

    session   optional     pam_ck_connector.so

    6. [root@tech-dev2 /]# vi /etc/security/limits.conf

    # add follows to the end

    oracle   soft   nproc   2047
    oracle   hard   nproc   16384

    oracle   soft   nofile   1024
    oracle   hard   nofile   65536

    7. [root@tech-dev2 /]# vi /etc/profile

    # add follows to the end

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

    8.Switch to a user "Oracle" and configure some settings.

    退出root用户登录Oracle用户退出root用户登录Oracle用户

    tech-dev2 login:

    oracle

    Password:
    [oracle@tech-dev2]$ chmod 755 /home/oraclehome
    [oracle@tech-dev2]$mkdir /home/oraclehome/app 
    [oracle@tech-dev2]$chmod 775 /home/oraclehome/app 
    [oracle@tech-dev2]$mkdir /home/oraclehome/oradata 
    [oracle@tech-dev2]$chmod 775 /home/oraclehome/oradata 

    9. [oracle@tech-dev2]$ vi ~/.bash_profile

    # add follows to the end

    umask 022
    export ORACLE_BASE=/home/oraclehome/app

    export LANG=en_US.UTF-8

    source .bash_profile

    # create a temporary directory for installation


    [oracle@tech-dev2]$mkdir tmp 

    Install Oracle Database 11g R2.


    [oracle@tech-dev2]$ cd tmp


    [oracle@tech-dev2]$ unzip linux.x64_11gR2_database_1of2.zip

    [oracle@tech-dev2]$ unzip linux.x64_11gR2_database_2of2.zip


    [oracle@tech-dev2]$./database/runInstaller

    三、 图形化设置:

    1. security issues and so on
    2. On this example, Select "Install database software only".
    3. On this example, Select "Single Instance Database
    4. Select your language. 
    5. Select which edition you install
    6. Specify the base directory and files for Oracle. On this example, keep default and proceed to next. 

    7.Specify the installed directory. On this example, keep default and proceed to next. 

     

     

    8Specify the priviledged group. On this example, keep default and proceed to next.

       

    9. like follows, but it's noplobmen because most of them are higher version packages than requirements. Ignore them if the result is the same to the follows. (For only "pdksh", it's not a big ploblem if it is not installed. )

     

    10. The summary is shown for configuration. Click "Finish" if it's OK all. 

    11. Installation starts.

     

    12.

    Following screen is shown, then open a terminal and execute follwong commands with the root user. 

    [root@tech-dev2 /]# /home/oraclehome/oraInventory/orainstRoot.sh

    Changing permissions of /home/oraclehome/oraInventory.

    Adding read,write permissions for group.

    Removing read,write,execute permissions for world.

    Changing groupname of /home/oraclehome/oraInventory to oinstall.

    The execution of the script is complete.

    [root@tech-dev2 /]#/home/oraclehome/app/product/11.2.0/dbhome_1/root.sh

    Running Oracle 11g root.sh script...

    The following environment variables are set as:
        ORACLE_OWNER= oracle

        ORACLE_HOME= /home/oraclehome/app/product/11.2.0/dbhome_1

    Enter the full pathname of the local bin directory: [/usr/local/bin]:   

    # Enter


        Copying dbhome to /usr/local/bin ...
        Copying oraenv to /usr/local/bin ...

        Copying coraenv to /usr/local/bin ...

    Creating /etc/oratab file...
    Entries will be added to the /etc/oratab file as needed by
    Database Configuration Assistant when a database is created
    Finished running generic part of root.sh script.
    Now product-specific root actions will be performed.
    Finished product-specific root actions.

     

    13. Installation completed. Click "Close" button.

    14. Configure some settings for Oracle user.

             [oracle@tech-dev2]$vi ~/.bash_profile

    # add follows to the end

    export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
    export PATH=$PATH:$ORACLE_HOME/bin

    [oracle@tech-dev2]$$

    source ~/.bash_profile


    [oracle@tech-dev2]$rm -rf tmp 

    Create Oracle Net Listener that is a network service on Oracle.

    [1]Login with the "oracle" user and input a command "netca"        like follows.

    [oracle@tech-dev2]$netca

    15. Check a box "Listener Configuration" and go next. 

    16.GO next. 

    17. Set Listner's name. Input any one you like

    18. This example goes next with keeping default "TCP".

    19. Set a port. This example goes next with keeping default. 

    20. If you'd like to create more Listeners, Answer "Yes". This example selects "No".

    21. Configuration completed.

     22. Click "Finish" to quit. After finishing, Confirm the status by "netstat" comand. Then you'll see "tnslsnr" listens 1521 port.

    四、 Create a Database.

    1. Login with the "oracle" user and input a command "dbca" like follows.

    [oracle@tech-dev2]$ dbca

    1. Click "Next" to proceed. 
    2. Select "Create Database" and go next.

     

    1. This example selects "General Purpose ***" and go next. 
    2. Set Grobal Database name and SID like follows. Input any one you like. 
    3. This example goes next with keeping default. 
    4. Set passwords. Please set a password for a user for security. 
    5. This example goes next with keeping default "File System".
    6. Configure recovery settings. If you'd like to change it, Set it.
    7. Configure sample schema and scripts. If you'd like to add them, Set them.
    8. Configure sample schema and scripts. If you'd like to add them, Set them
    9. Configure memory settings. After setting, go to next tab.
    10. Specify max processes.
    11. Set Character setting.
    12. Select a connection mode. If your server does not have many clients, Select Dedicated server mode. If your server has many clients, Select Shared server mode.
    13. Confirm parameters for Storage settings. If you'd like to change, set them.
    14. Configuration completed. Click "Finish" button to finish.
    15. Confirm settings and Click "OK" if all are OK.
    16. Database creation starts.
    17. After completing to create a database, Click "Exit" to finish.
    18. Access to the URL that is shown on finished screen above with web browser, then follwing screen is shown. Input a user name and password that you configured on the section [6].
    19. Just logined. It's possible to manage the database on here.

    Create an init Script to make Oracle start automatically on system booting.

    [1] Set environment variables for "oracle" user like follows.

    [oracle@tech-dev2]$vi /etc/oratab

    # end line: change

     

    db01:/home/oraclehome/app/product/11.2.0/dbhome_1:

    Y

    [oracle@tech-dev2]$vi ~/.bash_profile

    # add follows to the end

     

    export ORACLE_SID=db01

    [2] Create an init Script with the root user.

    [root@tech-dev2 /]#vi /etc/rc.d/init.d/oracle

    # it's an example, edit it you like.

     

    #!/bin/bash

     

    # oracle: Start/Stop Oracle Database 11g R2

    #

    # chkconfig: 345 90 10

    # description: The Oracle Database is an Object-Relational Database Management System.

    #

    # processname: oracle

     

    . /etc/rc.d/init.d/functions

     

    LOCKFILE=/var/lock/subsys/oracle

    ORACLE_HOME=/usr/oracle/app/product/11.2.0/dbhome_1

    ORACLE_USER=oracle

     

    case "$1" in

    'start')

        if [ -f $LOCKFILE ]; then

            echo $0 already running.

            exit 1

        fi

        echo -n $"Starting Oracle Database:"

        su - $ORACLE_USER -c "$ORACLE_HOME/bin/lsnrctl start"

        su - $ORACLE_USER -c "$ORACLE_HOME/bin/dbstart $ORACLE_HOME"

        su - $ORACLE_USER -c "$ORACLE_HOME/bin/emctl start dbconsole"

        touch $LOCKFILE

        ;;

    'stop')

        if [ ! -f $LOCKFILE ]; then

            echo $0 already stopping.

            exit 1

        fi

        echo -n $"Stopping Oracle Database:"

        su - $ORACLE_USER -c "$ORACLE_HOME/bin/lsnrctl stop"

        su - $ORACLE_USER -c "$ORACLE_HOME/bin/dbshut"

        su - $ORACLE_USER -c "$ORACLE_HOME/bin/emctl stop dbconsole"

        rm -f $LOCKFILE

        ;;

    'restart')

        $0 stop

        $0 start

        ;;

    'status')

        if [ -f $LOCKFILE ]; then

            echo $0 started.

        else

            echo $0 stopped.

        fi

        ;;

    *)

        echo "Usage: $0 [start|stop|status]"

        exit 1

    esac

     

    exit 0

     

    [root@tech-dev2 /]#chmod 755 /etc/rc.d/init.d/oracle

    [root@tech-dev2 /]#chkconfig --add oracle

    [root@tech-dev2 /]#chkconfig oracle on

     

  • 相关阅读:
    浅析Java中使用AES对称加密步骤解析、SpringBoot如何实现AES加解密(秘钥、偏移量)、Java AES加解密工具类参考示例
    浅析Vue项目如何基于Vuex进行qiankun微前端应用间通信方案实践:子应用无vuex共用主应用store的方案(子应用里如何保证主应用store在子应用的响应式)、子应用有独立store与主应用store分离共存的方案
    浅析CSS中过渡transition学习:animation与transition的区别、过渡的4个属性及简写模式、过渡触发方式、过渡渐变(需绝对值)、如何使用硬件加速、过渡时间函数、过渡结束回调事件
    浅析Nginx配置获取客户端真实IP的proxy_set_header、XRealIP、$remote_addr、XForwardedFor、$proxy_add_x_forwarded_for分别是什么意思
    浅析Svelte介绍了解、如何看待 svelte 这个前端框架、svelte评测结论(存在一个阈值大小优势消失、适用简单应用场景又想要数据驱动方式)
    浅析什么是设计模式(套路)、为什么需要设计模式(最优解决方案)、前端常见设计模式(策略模式、发布订阅模式、装饰器模式、适配器模式、职责链模式、代理模式)
    浅析微前端qiankun的2种应用间通信方式(actions通信及shared通信、各自通信原理及实例代码)
    浅析mysql中查询使用 != 不等于会过滤掉null的情况及其原因分析和解决、IFNULL 函数用法及其使用需要注意的事项
    【Java】finally用法
    【Redis】单线程理解及可能影响性能的操作
  • 原文地址:https://www.cnblogs.com/BINGJJFLY/p/8987271.html
Copyright © 2011-2022 走看看