• Linux平台单实例数据库安装


    环境概述:

    1、OS

    [root@oggtarget ~]# uname -a
    Linux oggtarget.localdomain 2.6.39-200.24.1.el6uek.x86_64 #1 SMP Sat Jun 23 02:39:07 EDT 2012 x86_64 x86_64 x86_64 GNU/Linux

    2、DB

    11.2.0.4.0 x86_64 bit 

    操作步骤

    1、上传oracle install packages、并解压

    2、配置/etc/hosts

    127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
    ::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
    
    192.168.1.180   oggtarget.localdomain   oggtarget
    View Code

    3、关闭防火墙

    export LANG=C
    setup

    4、设置共享内存

     参考文章

    5、关闭selinux

    # This file controls the state of SELinux on the system.
    # SELINUX= can take one of these three values:
    #     enforcing - SELinux security policy is enforced.
    #     permissive - SELinux prints warnings instead of enforcing.
    #     disabled - No SELinux policy is loaded.
    SELINUX=disabled
    # SELINUXTYPE= can take one of these two values:
    #     targeted - Targeted processes are protected,
    #     mls - Multi Level Security protection.
    SELINUXTYPE=targeted
    View Code

    6、配置本地YUM源

    参考文章

    7 、执行脚本

    #!/bin/bash
    #Purpose:Create 3 groups named 'oinstall','dba','oper', plus 1 users named 'oracle'.
    #Also setting the Environment
    #variable for oracle user.
    #Usage:Log on as the superuser('root'),and then execute the command:#./1preusers.sh
    #Author:Arcer Zhang
    echo "Now create 3 groups named 'oinstall','dba','oper'"
    echo "Plus 1 users named 'oracle',Also setting the Environment"
    groupadd -g 1100 oinstall
    groupadd -g 1200 dba
    groupadd -g 1300 oper
    useradd -u 1000 -g oinstall -G dba,oper -d /home/oracle -s /bin/bash -c "Oracle Software Owner" oracle
    echo "oracle" | passwd --stdin oracle
    echo 'export PS1="`/bin/hostname -s`-> "' >> /home/oracle/.bash_profile
    echo "export TMP=/tmp" >> /home/oracle/.bash_profile
    echo 'export TMPDIR=$TMP'>>/home/oracle/.bash_profile
    echo "export ORACLE_HOSTNAME=sourcedb.localdomain">> /home/oracle/.bash_profile
    echo "export ORACLE_SID=sourcedb">> /home/oracle/.bash_profile
    echo "export ORACLE_BASE=/u01/app/oracle">> /home/oracle/.bash_profile
    echo 'export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1'>> /home/oracle/.bash_profile
    echo "export ORACLE_UNQNAME=SOURCEDB">> /home/oracle/.bash_profile
    echo 'export TNS_ADMIN=$ORACLE_HOME/network/admin' >> /home/oracle/.bash_profile
    echo "export ORACLE_TERM=xterm">> /home/oracle/.bash_profile
    echo 'export PATH=/usr/sbin:$PATH'>> /home/oracle/.bash_profile
    echo 'export PATH=$ORACLE_HOME/bin:$PATH'>> /home/oracle/.bash_profile
    echo 'export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib'>> /home/oracle/.bash_profile
    echo 'export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib' >> /home/oracle/.bash_profile
    echo "export EDITOR=vi" >> /home/oracle/.bash_profile
    echo "export LANG=en_US" >> /home/oracle/.bash_profile
    echo "export NLS_LANG=american_america.AL32UTF8" >> /home/oracle/.bash_profile
    echo "export NLS_DATE_FORMAT='yyyy/mm/dd hh24:mi:ss'" >> /home/oracle/.bash_profile
    echo "export DISPLAY=192.168.1.180:0.0" >> /home/oracle/.bash_profile
    echo "umask 022">> /home/oracle/.bash_profile
    echo "The Groups and users has been created"
    echo "The Environment for oracle also has been set successfully"
    1_preusers.sh
    #!/bin/bash
    #Purpose:Create the necessary directory for oracle,grid users and change the authention to oracle,grid users.
    #Usage:Log on as the superuser('root'),and then execute the command:#./2predir.sh
    #Author:Arcer Zhang
    echo "Now create the necessary directory for oracle users and change
    the authention to oracle users..."
    mkdir -p /u01/app/oracle
    chown -R oracle:oinstall /u01
    chmod -R 775 /u01
    echo "The necessary directory for oracle,grid users and change the authention to oracle,grid users has been finished"
    2_predir.sh
    #!/bin/bash
    #Purpose:Change the /etc/security/limits.conf.
    #Usage:Log on as the superuser('root'),and then execute the command:#./3prelimits.sh
    #Author:Arcer Zhang
    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 "Modifing the /etc/security/limits.conf has been succeed."
    3_prelimits.sh
    #!/bin/bash
    #Purpose:Modify the /etc/pam.d/login.
    #Usage:Log on as the superuser('root'),and then execute the command:#./4prelimits.sh
    #Author:Arcer Zhang
    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."
    4_prelogin.sh
    #!/bin/bash
    #Purpose:Modify the /etc/profile.
    #Usage:Log on as the superuser('root'),and then execute the command:#./5preprofile.sh
    #Author:Arcer Zhang
    echo "Now modify the /etc/profile,but with a backup named /etc/profile.bak"
    cp /etc/profile /etc/profile.bak
    echo 'if [ $USER = "oracle" ]; 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."
    5_preprofile.sh
    #!/bin/bash
    #Purpose:Modify the /etc/sysctl.conf.
    #Usage:Log on as the superuser('root'),and then execute the command:#./6presysctl.sh
    #Author:Arcer Zhang
    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 = 1054504960" >> /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....."
    sysctl -p
    6_presysctl.sh

    8、starting install oracle 11.2.0.4

     ...

    9、常见问题

    监听无法启动

    sourcedb-> lsnrctl status
    
    LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 06-APR-2015 05:53:10
    
    Copyright (c) 1991, 2013, Oracle.  All rights reserved.
    
    Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
    TNS-12535: TNS:operation timed out
     TNS-12560: TNS:protocol adapter error
      TNS-00505: Operation timed out
    View Code

    参考答案

    EM无法正常启动

    sourcedb-> emctl status dbconsole
    OC4J Configuration issue. /u01/app/oracle/product/11.2.0/db_1/oc4j/j2ee/OC4J_DBConsole_sourcedb.localdomain_sourcedb not found. 
    View Code
    sourcedb-> emctl start dbconsole
    OC4J Configuration issue. /u01/app/oracle/product/11.2.0/db_1/oc4j/j2ee/OC4J_DBConsole_sourcedb.localdomain_sourcedb not found. 
    sourcedb-> emca -config dbcontrol db
    
    STARTED EMCA at Apr 6, 2015 6:09:24 AM
    EM Configuration Assistant, Version 11.2.0.3.0 Production
    Copyright (c) 2003, 2011, Oracle.  All rights reserved.
    
    Enter the following information:
    Database SID: sourcedb
    Listener port number: 1521
    Listener ORACLE_HOME [ /u01/app/oracle/product/11.2.0/db_1 ]: 
    Password for SYS user:  
    Password for DBSNMP user:  
    Password for SYSMAN user:  
    Email address for notifications (optional): 
    Outgoing Mail (SMTP) server for notifications (optional): 
    -----------------------------------------------------------------
    
    You have specified the following settings
    
    Database ORACLE_HOME ................ /u01/app/oracle/product/11.2.0/db_1
    
    Local hostname ................ sourcedb.localdomain
    Listener ORACLE_HOME ................ /u01/app/oracle/product/11.2.0/db_1
    Listener port number ................ 1521
    Database SID ................ sourcedb
    Email address for notifications ............... 
    Outgoing Mail (SMTP) server for notifications ............... 
    
    -----------------------------------------------------------------
    Do you wish to continue? [yes(Y)/no(N)]: y
    Apr 6, 2015 6:09:54 AM oracle.sysman.emcp.EMConfig perform
    INFO: This operation is being logged at /u01/app/oracle/cfgtoollogs/emca/sourcedb/emca_2015_04_06_06_09_23.log.
    Apr 6, 2015 6:10:16 AM oracle.sysman.emcp.EMReposConfig uploadConfigDataToRepository
    INFO: Uploading configuration data to EM repository (this may take a while) ...
    Apr 6, 2015 6:11:13 AM oracle.sysman.emcp.EMReposConfig invoke
    INFO: Uploaded configuration data successfully
    Apr 6, 2015 6:11:14 AM oracle.sysman.emcp.ParamsManager getLocalListener
    WARNING: Error retrieving listener for sourcedb.localdomain
    Apr 6, 2015 6:11:16 AM oracle.sysman.emcp.util.DBControlUtil secureDBConsole
    INFO: Securing Database Control (this may take a while) ...
    Apr 6, 2015 6:12:38 AM oracle.sysman.emcp.util.DBControlUtil secureDBConsole
    INFO: Database Control secured successfully.
    Apr 6, 2015 6:12:38 AM oracle.sysman.emcp.util.DBControlUtil startOMS
    INFO: Starting Database Control (this may take a while) ...
    Apr 6, 2015 6:13:47 AM oracle.sysman.emcp.EMDBPostConfig performConfiguration
    INFO: Database Control started successfully
    Apr 6, 2015 6:13:47 AM oracle.sysman.emcp.EMDBPostConfig performConfiguration
    INFO: >>>>>>>>>>> The Database Control URL is https://sourcedb.localdomain:1158/em <<<<<<<<<<<
    Apr 6, 2015 6:13:49 AM oracle.sysman.emcp.EMDBPostConfig invoke
    WARNING: 
    ************************  WARNING  ************************
    
    Management Repository has been placed in secure mode wherein Enterprise Manager data will be encrypted.  The encryption key has been placed in the file: /u01/app/oracle/product/11.2.0/db_1/sourcedb.localdomain_sourcedb/sysman/config/emkey.ora. Ensure this file is backed up as the encrypted data will become unusable if this file is lost. 
    
    ***********************************************************
    Enterprise Manager configuration completed successfully
    FINISHED EMCA at Apr 6, 2015 6:13:49 AM
    View Code
  • 相关阅读:
    HDOJ 1284 钱币兑换问题
    WA : csu1019 simple line editor
    HDOJ1232 并查集
    最长回文子串
    Where's Waldorf?
    csu 1148 词典
    csu 1011 Counting Pixels
    Product:java高精度乘法
    内置类型开方
    csu 1019 Simple Line Editor
  • 原文地址:https://www.cnblogs.com/arcer/p/4394743.html
Copyright © 2020-2023  润新知