您好,登錄后才能下訂單哦!
這篇文章主要介紹“CentOS下怎么安裝Oracle數據庫”的相關知識,小編通過實際案例向大家展示操作過程,操作方法簡單快捷,實用性強,希望這篇“CentOS下怎么安裝Oracle數據庫”文章能幫助大家解決問題。
這里推薦使用otk腳本安裝oracle,會大大提高安裝oracle的成功系數。
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、內存要求
最小內存1g,推薦2g或2g以上
2、swap大小設定
1gb跟2gb物理內存之間的,設定swap大小為物理內存的1.5倍
2gb跟16gb物理內存之間的,設置swap大小與物理內存相等
16gb物理內存以上的,設置swap大小為16gb
3、共享內存/dev/shm要求
至少比在每個oracle實例中的memory_max_target和memory_target要大。
4、/tmp空間大小要求
至少1gb空間
5、硬盤大小要求
存放oracle軟件文件和數據文件的空間至少10gb
6、操作系統
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安裝包移動到yum本地數據源文件夾/media/packages下
在packages下執行安裝命令
# yum -y install oratoolkit*
3. 修改oracle用戶密碼
otk已經幫我們建立了oracle用戶,下面需要設置oracle用戶密碼
# passwd oracle
4. 檢查環境依賴關系工具swreqcheck
otk提供了智能檢查環境依賴關系,即檢查linux系統還有什么不滿足的條件,比如缺少安裝包。
# /opt/oracle/otk/current/bin/installmanager swreqcheck ossetup11gr2.cfg .. .. .. 20140419_010832: info: action swreqcheck of installmanager ended with 44 warnings
我的系統安裝的是centos 6.5 64bit - basic server,新系統缺少的安裝包較多,檢查出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 #執行命令 $yum_command #再次執行環境檢查 /opt/oracle/otk/current/bin/installmanager swreqcheck ossetup11gr2.cfg
再次檢查結果:
# 20130521_170131: info: action swreqcheck of installmanager with one warning
剩下一個可忽略的警告。說明環境已經滿足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的執行命令歷史記錄和自動完成功能
編譯安裝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數據庫
otk是用swinst安裝數據庫的,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腳本來安裝數據庫:
#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 ----------------------------------------------------------------------------------------------------
完成剩余配置,執行root.sh命令,安裝最后需要手工執行剩余的腳本:
# su - # /opt/oracle/eesrv/11.2.0/db1/root.sh # exit
10. 創建數據庫實例
otk采用dbsetup來創建實例
# cd $install_conf # ls -l dbsetup*.cfg dbsetup-dev.cfg dbsetup-prod.cfg dbsetup-test.cfg
我安裝的是開發模式(dev),我們還看到測試模式(test)和生產模式(prod);
修改dbsetup-dev.cfg配置文件,必須修改的配置為:
oracle_home的值:
$oracle_base/sesrv/11.1.0/db1
修改為:
$oracle_base/eesrv/11.2.0/db1
執行安裝命令:
# installmanager dbsetup dbsetup-dev.cfg
接下來會看到在安裝數據庫實例,大約十幾分鐘,最后看到如下輸出:
---------------------------------------------------------------------------------------------------- 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! 數據庫可以使用了。
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>
查看數據庫有哪些用戶
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管理數據庫
otk提供了一個通用的oracle數據庫管理工具,它代替了oracle的appctl框架。
$ ctl status all //查看當前狀態
# ctl start all //啟動數據庫
$ ctl stop all //停止數據庫
關于“CentOS下怎么安裝Oracle數據庫”的內容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業相關的知識,可以關注億速云行業資訊頻道,小編每天都會為大家更新不同的知識點。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。