• 【实战】静默安装-oracle 11.2.0.3 on centos 5.10


    发现网上静默安装的文章非常多,乱七八糟,五花八门!来个扫盲的!
     
    centos 5.10  下安装oracle 11g_r2
    
    ******************************************************************************
    1.系统部分
    ******************************************************************************
    
    ------1.安装系统
    
    
    --applications
    graphics
    graphical internet
    text-based internet
    offce/productivity
    editors
    sound and video
    
    
    
    --base system
    
    Administration Tools
    base
    legacy software support: compat-libstdc-  compat-db-
    X Window System
    system tools :sysstat-
    
    ---desktop envirements
    gnome desktop environment
    
    
    
    --development默认选项后加入以下选项
    Development Libraries :libstdc-
    development tools :gcc-
    legacy software development 
    
    
    
    --languages
    
    chinese support
    
    ---server
    ftp server
    legacy network server:rsh-server telnet-server
    printing support
    server configure tools
    
    
    ------2.配置xmanager连接linux
    
    ---2.1 centos 6.5 
    
    1).yum install xdm  安装XDM
    
    
    
    2).vi /etc/X11/xdm/Xaccess
    
    49 * #any  host  can  get  a  login  window
    
    
    
    3).改动/etc/gdm/custom.conf文件。
    
    [xdmcp]
    Enable=true
    DisplaysPerHost=5
    Port=177
    
    [security]
    AllowRemoteRoot=true
    
    
    
    
    4).重新启动gpm服务:
    
    service gpm restart
    
    chkconfig  gpm on   确认GPM服务开机启动
    
    
    5).重新启动gdm服务
    
    /usr/sbin/gdm -restart
    
    
    
    ---2.2 centos 5.10
    
    --1.编辑配置文件
    
    
    
    ls -al /usr/share/gdm/defaults.conf
    
    chmod 644 /usr/share/gdm/defaults.conf
    
    vi /usr/share/gdm/defaults.conf 
    
    
    /****
    
    /usr/share/gdm/defaults.conf 和/etc/gdm/custom.conf 内容一致,改动随意一个就可以
    
    ****/
    
    [xdmcp]
    Enable=true
    DisplaysPerHost=5
    Port=177
    
    [security]
    AllowRemoteRoot=true
    
    vi /usr/share/gdm/defaults.conf
    
    214行   AllowRemoteRoot=true
    263行   Enable=true
    279行	DisplaysPerHost=2
    284行	Port=177
    
    
    --2.重新启动gpm服务:
    
    service gpm restart
    
    chkconfig  gpm on   确认GPM服务开机启动
    
    
    --2.重新启动gdm服务
    
    /usr/sbin/gdm-restart
    
    
    
    
    -------1.3 配置yum源
    
    cd /etc/yum.repos.d
    mv CentOS-Base.repo CentOS-Base.repo.old
    
    
    wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
    
    yum makecache
    
    检查可更新的rpm包
    #yum check-update
        
    更新全部的rpm包
    #yum update
    
    
    yum -y groupinstall 'Development Libraries'  
    
    
    
    
    
    
    
    
    
    ******************************************************************************
    2.oracle安装部分
    ******************************************************************************
    
    
    
    
    
    
    1、检查下列包是否安装,若未安装则要先安装:
    
    
    mount /dev/cdrom /mnt
    
    cd /mnt/CentOS
    
    rpm -Uvh binutils-2.*
    rpm -Uvh compat-libstdc++-33*
    rpm -Uvh compat-libstdc++-33*.i386.rpm
    rpm -Uvh elfutils-libelf*
    rpm -Uvh gcc-4.*
    rpm -Uvh gcc-c++-4.*
    rpm -Uvh glibc-2.*
    rpm -Uvh glibc-common-2.*
    rpm -Uvh glibc-devel-2.*
    rpm -Uvh glibc-headers-2.*
    rpm -Uvh ksh*
    rpm -Uvh libaio-0.*
    rpm -Uvh libaio-devel-0.*
    rpm -Uvh libgomp-4.*
    rpm -Uvh libgcc-4.*
    rpm -Uvh libstdc++-4.*
    rpm -Uvh libstdc++-devel-4.*
    rpm -Uvh make-3.*
    rpm -Uvh sysstat-7.*
    rpm -Uvh numactl-devel-*
    rpm -Uvh unixODBC-2.*
    rpm -Uvh unixODBC-devel-2.*
    
    ---使用yum安装unixODBC 
    yum install unixODBC 
    yum install elfutils-libelf-devel
    yum  install pdksh
    
    
    
    
    
    
    
    
    步骤4:配置系统
    [root@ora ~]# grep MemTotal /proc/meminfo
    MemTotal:      4946772 kB
    
    
    [root@ora ~]# grep SwapTotal /proc/meminfo
    SwapTotal:    12289716 kB
    
    
    
    [root@ora ~]# df -h
    Filesystem            Size  Used Avail Use% Mounted on
    /dev/sda2              17G  2.8G   14G  18% /
    /dev/sda1            1012M   40M  921M   5% /boot
    none                  891M     0  891M   0% /dev/shm
    /dev/hdc              192M  192M     0 100% /media/cdrom
    
    
    
    
    
    二、參数改动
    1.设置须要的IP
    
    
    2、改动host文件
    在/etc/hosts文件里加入一个全限定域名,如:
    
    vi /etc/hosts
    
    192.168.5.199	ocpyang.sz.com	ocpyang
    
    3. 查看改动结果
    
    hostname
    
    cat /etc/hosts | grep `eval hostname`
    
    
    
    
    4、设置核心參数
     1、在/etc/sysctl.conf文件里增加下列行:
    #vi /etc/sysctl.conf
    
    
    fs.suid_dumpable = 1
    fs.aio-max-nr = 1048576
    fs.file-max = 6815744
    kernel.shmall = 2097152
    kernel.shmmax = 2532755456 
    kernel.shmmni = 4096
    # semaphores: semmsl, semmns, semopm, semmni
    kernel.sem = 250 32000 100 128
    net.ipv4.ip_local_port_range = 9000 65500
    net.core.rmem_default=4194304
    net.core.rmem_max=4194304
    net.core.wmem_default=262144
    net.core.wmem_max=1048586
    
    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
    kernel.msgmnb = 65536
    
    
    
    
    
    
     5、执行下列命令改变核心參数:
    #/sbin/sysctl -p
    
    
     6、在/etc/security/limits.conf文件里增加下列行:
    
    # vi /etc/security/limits.conf
    
    oracle           soft    nproc   2047
    oracle           hard    nproc   16384
    oracle           soft    nofile  1024
    oracle           hard    nofile  65536
    oracle           hard    stack   10240
    
    
    
    
    7、在/etc/pam.d/login文件里增加下列行:
    
    # vi /etc/pam.d/login
    
    session required pam_limits.so
    
    
    
    
    8.关闭SELINUX的工作模式和防火墙            
    # vi /etc/selinux/config
    # 设置SELINUX为disabled
    SELINUX=disabled
    
    # service iptables stop
    
    
    
    
    
    
    三、创建下列组和用户
    
    groupadd oinstall
    groupadd dba
    groupadd oper
    
    useradd -g oinstall -G dba,oper -d /home/oracle oracle
    passwd oracle
    
    
    四、创建安装oracle的文件夹
    
    mkdir -p /u01
    
    mkdir -p /u01/app/oracle/product/11.2.0/db_1
    
    
    chown -R   oracle.oinstall /u01
    
    chmod -R 775 /u01
    
    
    
    
    说明:/u01/app/oracle/product/11.2.0/db_1文件夹是用于放置程序文件的位置。
    
    
    
    
    五、设置oracle用户的环境变量
    
    用oracle登录在:/home/oracle/.bash_profile文件末尾,注意把当中ORACLE_SID换成自己的实例名:
    
    # vi /home/oracle/.bash_profile
    
    也能够 
    #su - oracle
    
    #vi .bash_profile
    
    添加下列内容:
    
    # Oracle Settings
    TMP=/tmp;
    export TMP
    TMPDIR=$TMP;
    export TMPDIR
    
    ORACLE_BASE=/u01/app/oracle;
    export ORACLE_BASE
    ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1;
    export ORACLE_HOME
    ORACLE_SID=orcl;
    export ORACLE_SID
    ORACLE_TERM=xterm;
    export ORACLE_TERM
    PATH=/usr/sbin:$PATH;
    export PATH
    PATH=$ORACLE_HOME/bin:$PATH;
    export PATH
    export NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS"
    
    
    LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib;
    export LD_LIBRARY_PATH
    CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib;
    export CLASSPATH
    #LD_ASSUME_KERNEL=2.4.1;
    export LD_ASSUME_KERNEL
    
    #set language
    NLS_LANG="SIMPLIFIED CHINESE"_CHINA.AL32UTF8
    export  NLS_LANG
    EDITOR=vi
    export EDITOR
    
    
    
    if [ $USER = "oracle" ]; then
    if [ $SHELL = "/bin/ksh" ]; then
    ulimit -p 16384
    ulimit -n 65536
    else
    ulimit -u 16384 -n 65536
    fi
    fi
    
    
    alias  oratrace="cat   $ORACLE_BASE/diag/rdbms/$ORACLE_SID/$ORACLE_SID/trace/alert_orcl.log"
    alias  oradata="cd $ORACLE_BASE/oradata/$ORACLE_SID"
    alias  oranetwork="cd $ORACLE_HOME/network/admin"
    
    
    
    六、安装
    
    
    $unzip 1.zip
    
    $unzip 2.zip
    
    $cd /soft/
    
    chown  -R oracle:oinstall /soft/database
    
    $ cd database/
    
    cp -R /soft/database/response /home/oracle 
    
    
    ----方法1:
    
    $ ./runInstaller -silent -debug -force 
    FROM_LOCATION=/soft/database/stage/products.xml 
    oracle.install.option=INSTALL_DB_SWONLY 
    ORACLE_HOSTNAME=ocpyang.sz.com 
    UNIX_GROUP_NAME=oinstall 
    INVENTORY_LOCATION=/u01/app/oraInventory 
    SELECTED_LANGUAGES=en,zh_CN 
    ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1 
    ORACLE_BASE=/u01/app/oracle 
    oracle.install.db.InstallEdition=EE 
    oracle.install.db.EEOptionsSelection=false 
    oracle.install.db.DBA_GROUP=dba 
    oracle.install.db.OPER_GROUP=oper 
    oracle.install.db.config.starterdb.type=GENERAL_PURPOSE 
    oracle.install.db.config.starterdb.memoryOption=false 
    oracle.install.db.config.starterdb.installExampleSchemas=false 
    oracle.install.db.config.starterdb.enableSecuritySettings=true 
    oracle.install.db.config.starterdb.control=DB_CONTROL 
    SECURITY_UPDATES_VIA_MYORACLESUPPORT=false 
    DECLINE_SECURITY_UPDATES=true 
    oracle.installer.autoupdates.option=SKIP_UPDATES 
    
    
    
    
    ---方法2:
    
    vi /home/oracle/ocp.rsp
    
    oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0
    oracle.install.option=INSTALL_DB_SWONLY
    ORACLE_HOSTNAME=ocpyang.sz.com
    UNIX_GROUP_NAME=oinstall
    INVENTORY_LOCATION=/u01/app/oraInventory
    SELECTED_LANGUAGES=en,zh_CN
    ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
    ORACLE_BASE=/u01/app/oracle
    oracle.install.db.InstallEdition=EE
    oracle.install.db.EEOptionsSelection=false
    oracle.install.db.DBA_GROUP=dba
    oracle.install.db.OPER_GROUP=oper
    oracle.install.db.config.starterdb.type=GENERAL_PURPOSE
    oracle.install.db.config.starterdb.memoryOption=false
    oracle.install.db.config.starterdb.installExampleSchemas=false
    oracle.install.db.config.starterdb.enableSecuritySettings=true
    oracle.install.db.config.starterdb.control=DB_CONTROL
    SECURITY_UPDATES_VIA_MYORACLESUPPORT=false
    DECLINE_SECURITY_UPDATES=true
    oracle.installer.autoupdates.option=SKIP_UPDATES
    
    
    	
    
    
    ./runInstaller -ignoreSysPrereqs -force -silent -responseFile /home/oracle/response/ocp.rsp
    
    
    
    [oracle@ocp ~]$ su -l root
    Password: 
    
    #/u01/app/oraInventory/orainstRoot.sh 
    
    
    #/u01/app/oracle/product/11.2.0/db_1/root.sh 
    
    
    
    
    七、静默建库和静默配置监听:
    
    ---7.1 静默建库
    
    $ cat /home/oracle/createdb.rsp 
    
    [GENERAL]
    RESPONSEFILE_VERSION = "11.2.0"
    OPERATION_TYPE = "createDatabase"
    [CREATEDATABASE]
    GDBNAME = "orcl"
    SID = "orcl"
    TEMPLATENAME = "General_Purpose.dbc"
    SYSPASSWORD = "password"
    SYSTEMPASSWORD = "password"
    SYSMANPASSWORD = "password"
    DBSNMPPASSWORD = "password"
    DATAFILEDESTINATION ="/u01/app/oracle/oradata"
    STORAGETYPE=FS
    CHARACTERSET = "ZHS16GBK"
    DATABASETYPE = "MULTIPURPOSE"
    AUTOMATICMEMORYMANAGEMENT = "FALSE"
    
    
    $ dbca -silent -responseFile /home/oracle/response/createdb.rsp 
    
    
    ps -ef | grep ora_ | grep -v grep | wc -l
    
    
    ----7.2静默配置监听
    
    
    $ $ORACLE_HOME/bin/netca /silent /responsefile  /home/oracle/response/netca.rsp
    
    $ ll $ORACLE_HOME/network/admin/*.ora
    
    $ lsnrctl status
    运行完后, 监听就已经启
    
    
    
    八、安装后配置
    改动oratab文件,在/etc/oratab文件里加入以下的一行,
    
    vi /etc/oratab
    
    orcl:/u01/app/oracle/product/11.2.0/db_1:Y
    
    
    启动和停止 Oracle Enterprise Manager 数据库控制:
    $ emctl start dbconsole
    $ emctl stop dbconsole
    
    
    启动和停止 iSQL*Plus:
    $ isqlplusctl start
    $ isqlplusctl stop
    
    
    
    启动和停止监听器:
    监听器接受client的连接请求,并在验证证书后创建数据库连接。要使用 OEM 或 iSQL*Plus,必须先启动监听器。
    $ lsnrctl start
    $ lsnrctl stop
    
    $cat /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
    
    
    
    
    
    启动和停止数据库:
    
    
    启动:
    $ sqlplus
    
    SQL> startup
    
    关闭:
    $ sqlplus
    
    
    SQL> shutdown immediate
    
    
    
    
    
    九、设置开机oracle自己主动启动
    
    步骤1:
    
    # vi /etc/oratab
    
    ORCL:/u01/app/oracle/product/10.2.0/db_1:Y
    
    /etc/oratab格式为:SID:ORACLE_HOME:AUTO把AUTO域设置为Y(大写),仅仅有这样,
    oracle 自带的dbstart和dbshut才可以发挥作用
    
    
    步骤2:使用Oracle用户改动$Oracle_HOME/bin/dbstart文件
    
    $vi /u01/app/oracle/product/11.2.0/db_1/bin/dbstart
    
    82行 ORACLE_HOME_LISTNER=$1
    
    改动为
    ORACLE_HOME_LISTNER=$ORACLE_HOME
    
    
    
    步骤3:root新建oracle控制文件
    
    #vi /etc/init.d/oracle11gr2 
    
    内容为oracle11gr2脚本
    
    
    步骤4:让linux服务控制
    
    # chmod 774 /etc/init.d/oracle11gr2 
    
    
    # chkconfig --add oracle11gr2 
    
    这样开机将随机启动。
    同一时候也能够使用命令随时启动:
    
    #service oracle11gr2 start
    
    
    #service oracle11gr2 stop
    
    
    #service oracle11gr2 restart
    
    
    
    
    
    十、配置:(解决侦听失败,见文件)
    安装完毕后,第一次启动是没有问题的,可是,重新启动动计算机后,你必需通过手工或者脚本启动数据库。
    1、手工启动数据库:以oracle用户运行dbstart,这个命令在我安装完毕后,出现错误,我就把这个脚本改动了一下,
    利用文本编辑器打开dbstart,
    把78行的
    
    vi /u01/app/oracle/product/11.2.0/db_1/bin/dbstart 
    
    ORACLE_HOME_LISTNER=/ade/vikrkuma_new/oracle换成你自己的路径。
    ORACLE_HOME_LISTNER=/u01/app/oracle/product/10.2.0/db_1/
    
    关闭数据库用dbshut就能够了。
    假设你须要使用isqlplus管理数据库,就要启动isqlplus,执行命令:isqlplusctl start | stop
    要使用基于web的企业管理器,就要执行命令:emctl start | stop dbconsole
    
    
    
    
    
    -----十二、常见sql全局配置文件
    
    vi   /u01/app/oracle/product/11.2.0/db_1/sqlplus/admin/glogin.sql 
    
    --dba add for oracle
    alter session set nls_date_format='YYYY-MM-DD HH24:MI:SS'; 
    define _editor=vi
    set serveroutput on size 1000000
    set trimspool on
    set long 5000
    set linesize 100
    set pagesize 9999
    column plan_plus_exp format a80
    column global_name new_value gname
    set termout off 
    define gname=idle
    column global_name new_value gname
    select lower(user) || '@' || substr( global_name, 1,
    decode( dot, 0, length(global_name), dot-1) ) global_name
    from (select global_name, instr(global_name,'.') dot from global_name );
    set time on
    set sqlprompt '&gname>'
    
    
    
    
    
    
    ----中文表设置
    
    create table t1
    (
    sid number,
    sname varchar2(20)
    );
    
    insert into t1 values(101,'苏州');
    insert into t1 values(102,'oracle中文測试');

  • 相关阅读:
    python基础-第十二篇-12.1jQuery基础与实例
    python基础-第十一篇-11.2DOM为文档操作
    [LC] 170. Two Sum III
    [Algo] 11. Rainbow Sort
    [LC] 31. Next Permutation
    [LC] 994. Rotting Oranges
    [LC] 863. All Nodes Distance K in Binary Tree
    [Algo] 132. Deep Copy Undirected Graph
    [LC] 138. Deep Copy Linked List With Random Pointer
    [Algo] 118. Array Deduplication IV
  • 原文地址:https://www.cnblogs.com/blfshiye/p/4296172.html
Copyright © 2020-2023  润新知