CentOS靜默安裝Oracle 11gR2(x64)

來源:互聯網
上載者:User

標籤:wing   oracle安裝   建庫   let   some   rip   oar   ring   Xshell5   

環境

OS: CentOS 7.4; hosts: L134; IP: 192.168.1.134
DB: linux.x64_11gR2_database

安裝依賴包

yum install -y binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibc glibc-common glibc-devel libaio libaio-devel libgcc libstdc++ libstdc++-devel make numactl sysstat libXp unixODBC unixODBC-devel

建立安裝檔案的目錄(目錄不限,只要空間足夠即可),並上傳安裝檔案

mkdir -p /opt/oracle_installcd /opt/oracle_install/unzip linux.x64_11gR2_database_1of2.zipunzip linux.x64_11gR2_database_2of2.zip

安裝pdksh,注意會不會與ksh衝突

wget http://vault.centos.org/5.11/os/i386/CentOS/pdksh-5.2.14-37.el5_8.1.i386.rpmyum localinstall pdksh-5.2.14-37.el5_8.1.i386.rpm

建立Linux帳號

groupadd oinstallgroupadd dbagroupadd operuseradd -g oinstall -G dba,oper oraclepasswd oracle123456

配置核心參數(修改或添加以下內容)

vim /etc/sysctl.confkernel.shmall = 2097152#kernel.shmmax最低:536870912,最大值:比實體記憶體小1個位元組的值,建議超過實體記憶體的一半kernel.shmmax = 2147483648 fs.file-max = 6815744fs.aio-max-nr = 1048576kernel.shmmni = 4096kernel.sem = 250 32000 100 128net.ipv4.ip_local_port_range = 9000 65500net.core.rmem_default = 262144net.core.rmem_max = 4194304net.core.wmem_default = 262144net.core.wmem_max = 1048576

配置生效

sysctl -p

修改使用者限制

vim /etc/security/limits.conforacle soft nproc 2047oracle hard nproc 16384oracle soft nofile 1024oracle hard nofile 65536oracle soft stack 10240oracle hard stack 10240

主機名稱與IP對應

vim /etc/hosts192.168.1.134 L134

建立oracle安裝目錄

mkdir -p /data/app/oraInventorychown -R oracle:oinstall /data/appchmod 755 /data/app

上傳安裝檔案,並解壓

cd /opt/oracle_installunzip linux.x64_11gR2_database_1of2.zipunzip linux.x64_11gR2_database_2of2.zip
切換使用者並修改設定檔(以下用oracle帳號配置和執行)
su - oraclevim /home/oracle/.bash_profileORACLE_BASE=/data/app/oracleORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1ORACLE_SID=orclLD_LIBRARY_PATH=$ORACLE_HOME/libPATH=$PATH:$ORACLE_HOME/bin:$HOME/binexport ORACLE_BASE ORACLE_HOME ORACLE_SID LD_LIBRARY_PATH PATHexport NLS_LANG=AMERICANexport NLS_DATE_FORMAT=‘YYYY-MM-DD HH24:MI:SS‘
source /home/oracle/.bash_profile

配置靜默安裝檔案

mkdir -p /home/oracle/rspcp /opt/oracle_install/database/response/* /home/oracle/rspcd /home/oracle/rspchmod 700 *
vim db_install.rsporacle.install.option=INSTALL_DB_SWONLY     ORACLE_HOSTNAME=L134        UNIX_GROUP_NAME=oinstall     INVENTORY_LOCATION=/data/app/oraInventory   SELECTED_LANGUAGES=en ORACLE_HOME=/data/app/oracle/product/11.2.0/db_1    ORACLE_BASE=/data/app/oracleoracle.install.db.InstallEdition=EE #自訂安裝,否,使用預設組件oracle.install.db.isCustomInstall=false   oracle.install.db.DBA_GROUP=dba   oracle.install.db.OPER_GROUP=oper#資料庫類型;注釋寫著GENERAL_PURPOSE/TRANSACTION_PROCESSING和DATA_WAREHOUSE是候選項,#但實際前者只能二選一,需要注意。oracle.install.db.config.starterdb.type=GENERAL_PURPOSEoracle.install.db.config.starterdb.globalDBName=orcl oracle.install.db.config.starterdb.SID=orcl      oracle.install.db.config.starterdb.memoryOption=falseoracle.install.db.config.starterdb.memoryLimit=2048 #所有資料庫使用者使用同一個密碼oracle.install.db.config.starterdb.password.ALL=root123 DECLINE_SECURITY_UPDATES=true
開始安裝
/opt/oracle_install/database/runInstaller -silent -responseFile /home/oracle/rsp/db_install.rsp

安裝成功有如下提示

The following configuration scripts need to be executed as the "root" user. #!/bin/sh #Root scripts to run/data/app/oraInventory/orainstRoot.sh/data/app/oracle/product/11.2.0/db_1/root.shTo execute the configuration scripts:     1. Open a terminal window      2. Log in as "root"      3. Run the scripts      4. Return to this window and hit "Enter" key to continue Successfully Setup Software.

安裝日誌

/data/app/oracle/oraInventory/logs/installActionsXXXX.log
以root身份證執行以下兩個指令碼(這一步需要切換為root帳號執行)
su -/data/app/oracle/oraInventory/orainstRoot.sh/data/app/oracle/product/11.2.0/db_1/root.sh
配置監聽(切換為oracle帳號)
su - oraclenetca /silent /responseFile /home/oracle/rsp/netca.rsp 

監聽安裝成功有類似如下提示

Parsing command line arguments:    Parameter "silent" = true    Parameter "responsefile" = /home/oracle/rsp/netca.rspDone parsing command line arguments.Oracle Net Services Configuration:Profile configuration complete.Oracle Net Listener Startup:    Running Listener Control:       /data/app/oracle/product/11.2.0/db_1/bin/lsnrctl start LISTENER    Listener Control complete.    Listener started successfully.Listener configuration complete.Oracle Net Services configuration successful. The exit code is 0
dbca建庫修改應答檔案
vim /home/oracle/rsp/dbca.rsp[GENERAL]RESPONSEFILE_VERSION = "11.2.0"OPERATION_TYPE = "createDatabase"[CREATEDATABASE]GDBNAME = "orcl"SID = "orcl"TEMPLATENAME = "General_Purpose.dbc"CHARACTERSET = "AL32UTF8"
開始建立資料庫

注意在xshell5下,執行了dbca命令後,會自動清屏,沒有顯示要求輸入sys和system使用者的密碼,實際是要輸入兩次相同的密碼的。

dbca -silent -responseFile /home/oracle/rsp/dbca.rsp Enter SYS user password: Enter SYSTEM user password: 

建立完成的提示

Copying database files1% complete3% complete11% complete18% complete26% complete37% completeCreating and starting Oracle instance40% complete45% complete50% complete55% complete56% complete57% complete60% complete62% completeCompleting Database Creation66% complete70% complete73% complete74% complete85% complete96% complete100% completeLook at the log file "/data/app/oracle/cfgtoollogs/dbca/orcl/orcl.log" for further details.

此到,oracle已經安裝完成,可以使用sqlplus登入。


擴充

增強sqlplus的編輯功能

su -cd /opt/oracle_installwget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpmrpm -ivh epel-release-latest-7.noarch.rpmyum install readline rlwrap -ysu - oracleecho ‘alias sqlplus=‘"‘"‘rlwrap sqlplus‘"‘" >> /home/oracle/.bash_profileecho ‘alias rman=‘"‘"‘rlwrap rman‘"‘" >> /home/oracle/.bash_profile

美化sqlplus的顯示

echo ‘set linesize 300‘ >> $ORACLE_HOME/sqlplus/admin/glogin.sqlecho ‘set pagesize 50000‘ >> $ORACLE_HOME/sqlplus/admin/glogin.sqlecho ‘set timing on‘ >> $ORACLE_HOME/sqlplus/admin/glogin.sql
安裝故障

仔細查看錯誤提示和安裝日誌,一般都能定位到問題上,比如設定檔錯誤,依賴包問題或其他先決條件不滿足等,都可以在安裝日誌中查到。

未安裝完成中止的日誌在/tmp/OraInstallXXXXX/下,其中XXXX為安裝日期,

故障1
[[email protected] ~]$ sqlplusError 6 initializing SQL*PlusSP2-0667: Message file sp1<lang>.msb not foundSP2-0750: You may need to set ORACLE_HOME to your Oracle software directory

原因:環境變數未配置或配置有問題

[[email protected] ~]$ echo $ORACLE_HOME/data/oracle/11g2a

發現ORACLE_HOME的路徑寫錯,改正後再source一次即可。

故障2

重新安裝oracle時,沒有orainstRoot.sh檔案
只提示運行:/data/oracle/product/10.2.0/crs_1/root.sh這個檔案。

原因:沒刪除/etc/oraInst.loc檔案

故障3

靜默安裝Oracle時提示:"[SEVERE] - Email Address Not Specified"
系統內容:CentOS 6.3 x86_64 + Oracle 11gR2

解決辦法:
修改responseFile檔案,將DECLINE_SECURITY_UPDATES=的值設為true,如果為空白系統會假設該值為false,DECLINE_SECURITY_UPDATES=的值預設為空白。

故障4
Starting Oracle Universal Installer...Checking Temp space: must be greater than 120 MB.   Actual 37373 MB    PassedChecking swap space: must be greater than 150 MB.   Actual 4999 MB    PassedPreparing to launch Oracle Universal Installer from /tmp/OraInstall2018-03-07_07-08-17PM. Please wait ...Invalid source path ‘../stage/Components/oracle.jdk/1.5.0.17.0/1/DataFiles‘ specified for unzip. Unzip command failed.   Please check oraparam.ini and specify a valid source path.No such file or directory

檢查:

  1. 安裝檔案沒問題
  2. 安裝檔案存放的路徑,不要有中文路徑
  3. 安裝路徑,不要有中文。
故障5

[FATAL] [INS-13013] Target environment do not meet some mandatory requirements.
CAUSE: Some of the mandatory prerequisites are not met.

解決辦法:
詳細查看安裝日誌。搜尋SEVERE,FAILED,Severity,CRITICAL,Error這幾個關鍵字,看為什麼沒有通過校正。
如果實豐沒有辦法,如在CentOS 6.x 64位下,已經安裝了glibc-2.12-1.209.el6_9.2.x86_64,但在檢驗時,出現如下錯誤。因為oracel要求:glibc-2.3.4-2.41(i686) 32位的,但實際已經安裝64位更新的版本了,此檢驗可以忽略。找到32位的舊版本的glibc,但死活安裝不上。最後只能加上-ignorePrereq參數,但最好還是全部通過檢驗比較好。

955-INFO: *********************************************956-INFO: Package: glibc-2.3.4-2.41: This is a prerequisite condition to test whether the package "glibc-2.3.4-2.41" is available on the system.957-INFO: Severity:CRITICAL958:INFO: OverallStatus:VERIFICATION_FAILED959-INFO: -----------------------------------------------960-INFO: Verification Result for Node:oracletest1961-INFO: Expected Value:glibc-2.3.4-2.41 (i686)962-INFO: Actual Value:missing963-INFO: Error Message:PRVF-7532 : Package "glibc-2.3.4-2.41 (i686)" is missing on node "134test"964-INFO: Cause: A required package is either not installed or, if the package is a kernel module, is not loaded on the specified node.965-INFO: Action: Ensure that the required package is installed and available.966-INFO: -----------------------------------------------
故障

查看安裝日誌,除了一些WARNING之外,還發現有幾個VERIFICATION_FAILED,不過都是IGNORABLE。仔細去查下這些依賴包其實都是已經安裝好了的。以下是其中一部分。

  797 INFO: OS Kernel Parameter: semmni: This is a prerequisite condition to test whether the OS kernel parameter "semmni" is properly set.  798 INFO: Severity:IGNORABLE  799 INFO: OverallStatus:VERIFICATION_FAILED  800 INFO: -----------------------------------------------  801 INFO: Verification Result for Node:134test  802 INFO: Expected Value:128  803 INFO: Actual Value:0  804 INFO: Error Message:PRVF-7543 : OS Kernel parameter "semmni" does not have proper value on node "134test" [Expected = "128" ; Found = "0"].  805 INFO: Cause: Kernel parameter value does not meet the requirement.  806 INFO: Action: Modify the kernel parameter value to meet the requirement.  807 INFO: -----------------------------------------------  926 INFO: Package: libaio-0.3.105: This is a prerequisite condition to test whether the package "libaio-0.3.105" is available on the system.  927 INFO: Severity:IGNORABLE  928 INFO: OverallStatus:VERIFICATION_FAILED  929 INFO: -----------------------------------------------  930 INFO: Verification Result for Node:134test  931 INFO: Expected Value:libaio-0.3.105 (i386)  932 INFO: Actual Value:missing  933 INFO: Error Message:PRVF-7532 : Package "libaio-0.3.105 (i386)" is missing on node "134test"  934 INFO: Cause: A required package is either not installed or, if the package is a kernel module, is not loaded on the specified node.  935 INFO: Action: Ensure that the required package is installed and available.  936 INFO: -----------------------------------------------




CentOS靜默安裝Oracle 11gR2(x64)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.