Linux+php+apache+oracle環(huán)境搭建之CentOS下安裝Oracle數(shù)據(jù)庫(kù)
這里推薦使用OTK腳本安裝Oracle,會(huì)大大提高安裝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. 來(lái)自 <http://sourceforge.net/projects/oratoolkit/?source=navbar>
一,安裝Oracle約束
1、內(nèi)存要求
最小內(nèi)存1G,推薦2G或2G以上
2、swap大小設(shè)定
1GB跟2GB物理內(nèi)存之間的,設(shè)定swap大小為物理內(nèi)存的1.5倍
2GB跟16GB物理內(nèi)存之間的,設(shè)置swap大小與物理內(nèi)存相等
16GB物理內(nèi)存以上的,設(shè)置swap大小為16GB
3、共享內(nèi)存/dev/shm要求
至少比在每個(gè)oracle實(shí)例中的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
下載這三個(gè)文件,放在/media/oracle目錄下。
2. 安裝OTK
root用戶登錄
把oratoolkit-1.0.2.1.5-1.noarch.rpm安裝包移動(dòng)到y(tǒng)um本地?cái)?shù)據(jù)源文件夾/Media/Packages下
在Packages下執(zhí)行安裝命令
# yum -y install oratoolkit*
3. 修改Oracle用戶密碼
OTK已經(jīng)幫我們建立了oracle用戶,下面需要設(shè)置oracle用戶密碼
# passwd oracle
4. 檢查環(huán)境依賴關(guān)系工具swReqCheck
OTK提供了智能檢查環(huán)境依賴關(guān)系,即檢查L(zhǎng)inux系統(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個(gè)WARNINGS。
其中43個(gè)缺少的安裝包,一個(gè)可忽略的WARNING:
# 20140419_011022: Warning: Oracle software runs on CentOS however this combination is NOT supported by Oracle
安裝必須安裝的安裝包:用一個(gè)Shell腳本來(lái)解決問(wèn)題,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
剩下一個(gè)可忽略的警告。說(shuō)明環(huán)境已經(jīng)滿足Oracle安裝了。
5. 編譯安裝rlwrap(增強(qiáng)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. 來(lái)自 <http://utopia.knoware.nl/~hlub/uck/rlwrap/>
OTK集成了rlwrap工具
rlwrap增強(qiáng)了SQLPLUS的執(zhí)行命令歷史記錄和自動(dòng)完成功能
編譯安裝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. 來(lái)自 <https://www.oratoolkit.ch/tutorials/gettingStartedV.php> # /opt/oracle/otk/current/bin/installManager osSetup osSetup11gR2.cfg
7. 把Oracle安裝文件移入資源目錄
OTK默認(rèn)讀取oracle安裝文件的目錄是/var/opt/oracle/repository;
OTK的swInst實(shí)例安裝命令會(huì)讀取這個(gè)目錄:
# 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ù)庫(kù)
OTK是用swInst安裝數(shù)據(jù)庫(kù)的,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. 來(lái)自 <https://www.oratoolkit.ch/tutorials/gettingStartedVII.php>
用一個(gè)Shell腳本來(lái)安裝數(shù)據(jù)庫(kù):
#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 引導(dǎo)安裝 installManager swInst swInstEeSrv11gR2-Step1-linux-x86_64.cfg installManager swInst swInstEeSrv11gR2-Step2-linux-x86_64.cfg installManager swInst swInstEeSrv11gR2-Step3-linux-x86_64.cfg
稍等片刻,最后輸出如下信息:說(shuō)明安裝成功。
----------------------------------------------------------------------------------------------------
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ù)庫(kù)實(shí)例
OTK采用dbSetup來(lái)創(chuàng)建實(shí)例
# cd $INSTALL_CONF # ls -l dbSetup*.cfg dbSetup-dev.cfg dbSetup-prod.cfg dbSetup-test.cfg
我安裝的是開(kāi)發(fā)模式(dev),我們還看到測(cè)試模式(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
接下來(lái)會(huì)看到在安裝數(shù)據(jù)庫(kù)實(shí)例,大約十幾分鐘,最后看到如下輸出:
---------------------------------------------------------------------------------------------------- 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ù)庫(kù)可以使用了。
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ù)庫(kù)有哪些用戶
SQL>select username from dba_users; USERNAME ------------------------------ SYSTEM SYS OTK ORACLE_OCM DBSNMP DIP OUTLN EXFSYS PERFSTAT APPQOSSYS HAPROBE 11 rows selected.
說(shuō)明SQLPLUS可以使用了。
12. 使用CTL管理數(shù)據(jù)庫(kù)
OTK提供了一個(gè)通用的Oracle數(shù)據(jù)庫(kù)管理工具,它代替了Oracle的APPCTL框架。
$ ctl status all //查看當(dāng)前狀態(tài)
# ctl start all //啟動(dòng)數(shù)據(jù)庫(kù)
$ ctl stop all //停止數(shù)據(jù)庫(kù)
相關(guān)文章
apache 開(kāi)啟重定向 rewrite的實(shí)現(xiàn)方法
這篇文章主要介紹了apache 開(kāi)啟重定向 rewrite的實(shí)現(xiàn)方法的相關(guān)資料,希望通過(guò)本文能幫助到大家,讓大家實(shí)現(xiàn)這樣的功能,需要的朋友可以參考下2017-10-10解決Linux系統(tǒng)切換用戶后只顯示$問(wèn)題
當(dāng)我們?cè)谑褂肔inux系統(tǒng)切換用戶后只顯示$,所以本文將給大家詳細(xì)介紹一下如何解決Linux系統(tǒng)切換用戶后只顯示$問(wèn)題,文中有詳細(xì)問(wèn)題分析和解決方案,需要的朋友可以參考下2023-10-10淺談Linux下修改/設(shè)置環(huán)境變量JAVA_HOME的方法
這篇文章主要介紹了淺談Linux下修改/設(shè)置環(huán)境變量JAVA_HOME的方法,環(huán)境變量一般是指在操作系統(tǒng)中用來(lái)指定操作系統(tǒng)運(yùn)行環(huán)境的一些參數(shù)。環(huán)境變量是在操作系統(tǒng)中一個(gè)具有特定名字的對(duì)象,它包含了一個(gè)或者多個(gè)應(yīng)用程序所將使用到的信息。感興趣的可以了解一下2020-07-07linux下mysql數(shù)據(jù)庫(kù)的操作的方法
下面小編就為大家?guī)?lái)一篇linux下mysql數(shù)據(jù)庫(kù)的操作的方法。小編覺(jué)得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2017-01-01linxu服務(wù)器上nginx啟動(dòng)、關(guān)閉、配置檢查命令(推薦)
這篇文章主要介紹了linxu服務(wù)器上nginx啟動(dòng)、關(guān)閉、配置檢查命令,文章內(nèi)容比較簡(jiǎn)單,具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2018-07-07Apache 虛擬目錄和默認(rèn)首頁(yè)的設(shè)置
Apache虛擬目錄和默認(rèn)首頁(yè)的設(shè)置,用apache做服務(wù)器的朋友必須要懂的。2009-11-11