水煮oracle 20——redhat6下的oracle 11g r2的靜默安裝與配置

1向2飛發表於2013-04-02
            近期由於一個證券公司客戶要對資料中心業務資料庫做備機處理,所以就要去給客戶安裝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=             /:oracleSID名稱__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部落格 ” ,連結:http://blog.itpub.net/23890223/viewspace-757665/,如需轉載,請註明出處,否則將追究法律責任。

相關文章