ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 水煮oracle 20——redhat6下的oracle 11g r2的静默安装与配置

水煮oracle 20——redhat6下的oracle 11g r2的静默安装与配置

原创 Linux操作系统 作者:1向2飞 时间:2013-04-02 20:38:27 0 删除 编辑
            近期由于一个证券公司客户要对数据中心业务数据库做备机处理,所以就要去给客户安装linux+oracle环境,并且安装目录要和生产环境一致。
            客户环境:操作系统——linux redhat 6.0 x86-64
                              数据库——oracle 11g r2
还好只是做一个单实例数据库,由于平常只在虚拟机上玩,正好这是一次接触实践的机会,由于离客户机房较远,所以图形安装数据库方案不考虑了,从网上知道oracle可以静默安装,所以本人也采取静默安装方式,这样也比较方便。
     具体安装步骤:
1.创建用户组和用户
#groupadd oinstall
#groupadd dba
#useradd -g oinstall -G dba -d /oracle oracle ---------------创建oracle用户,默认家目录为oracle
#passwd oracle
2.配置环境变量
#su - oracle
$vi .bash_profile
添加如下变量:
ORACLE_SID=orcl
ORACLE_BASE=/oracle/app/oracle
ORACLE_HOME=/oracle/app/oracle/product/11.2.0/dbhome_1
PATH=$ORACLE_HOME/bin:$PATH
export ORACLE_SID ORACLE_BASE ORACLE_HOME PATH ----------------使这些变量成为环境变量
stth erase ^h ----------------这个是使回头进入到sqlplus后可以使用返回键
保存后执行下面命令使其生效
$source .bash_profile
$env | grep ORA -------------查看是否生效
3.修改内核参数sysctl.conf文件
# vi /etc/sysctl.conf
添加如下参数:(参考oracle官方安装文档:http://docs.oracle.com/cd/E11882_01/install.112/e24326/toc.htm)
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 536870912
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
4.修改文件 /etc/security/limits.conf
添加如下参数:
oracle              soft    nproc   2047
oracle              hard    nproc   16384
oracle              soft    nofile  1024
oracle              hard    nofile  65536
oracle              soft    stack   10240
5.安装oracle所需安装包(同样参考oracle官方安装文档:http://docs.oracle.com/cd/E11882_01/install.112/e24326/toc.htm)
找到对应linux版本,本人使用的 redhat 6.0 x86-64

The following or later version of packages for Oracle Linux 6, and Red Hat Enterprise Linux 6 must be installed:

binutils-2.20.51.0.2-5.11.el6 (x86_64)
compat-libcap1-1.10-1 (x86_64)
compat-libstdc++-33-3.2.3-69.el6 (x86_64)
compat-libstdc++-33-3.2.3-69.el6.i686
gcc-4.4.4-13.el6 (x86_64)
gcc-c++-4.4.4-13.el6 (x86_64)
glibc-2.12-1.7.el6 (i686)
glibc-2.12-1.7.el6 (x86_64)
glibc-devel-2.12-1.7.el6 (x86_64)
glibc-devel-2.12-1.7.el6.i686
ksh
libgcc-4.4.4-13.el6 (i686)
libgcc-4.4.4-13.el6 (x86_64)
libstdc++-4.4.4-13.el6 (x86_64)
libstdc++-4.4.4-13.el6.i686
libstdc++-devel-4.4.4-13.el6 (x86_64)
libstdc++-devel-4.4.4-13.el6.i686
libaio-0.3.107-10.el6 (x86_64)
libaio-0.3.107-10.el6.i686
libaio-devel-0.3.107-10.el6 (x86_64)
libaio-devel-0.3.107-10.el6.i686
make-3.81-19.el6
sysstat-9.0.4-11.el6 (x86_64)
其他软件所需包,不是必须的但建议一块安装
Oracle ODBC Drivers包:

On Oracle Linux 6 and Red Hat Enterprise Linux 6:

  • unixODBC-2.2.14-11.el6 (x86_64) or later

  • unixODBC-2.2.14-11.el6.i686 or later

  • unixODBC-devel-2.2.14-11.el6 (x86_64) or later

  • unixODBC-devel-2.2.14-11.el6.i686 or later

  • 安装命令:

    #rpm -ivf *.rpm --force --nodeps ----------如果有些包安装不上就加上后边的两个参数进行强制安装

    #rpm -evf *.rpm --nodeps -----------强制卸载rpm

     

    6.创建安装目录

    #mkdir -p /oracle/app/oracle/product/11.2.0/dbhome_1

    #chown -R oracle.oinstall /oracle----修改文件的用户和属组

    7.上面的工作做完以后就可以进行oracle的静默安装了

    分为三部分:1》oracle软件的静默安装

    2》oracle监听的静默安装

    3》oracle的数据库安装

    1》oracle软件的静默安装

    命令:$./runInstaller -silent -noconfig -force -responseFile /oracle/install/db_install.rsp

    参数:-silent ---指oracle采用静默安装

    -noconfig---指oracle安装过程中不创建database

    -force ---遇到非空目录也强制安装

    -responseFile ---指定应答文件路径(注意后边路径一定是绝对路径)

    说明:db_install.rsp文件在oracle安装文件中是自带的:/database/response下边有三个文件分别是:db_install---数据库软件安装配置文件,如果使用这个需要手动配置,但是也可以使用图形界面安装一遍后保存一个这样的配置文件共以后使用

    :netca.rsp ---这个是配置监听的,可以直接使用

    :dbca.rsp ---这个是创建database的,必须手动配置

    2》oracle监听的静默安装

    命令:$netca /silent /responsefile /oracle/database/response/netca.rsp

    3》oracle数据的静默安装

    命令:$dbca -silent -respnsefile /oracle/database/response/dbca.rsp

     

    附件一:

    db_install文件配置或图形安装生成:

    图形安装生成:

    在图形安装到如下图步骤时,进行保存文件:

     

     

     手动修改:

    #-------------------------------------------------------------------------------

    # Do not change the following system generated value.

    #-------------------------------------------------------------------------------

    oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0  ===读取 oracle的安装版本,不做更改

    #-------------------------------------------------------------------------------

    # The installation option can be one of the following

    # 1. INSTALL_DB_SWONLY

    # 2. INSTALL_DB_AND_CONFIG

    # 3. UPGRADE_DB

    #-------------------------------------------------------------------------------

    oracle.install.option=INSTALL_DB_SWONLY  ==以上三种模式对应如图

     

    #-------------------------------------------------------------------------------

    # This variable holds the hostname of the system as set by the user.

    # It can be used to force the installation to use an alternative  

    # hostname rather than using the first hostname found on the system

    # (e.g., for systems with multiple hostnames and network interfaces).

    #-------------------------------------------------------------------------------

    ORACLE_HOSTNAME=localhost.localdomain ===linux的主机名称

    #-------------------------------------------------------------------------------

    # Unix group to be set for the inventory directory. 

    #-------------------------------------------------------------------------------

    UNIX_GROUP_NAME=oinstall   ===inventory(库存)目录所属的主组

    #-------------------------------------------------------------------------------

    # Inventory location.

    #-------------------------------------------------------------------------------

    INVENTORY_LOCATION=/oracle/app/oraInventory === oraInventory目录的路径

     

     

     

    #-------------------------------------------------------------------------------

    # Specify the languages in which the components will be installed.            

    #

    # en   : English                  ja   : Japanese                 

    # fr   : French                   ko   : Korean                   

    # ar   : Arabic                   es   : Latin American Spanish   

    # bn   : Bengali                  lv   : Latvian                  

    # pt_BR: Brazilian Portuguese     lt   : Lithuanian               

    # bg   : Bulgarian                ms   : Malay                    

    # fr_CA: Canadian French          es_MX: Mexican Spanish          

    # ca   : Catalan                  no   : Norwegian                

    # hr   : Croatian                 pl   : Polish                   

    # cs   : Czech                    pt   : Portuguese               

    # da   : Danish                   ro   : Romanian                 

    # nl   : Dutch                    ru   : Russian                  

    # ar_EG: Egyptian                 zh_CN: Simplified Chinese       

    # en_GB: English (Great Britain)  sk   : Slovak                   

    # et   : Estonian                 sl   : Slovenian                

    # fi   : Finnish                  es_ES: Spanish                   

    # de   : German                   sv   : Swedish                  

    # el   : Greek                    th   : Thai                     

    # iw   : Hebrew                   zh_TW: Traditional Chinese      

    # hu   : Hungarian                tr   : Turkish                  

    # is   : Icelandic                uk   : Ukrainian                

    # in   : Indonesian               vi   : Vietnamese               

    # it   : Italian                                                  

    #

    # Example : SELECTED_LANGUAGES=en,fr,ja

    #-------------------------------------------------------------------------------

    SELECTED_LANGUAGES=en ==选择支持语言

     

     

    #-------------------------------------------------------------------------------

    # Complete path of the Oracle Home 

    #-------------------------------------------------------------------------------

    ORACLE_HOME=/oracle/app/oracle/product/11.2.0/dbhome_1  ==oracle家目录

     

    #-------------------------------------------------------------------------------

    # Complete path of the Oracle Base.

    #-------------------------------------------------------------------------------

    ORACLE_BASE=/oracle/app/oracle ==oracle基目录

     

     

     

    #-------------------------------------------------------------------------------

    # Installation Edition of the component.                       

    #                                                            

    # The value should contain only one of these choices.       

    # EE     : Enterprise Edition                               

    # SE     : Standard Edition                                 

    # SEONE  : Standard Edition One

    # PE     : Personal Edition (WINDOWS ONLY)

    #-------------------------------------------------------------------------------

    oracle.install.db.InstallEdition=EE   ===安装版本

     

     

    #-------------------------------------------------------------------------------

    # This property is considered only if InstallEdition is EE.

    #

    # true  : Components mentioned as part of 'customComponents' property

    #         are considered for install.

    # false : Value for 'customComponents' is not considered.

    #-------------------------------------------------------------------------------

    oracle.install.db.isCustomInstall=false  ===????

     

    #-------------------------------------------------------------------------------

    # This property is considered only if 'IsCustomInstall' is set to true

    #

    # Description: List of Enterprise Edition Options you would like to install.

    #

    #              The following choices are available. You may specify any

    #              combination of these choices.  The components you choose should

    #              be specified in the form. "internal-component-name:version"

    #              Below is a list of components you may specify to install.

    #       

    #              oracle.oraolap:11.2.0.0.2 - Oracle OLAP

    #              oracle.rdbms.dm:11.2.0.0.2 - Oracle Data Mining RDBMS Files

    #              oracle.rdbms.dv:11.2.0.0.2 - Oracle Database Vault option

    #              oracle.rdbms.lbac:11.2.0.0.2 - Oracle Label Security

    #              oracle.rdbms.partitioning:11.2.0.0.2 - Oracle Partitioning

    #              oracle.rdbms.rat:11.2.0.0.2 - Oracle Real Application Testing

    #              oracle.clrintg.ode_net:11.2.0.0.2 - Oracle Database Extensions for .NET 1.x (Windows)

    #              oracle.clrintg.ode_net_2:11.2.0.0.2 - Oracle Database Extensions for .NET 2.0 (Windows)

    #-------------------------------------------------------------------------------

    oracle.install.db.customComponents=

     

    #-------------------------------------------------------------------------------

    oracle.install.db.DBA_GROUP=oinstall

     

    #-------------------------------------------------------------------------------

    oracle.install.db.OPER_GROUP=oinstall

     

     

     

    #-------------------------------------------------------------------------------

    # This variable represents the cluster node names selected by the . 

    # user for installation                                     

    #-------------------------------------------------------------------------------

    oracle.install.db.CLUSTER_NODES=       /:设置集群节点名称参数

     

    #-------------------------------------------------------------------------------

    # One of the following

    # - GENERAL_PURPOSE                             

    # - TRANSACTION_PROCESSING                      

    # - DATAWAREHOUSE                               

    #-------------------------------------------------------------------------------

    oracle.install.db.config.starterdb.type=GENERAL_PURPOSE   /:????

     

    #-------------------------------------------------------------------------------

    # Global Database Name

    #-------------------------------------------------------------------------------

    oracle.install.db.config.starterdb.globalDBName=       /:全局数据库名称--orcl

     

    #-------------------------------------------------------------------------------

    # The Starter Database SID

    #-------------------------------------------------------------------------------

    oracle.install.db.config.starterdb.SID=             /:oracle的SID名称__orcl

     

    #-------------------------------------------------------------------------------

    # Database character set

    #                                              

    #  One of the following

    #  AL32UTF8, WE8ISO8859P15, WE8MSWIN1252, EE8ISO8859P2,

    #  EE8MSWIN1250, NE8ISO8859P10, NEE8ISO8859P4, BLT8MSWIN1257,

    #  BLT8ISO8859P13, CL8ISO8859P5, CL8MSWIN1251, AR8ISO8859P6,

    #  AR8MSWIN1256, EL8ISO8859P7, EL8MSWIN1253, IW8ISO8859P8,

    #  IW8MSWIN1255, JA16EUC, JA16EUCTILDE, JA16SJIS, JA16SJISTILDE,

    #  KO16MSWIN949, ZHS16GBK, TH8TISASCII, ZHT32EUC, ZHT16MSWIN950,

    #  ZHT16HKSCS, WE8ISO8859P9, TR8MSWIN1254, VN8MSWIN1258

    #-------------------------------------------------------------------------------

    oracle.install.db.config.starterdb.characterSet=    /数据库字符集选择

    #-------------------------------------------------------------------------------

    # Specify the total memory allocation for the database. (in MB)

    # Value should be at least 256 MB, and should not exceed the 

    # total physical memory available on the system.

    # Example: oracle.install.db.config. starterdb.memoryLimit=40

    #-------------------------------------------------------------------------------

    oracle.install.db.config.starterdb.memoryLimit=

    oracle.install.db.config.starterdb.memoryOption=false   /:???

     

    #-------------------------------------------------------------------------------

    # This variable controls whether to load Example Schemas onto

    # the starter database or not.

    #-------------------------------------------------------------------------------

    oracle.install.db.config.starterdb.installExampleSchemas=false  /:控制是否安装oracle自带例子

     

    #-------------------------------------------------------------------------------

    # This include enabling audit settings, configuring password 

    # profiles and revoking some grants to public. These settings

    # are provided by default.  You may choose to disable all.   

    #-------------------------------------------------------------------------------

    oracle.install.db.config.starterdb.enableSecuritySettings=true

     

    #-------------------------------------------------------------------------------

    oracle.install.db.config.starterdb.password.ALL=

     

    #-------------------------------------------------------------------------------

    oracle.install.db.config.starterdb.password.SYS=

     

    #-------------------------------------------------------------------------------

    oracle.install.db.config.starterdb.password.SYSTEM=

     

    #-------------------------------------------------------------------------------

    oracle.install.db.config.starterdb.password.SYSMAN=

     

    #-------------------------------------------------------------------------------

    oracle.install.db.config.starterdb.password.DBSNMP=

     

    #-------------------------------------------------------------------------------

    # Can be one of the following

    # 1. GRID_CONTROL

    # 2. DB_CONTROL

    #

    oracle.install.db.config.starterdb.control=DB_CONTROL

     

    #-------------------------------------------------------------------------------

    # Determines the Management Service to use if Grid Control  

    # is selected to manage the database.     

    #-------------------------------------------------------------------------------

    oracle.install.db.config.starterdb.gridcontrol.gridControlServiceURL=

     

    #-------------------------------------------------------------------------------

    # Determines whether to receive email notification for      

    # critical alerts when using DB control.  

    #-------------------------------------------------------------------------------

    oracle.install.db.config.starterdb.dbcontrol.enableEmailNotification=false

     

    #-------------------------------------------------------------------------------

    oracle.install.db.config.starterdb.dbcontrol.emailAddress=

     

    #-------------------------------------------------------------------------------

    oracle.install.db.config.starterdb.dbcontrol.SMTPServer=

     

    #-------------------------------------------------------------------------------

    oracle.install.db.config.starterdb.automatedBackup.enable=false

     

    #-------------------------------------------------------------------------------

    oracle.install.db.config.starterdb.automatedBackup.osuid=

     

    #-------------------------------------------------------------------------------

    oracle.install.db.config.starterdb.automatedBackup.ospwd=

     

    #-------------------------------------------------------------------------------

    # Can be one of the following

    # - FILE_SYSTEM_STORAGE

    # - ASM_STORAGE

    #-------------------------------------------------------------------------------

    oracle.install.db.config.starterdb.storageType=

     

    #-------------------------------------------------------------------------------

    # Database file location:                 

    # directory for datafiles, control files, redo logs.        

    #

    # Applicable only when oracle.install.db.config.starterdb.storage=FILE_SYSTEM_STORAGE

    #-------------------------------------------------------------------------------

    oracle.install.db.config.starterdb.fileSystemStorage.dataLocation=

     

    #-------------------------------------------------------------------------------

    # Backup and recovery location

    #

    # Applicable only when oracle.install.db.config.starterdb.storage=FILE_SYSTEM_STORAGE

    #-------------------------------------------------------------------------------

    oracle.install.db.config.starterdb.fileSystemStorage.recoveryLocation=

     

    #-------------------------------------------------------------------------------

    # Name of ASM disk group to be used for storage.

    #

    # Applicable only when oracle.install.db.config.starterdb.storageType=ASM_STORAGE

    #-------------------------------------------------------------------------------

    oracle.install.db.config.asm.diskGroup=

     

    #-------------------------------------------------------------------------------

    # Password for ASMSNMP user of the ASM instance.                 

    #

    # Applicable only when oracle.install.db.config.starterdb.storage=ASM_STORAGE

    #-------------------------------------------------------------------------------

    oracle.install.db.config.asm.ASMSNMPPassword=

     

    #------------------------------------------------------------------------------

    # Specify the My Oracle Support Account Username.

    #

    #  Example   : MYORACLESUPPORT_USERNAME=metalink

    #------------------------------------------------------------------------------

    MYORACLESUPPORT_USERNAME=

     

    #------------------------------------------------------------------------------

    # Specify the My Oracle Support Account Username password.

    #

    # Example    : MYORACLESUPPORT_PASSWORD=password

    #------------------------------------------------------------------------------

    MYORACLESUPPORT_PASSWORD=

     

    #------------------------------------------------------------------------------

    # Specify whether to enable the user to set the password for

    # My Oracle Support credentials. The value can be either true or false.

    # If left blank it will be assumed to be false.

    #

    # Example    : SECURITY_UPDATES_VIA_MYORACLESUPPORT=true

    #------------------------------------------------------------------------------

    SECURITY_UPDATES_VIA_MYORACLESUPPORT=false

     

    #------------------------------------------------------------------------------

    # Specify whether user wants to give any proxy details for connection.

    # The value can be either true or false. If left blank it will be assumed

    # to be false.

    #

    # Example    : DECLINE_SECURITY_UPDATES=false

    #------------------------------------------------------------------------------

    DECLINE_SECURITY_UPDATES=true

     

    #------------------------------------------------------------------------------

    # Specify the Proxy server name. Length should be greater than zero.

    #

    # Example    : PROXY_HOST=proxy.domain.com

    #------------------------------------------------------------------------------

    PROXY_HOST=

     

    #------------------------------------------------------------------------------

    # Specify the proxy port number. Should be Numeric and atleast 2 chars.

    #

    # Example    : PROXY_PORT=25

    #------------------------------------------------------------------------------

    PROXY_PORT=

    说明以上内容可以复制,直接保存为db_install.rsp文件作为静默安装文件

    附件二、

    对于netca.rsp文件可以直接使用oracle安装包中的文件无需修改

    附件三、

    对于dbca.rsp文件必须手动修改:

    修改参数:

    GDBNAME="orcl"

    TEMPLATENAME="db_oracle.dbc"

    建议修改参数:

    CHARACTERSET="en_UTF-8"

    TOTALMEMORY="1024"

    注意在开始本安装时,会提示你输入sys和system密码

     

    =========================

    linux下完全删除Oracle

    1.用oracle用户登录
    如果要再次安装, 最好先做一些备份工作。
    包括用户的登录脚本,数据库自动启动关闭的脚本,和Listener自动启动的脚本。
    要是有可能连创建数据库的脚本也保存下来

    2.使用SQL*PLUS停止数据库
    [oracle@ora920 oracle]$ sqlplus /nolog
    SQL> connect / as sysdba
    SQL> shutdown [immediate]
    SQL> exit

    3.停止Listener
    [oracle@ora920 oracle]$ lsnrctl stop

    4.停止HTTP服务
    [oracle@ora920 oracle]$ $ORACLE_HOME/Apache/Apache/bin/apachectl stop

    5.用su或者重新登录到root(如想重新安装可以保留oracle用户,省得输入环境变量了)

    6.将安装目录删除
    [root@ora920 /root]# rm -rf /opt/oracle/

    7.将/usr/bin下的文件删除
    [root@ora920 /root]# rm /usr/local/bin/dbhome
    [root@ora920 /root]# rm /usr/local/bin/oraenv
    [root@ora920 /root]# rm /usr/local/bin/coraenv

    8.将/etc/oratab删除
    [root@ora920 /root]# rm /etc/oratab

    9.将/etc/oraInst.loc删除
    [root@ora920 /root]# rm /etc/oraInst.loc

    10.将oracle用户删除(若要重新安装,可以不删除)
    [root@ora920 /root]# userdel –r oracle

    11.将用户组删除(若要重新安装,可以不删除)
    [root@ora920 /root]# groupdel oinstall
    [root@ora920 /root]# groupdel dba

    12.将启动服务删除
    [root@ora920 /root]# chkconfig --del dbora

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/23890223/viewspace-757665/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2010-05-11

  • 博文量
    73
  • 访问量
    349491