Linux+php+apache+oracle環(huán)境搭建之CentOS下安裝Oracle數(shù)據(jù)庫
這里推薦使用OTK腳本安裝Oracle,會大大提高安裝Oracle的成功系數(shù)。
Description oraToolKit is the Swiss Army Knife for Oracle. Standards and well designed tools help DBA's mastering Oracle 10g / 11g throughout the whole lifecycle. OTK runs on Linux, zLinux, Solaris, AIX, HP-UX and other UNIX based systems. 來自 <http://sourceforge.net/projects/oratoolkit/?source=navbar>
一,安裝Oracle約束
1、內(nèi)存要求
最小內(nèi)存1G,推薦2G或2G以上
2、swap大小設定
1GB跟2GB物理內(nèi)存之間的,設定swap大小為物理內(nèi)存的1.5倍
2GB跟16GB物理內(nèi)存之間的,設置swap大小與物理內(nèi)存相等
16GB物理內(nèi)存以上的,設置swap大小為16GB
3、共享內(nèi)存/dev/shm要求
至少比在每個oracle實例中的MEMORY_MAX_TARGET和MEMORY_TARGET要大。
4、/tmp空間大小要求
至少1GB空間
5、硬盤大小要求
存放oracle軟件文件和數(shù)據(jù)文件的空間至少10GB
6、操作系統(tǒng)
CentOS 6.5 64bit
- Basic Server
二,安裝步驟
1. 安裝Oracle需要的文件:
linux.x64_11gR2_database_1of2.zip
linux.x64_11gR2_database_2of2.zip
oratoolkit-1.0.2.1.5-1.noarch.rpm
下載這三個文件,放在/media/oracle目錄下。
2. 安裝OTK
root用戶登錄
把oratoolkit-1.0.2.1.5-1.noarch.rpm安裝包移動到y(tǒng)um本地數(shù)據(jù)源文件夾/Media/Packages下
在Packages下執(zhí)行安裝命令
# yum -y install oratoolkit*
3. 修改Oracle用戶密碼
OTK已經(jīng)幫我們建立了oracle用戶,下面需要設置oracle用戶密碼
# passwd oracle
4. 檢查環(huán)境依賴關(guān)系工具swReqCheck
OTK提供了智能檢查環(huán)境依賴關(guān)系,即檢查Linux系統(tǒng)還有什么不滿足的條件,比如缺少安裝包。
# /opt/oracle/otk/current/bin/installManager swReqCheck osSetup11gR2.cfg .. .. .. 20140419_010832: Info: Action swReqCheck of installManager ended with 44 WARNINGS
我的系統(tǒng)安裝的是CentOS 6.5 64bit - Basic Server,新系統(tǒng)缺少的安裝包較多,檢查出44個WARNINGS。
其中43個缺少的安裝包,一個可忽略的WARNING:
# 20140419_011022: Warning: Oracle software runs on CentOS however this combination is NOT supported by Oracle
安裝必須安裝的安裝包:用一個Shell腳本來解決問題,OTK提供了必須安裝的安裝包清單。
#先拼裝命令 REQ_FILE_DIR="/opt/oracle/otk/current/conf/installManager/requirement" REQ_FILE_PATH="$REQ_FILE_DIR/ora11gR2-redhat-5-x86_64.pkg.lst" YUM_COMMAND=$(echo "yum -y install") YUM_COMMAND+=$(egrep -v "#" $REQ_FILE_PATH | grep 32-bit | awk '{ print " "$1".i[356]86" }') YUM_COMMAND+=$(egrep -v "#" $REQ_FILE_PATH | grep 64-bit | awk '{ print " "$1".x86_64" }') #用echo看看最終拼裝的命令是什么樣 echo $YUM_COMMAND #執(zhí)行命令 $YUM_COMMAND #再次執(zhí)行環(huán)境檢查 /opt/oracle/otk/current/bin/installManager swReqCheck osSetup11gR2.cfg
再次檢查結(jié)果:
# 20130521_170131: Info: Action swReqCheck of installManager with ONE WARNING
剩下一個可忽略的警告。說明環(huán)境已經(jīng)滿足Oracle安裝了。
5. 編譯安裝rlwrap(增強SQLPLUS功能)
rlwrap is a wrapper that uses the GNU readline library to allow the editing of keyboard input for any other command. Input history is kept between invocations, separately for each command; history completion and search work as in bash and completion word lists can be specified on the command line. 來自 <http://utopia.knoware.nl/~hlub/uck/rlwrap/>
OTK集成了rlwrap工具
rlwrap增強了SQLPLUS的執(zhí)行命令歷史記錄和自動完成功能
編譯安裝rlwrap
# cd /opt/oracle/otk/current/tools/rlwrap/ # ./configure # make # make install # rlwrap -v
rlwrap 0.30
6. 使用OTK工具installManager安裝osSetup
On the one hand it does what is required from Oracle documentation and on the other hand it setups also the environment for OTK. The next bullet list shows a summary. 來自 <https://www.oratoolkit.ch/tutorials/gettingStartedV.php> # /opt/oracle/otk/current/bin/installManager osSetup osSetup11gR2.cfg
7. 把Oracle安裝文件移入資源目錄
OTK默認讀取oracle安裝文件的目錄是/var/opt/oracle/repository;
OTK的swInst實例安裝命令會讀取這個目錄:
# cd /media/oracle # chown oracle:oinstall * # mv linux.x64_11gR2_database_1of2.zip linux.x64_11gR2_database_2of2.zip /var/opt/oracle/repository/
8. 登錄Oracle用戶,修改配置文件
# su - oracle ------------------------------------------------------ oraToolKit environment variables ------------------------------------------------------ Installation directory : /opt/oracle/otk Release : 1.0.2.1.5 $RUN directory : /opt/oracle/otk/1.0/bin $LOG_BASE directory : /var/opt/oracle/otk/1.0/log ------------------------------------------------------ # vi .profile.custom.interactive
修改文件中的SITE值。
9. 安裝Oracle數(shù)據(jù)庫
OTK是用swInst安裝數(shù)據(jù)庫的,swInst的工作原理:
The main purpose of swInst action is to execute OUI in silent mode in order to install the software. However, before it can be executed it is required to unzip the file containing the software. OTK starts here and takes care also about the extraction before launching runInstaller script. 來自 <https://www.oratoolkit.ch/tutorials/gettingStartedVII.php>
用一個Shell腳本來安裝數(shù)據(jù)庫:
#bash # /opt/oracle/otk/1.0/conf/installManager 配置文件路徑 cd $INSTALL_CONF # 拷貝Oracle11gR2配置文件,Step1,2,3 cp sample/swInstEeSrv11gR2-Step[123]-linux-x86_64.cfg . # swInst 引導安裝 installManager swInst swInstEeSrv11gR2-Step1-linux-x86_64.cfg installManager swInst swInstEeSrv11gR2-Step2-linux-x86_64.cfg installManager swInst swInstEeSrv11gR2-Step3-linux-x86_64.cfg
稍等片刻,最后輸出如下信息:說明安裝成功。
----------------------------------------------------------------------------------------------------
20140419_132032: Info: Executing libinstallManager.printInfoMsg function Check in the logs if there are commands to be executed manually. -Usually /opt/oracle/sesrv/11.1.0/db1/cfgtoollogs/configToolAllCommands contains such commands -Usually /opt/oracle/sesrv/11.1.0/db1/root.sh with root privileges has to be executed in case appctl framework is not used. -Usually /opt/oracle/sesrv/11.1.0/db1/install/changePerm.sh needs to be executed when other OS users requires Oracle libraries ---------------------------------------------------------------------------------------------------- 20140419_132032: Info: Action swInst of installManager ended successfully ----------------------------------------------------------------------------------------------------
完成剩余配置,執(zhí)行root.sh命令,安裝最后需要手工執(zhí)行剩余的腳本:
# su - # /opt/oracle/eesrv/11.2.0/db1/root.sh # exit
10. 創(chuàng)建數(shù)據(jù)庫實例
OTK采用dbSetup來創(chuàng)建實例
# cd $INSTALL_CONF # ls -l dbSetup*.cfg dbSetup-dev.cfg dbSetup-prod.cfg dbSetup-test.cfg
我安裝的是開發(fā)模式(dev),我們還看到測試模式(test)和生產(chǎn)模式(prod);
修改dbSetup-dev.cfg配置文件,必須修改的配置為:
ORACLE_HOME的值:
$ORACLE_BASE/sesrv/11.1.0/db1
修改為:
$ORACLE_BASE/eesrv/11.2.0/db1
執(zhí)行安裝命令:
# installManager dbSetup dbSetup-dev.cfg
接下來會看到在安裝數(shù)據(jù)庫實例,大約十幾分鐘,最后看到如下輸出:
---------------------------------------------------------------------------------------------------- 20130419_013000: Info: Executing libmiscellaneous.getFooter function 20130419_013000: Info: Terminating installManager execution 20130419_013000: Info: Summary log file: /var/opt/oracle/otk/1.0/log-old/installManager/../installManager.log 20130419_013000: Info: Detailed log file: /var/opt/oracle/otk/1.0/log-old/installManager/dbsetup-20130522_012901.log 20130419_013000: Info: Action dbSetup of installManager ended successfully ----------------------------------------------------------------------------------------------------
Congratulations! 數(shù)據(jù)庫可以使用了。
11. 登錄SQLPLUS
# su - oracle ------------------------------------------------------ Oracle database environment variables ------------------------------------------------------ $ORACLE_HOME : /opt/oracle/eesrv/11.2.0/db1 $ORACLE_SID : dev $TNS_ADMIN : /opt/oracle/network ------------------------------------------------------ ------------------------------------------------------ oraToolKit environment variables ------------------------------------------------------ Installation directory : /opt/oracle/otk Release : 1.0.2.1.5 $RUN directory : /opt/oracle/otk/1.0/bin $LOG_BASE directory : /var/opt/oracle/otk/1.0/log ------------------------------------------------------ # sqlplus / as sysdba SQL*Plus: Release 11.2.0.1.0 Production on Sat Apr 19 11:27:47 2014 Copyright (c) 1982, 2009, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL>
查看數(shù)據(jù)庫有哪些用戶
SQL>select username from dba_users; USERNAME ------------------------------ SYSTEM SYS OTK ORACLE_OCM DBSNMP DIP OUTLN EXFSYS PERFSTAT APPQOSSYS HAPROBE 11 rows selected.
說明SQLPLUS可以使用了。
12. 使用CTL管理數(shù)據(jù)庫
OTK提供了一個通用的Oracle數(shù)據(jù)庫管理工具,它代替了Oracle的APPCTL框架。
$ ctl status all //查看當前狀態(tài)
# ctl start all //啟動數(shù)據(jù)庫
$ ctl stop all //停止數(shù)據(jù)庫
相關(guān)文章
apache 開啟重定向 rewrite的實現(xiàn)方法
這篇文章主要介紹了apache 開啟重定向 rewrite的實現(xiàn)方法的相關(guān)資料,希望通過本文能幫助到大家,讓大家實現(xiàn)這樣的功能,需要的朋友可以參考下2017-10-10淺談Linux下修改/設置環(huán)境變量JAVA_HOME的方法
這篇文章主要介紹了淺談Linux下修改/設置環(huán)境變量JAVA_HOME的方法,環(huán)境變量一般是指在操作系統(tǒng)中用來指定操作系統(tǒng)運行環(huán)境的一些參數(shù)。環(huán)境變量是在操作系統(tǒng)中一個具有特定名字的對象,它包含了一個或者多個應用程序所將使用到的信息。感興趣的可以了解一下2020-07-07linxu服務器上nginx啟動、關(guān)閉、配置檢查命令(推薦)
這篇文章主要介紹了linxu服務器上nginx啟動、關(guān)閉、配置檢查命令,文章內(nèi)容比較簡單,具有一定的參考借鑒價值,需要的朋友可以參考下2018-07-07