OS: CentOS 7.4; hosts: L134; IP: 192.168.1.134
DB: linux.x64_11gR2_databasehtml
安裝依賴包node
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
建立安裝文件的目錄(目錄不限,只要空間足夠便可),並上傳安裝文件linux
mkdir -p /opt/oracle_install cd /opt/oracle_install/ unzip linux.x64_11gR2_database_1of2.zip unzip linux.x64_11gR2_database_2of2.zip
安裝pdksh,注意會不會與ksh衝突c++
wget http://vault.centos.org/5.11/os/i386/CentOS/pdksh-5.2.14-37.el5_8.1.i386.rpm yum localinstall pdksh-5.2.14-37.el5_8.1.i386.rpm
建立Linux帳號sql
groupadd oinstall groupadd dba groupadd oper useradd -g oinstall -G dba,oper oracle passwd oracle 123456
配置內核參數(修改或添加如下內容)shell
vim /etc/sysctl.conf kernel.shmall = 2097152 #kernel.shmmax最低:536870912,最大值:比物理內存小1個字節的值,建議超過物理內存的一半 kernel.shmmax = 2147483648 fs.file-max = 6815744 fs.aio-max-nr = 1048576 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
配置生效數據庫
sysctl -p
修改用戶限制vim
vim /etc/security/limits.conf oracle soft nproc 2047 oracle hard nproc 16384 oracle soft nofile 1024 oracle hard nofile 65536 oracle soft stack 10240 oracle hard stack 10240
主機名與IP對應centos
vim /etc/hosts 192.168.1.134 L134
建立oracle安裝目錄bash
mkdir -p /data/app/oraInventory chown -R oracle:oinstall /data/app chmod 755 /data/app
上傳安裝文件,並解壓
cd /opt/oracle_install unzip linux.x64_11gR2_database_1of2.zip unzip linux.x64_11gR2_database_2of2.zip
su - oracle vim /home/oracle/.bash_profile ORACLE_BASE=/data/app/oracle ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1 ORACLE_SID=orcl LD_LIBRARY_PATH=$ORACLE_HOME/lib PATH=$PATH:$ORACLE_HOME/bin:$HOME/bin export ORACLE_BASE ORACLE_HOME ORACLE_SID LD_LIBRARY_PATH PATH export NLS_LANG=AMERICAN export NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS'
source /home/oracle/.bash_profile
配置靜默安裝文件
mkdir -p /home/oracle/rsp cp /opt/oracle_install/database/response/* /home/oracle/rsp cd /home/oracle/rsp chmod 700 *
vim db_install.rsp oracle.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/oracle oracle.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_PURPOSE oracle.install.db.config.starterdb.globalDBName=orcl oracle.install.db.config.starterdb.SID=orcl oracle.install.db.config.starterdb.memoryOption=false oracle.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.sh To 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
su - /data/app/oracle/oraInventory/orainstRoot.sh /data/app/oracle/product/11.2.0/db_1/root.sh
su - oracle netca /silent /responseFile /home/oracle/rsp/netca.rsp
監聽安裝成功有相似以下提示
Parsing command line arguments: Parameter "silent" = true Parameter "responsefile" = /home/oracle/rsp/netca.rsp Done 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
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 files 1% complete 3% complete 11% complete 18% complete 26% complete 37% complete Creating and starting Oracle instance 40% complete 45% complete 50% complete 55% complete 56% complete 57% complete 60% complete 62% complete Completing Database Creation 66% complete 70% complete 73% complete 74% complete 85% complete 96% complete 100% complete Look at the log file "/data/app/oracle/cfgtoollogs/dbca/orcl/orcl.log" for further details.
此到,oracle已經安裝完成,可使用sqlplus登陸。
加強sqlplus的編輯功能
su - cd /opt/oracle_install wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm rpm -ivh epel-release-latest-7.noarch.rpm yum install readline rlwrap -y su - oracle echo 'alias sqlplus='"'"'rlwrap sqlplus'"'" >> /home/oracle/.bash_profile echo 'alias rman='"'"'rlwrap rman'"'" >> /home/oracle/.bash_profile
美化sqlplus的顯示
echo 'set linesize 300' >> $ORACLE_HOME/sqlplus/admin/glogin.sql echo 'set pagesize 50000' >> $ORACLE_HOME/sqlplus/admin/glogin.sql echo 'set timing on' >> $ORACLE_HOME/sqlplus/admin/glogin.sql
仔細查看錯誤提示和安裝日誌,通常都能定位到問題上,好比配置文件錯誤,依賴包問題或其餘先決條件不知足等,均可以在安裝日誌中查到。
未安裝完成停止的日誌在/tmp/OraInstallXXXXX/下,其中XXXX爲安裝日期,
[oracle@L134 ~]$ sqlplus Error 6 initializing SQL*Plus SP2-0667: Message file sp1<lang>.msb not found SP2-0750: You may need to set ORACLE_HOME to your Oracle software directory
緣由:環境變量未配置或配置有問題
[oracle@L134 ~]$ echo $ORACLE_HOME /data/oracle/11g2a
發現ORACLE_HOME的路徑寫錯,改正後再source一次便可。
從新安裝oracle時,沒有orainstRoot.sh文件
只提示運行:/data/oracle/product/10.2.0/crs_1/root.sh這個文件。
緣由:沒刪除/etc/oraInst.loc文件
靜默安裝Oracle時提示:"[SEVERE] - Email Address Not Specified"
系統環境:CentOS 6.3 x86_64 + Oracle 11gR2
解決辦法:
修改responseFile文件,將DECLINE_SECURITY_UPDATES=的值設爲true,若是爲空系統會假設該值爲false,DECLINE_SECURITY_UPDATES=的值默認爲空。
Starting Oracle Universal Installer... Checking Temp space: must be greater than 120 MB. Actual 37373 MB Passed Checking swap space: must be greater than 150 MB. Actual 4999 MB Passed Preparing 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
檢查:
[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:CRITICAL 958:INFO: OverallStatus:VERIFICATION_FAILED 959-INFO: ----------------------------------------------- 960-INFO: Verification Result for Node:oracletest1 961-INFO: Expected Value:glibc-2.3.4-2.41 (i686) 962-INFO: Actual Value:missing 963-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: -----------------------------------------------
圖形界面安裝,請參考:https://www.cnblogs.com/fishparadise/p/9189325.html