<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    Linux下的ORACLE安裝,成功率99.99999%

    相信很多童鞋都有過(guò)在Linux上安裝Oracle數(shù)據(jù)庫(kù)的痛苦經(jīng)歷,其中絕大多數(shù)都是環(huán)境設(shè)置的問(wèn)題。我給大家推薦一個(gè)國(guó)外大牛寫(xiě)的Oracle的安裝腳本 OTK,是用Bash寫(xiě)的,這東東大大簡(jiǎn)化了Oracle安裝過(guò)程,而且成功率達(dá)到99.9999%以上,只要確保你的Linux系統(tǒng)是干凈的,那么按照這個(gè)教程,保證你會(huì)安裝成功。

    準(zhǔn)備工作

    OTK針對(duì)各種Linux提供了 安裝文檔,本文使用的RHEL5.5_x86_64位,數(shù)據(jù)庫(kù)版本為11gR2,主要參考這個(gè) 文檔

    首先準(zhǔn)備阿好如下的安裝文件:

    下載上述文件并放在/var/tmp/oracle目錄下。最好要把你的YUM源指向你的系統(tǒng)安裝光盤(pán)或者ISO文件。

    安裝OTK

    用root登陸,執(zhí)行如下命令:

    # su - root 
    # cd /var/tmp/oracle
    # ls -1 oratool*
    oratoolkit-1.0.2.1.5-1.noarch.rpm
    # rpm -ivh oratoolkit-1.0.2.1.5-1.noarch.rpm
    Preparing... ########################################### [100%]
    1:oratoolkit ########################################### [100%]

    otk已經(jīng)幫我們建立了oracle用戶(hù),下面需要設(shè)置Oracle用戶(hù)密碼

    # passwd oracle 
    Changing password for user oracle.
    New UNIX password:
    BAD PASSWORD: it is based on a dictionary word
    Retype new UNIX password:
    passwd: all authentication tokens updated successfully.

    解決環(huán)境依賴(lài)

    這一步最爽,最為頭疼的環(huán)境依賴(lài)問(wèn)題輕松就解決了!首先要驗(yàn)證下你的系統(tǒng)還差什么沒(méi)有滿(mǎn)足要求,OTK腳本提供了智能的環(huán)境是否滿(mǎn)足檢查:

    # /opt/oracle/otk/current/bin/installManager swReqCheck osSetup11gR2.cfg 
    ...//省略大部分輸出
    20130521_165122: Info: Action swReqCheck of installManager ended with 7 WARNINGS

    最后的結(jié)論告訴你的系統(tǒng)共有幾個(gè)警告(我的系統(tǒng)是7個(gè)),你可以在輸出日志中查看到底缺了什么。下面的一組命令很酷,讓你一下子解決所有的問(wèn)題:

    //先拼裝命令 
    # 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 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
    ...
    20130521_170131: Info: Action swReqCheck of installManager ended successfully //這次驗(yàn)證成功了,環(huán)境已經(jīng)滿(mǎn)足Oracle安裝要求

    增強(qiáng)sqlplus

    OTK提供了一個(gè)優(yōu)化增強(qiáng)的sqlplus環(huán)境:

    # cd /opt/oracle/otk/current/tools/rlwrap/ 
    # ./configure
    # make
    # make install
    # /usr/local/bin/rlwrap -v
    rlwrap 0.30

    使用installManager提取安裝

    切換到/opt/oracle/otk/current/conf/installManager目錄,編輯osSetup11gR2.cfg來(lái)配置安裝參數(shù),包括內(nèi)核參數(shù)、目錄創(chuàng)建及所有授權(quán)等設(shè)置,如果你想默認(rèn)安裝就無(wú)需更改這個(gè)文件。

    # cd /opt/oracle/otk/current/conf/installManager/ 
    # vi osSetup11gR2.cfg
    # sdiff -s osSetup11gR2.cfg sample/osSetup11gR2.cfg //對(duì)比哪些參數(shù)修改過(guò)
    # /opt/oracle/otk/current/bin/installManager osSetup osSetup11gR2.cfg

    把Oracle安裝文件移入資源目錄

    otk默認(rèn)讀取oracle安裝文件的目錄是/var/opt/oracle/repository,otk的swInst實(shí)例安裝命令會(huì)讀取這個(gè)目錄:

    # cd /var/tmp/oracle 
    # chown oracle:oinstall *
    # mv linux.x64_11gR2_database_1of2.zip linux.x64_11gR2_database_2of2.zip /var/opt/oracle/repository/

    定制oracle用戶(hù)登錄的PS1變量

    這一步?jīng)]什么實(shí)際意義,就是定制Oracle用戶(hù)登錄的提示符。

    # 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
    ------------------------------------------------------
    <SITE|COMPANY>:oracle@stquist1p:sidNotSet$ grep ^SITE .profile.custom.interactive
    SITE="<SITE|COMPANY>"
    <SITE|COMPANY>:oracle@stquist1p:sidNotSet$ vi .profile.custom.interactive
    <SITE|COMPANY>:oracle@stquist1p:sidNotSet$ grep ^SITE .profile.custom.interactive
    SITE="KuuYee"http://修改這一行,可以顯示你喜歡的內(nèi)容
    <SITE|COMPANY>:oracle@stquist1p:sidNotSet$ exit
    # su - oracle
    KuuYee:oracle@stquist1p:sidNotSet$

    安裝Oracle數(shù)據(jù)庫(kù)

    OTK沒(méi)有采用Oracle Universal Installer(OUI),而是用swInst來(lái)控制整個(gè)安裝過(guò)程的:

    $ bash 
    $ cd $INSTALL_CONF
    $ cp sample/swInstEeSrv11gR2-Step1-linux-x86_64.cfg .
    $ installManager swInst swInstEeSrv11gR2-Step1-linux-x86_64.cfg
    $ su -
    # /opt/oracle/eesrv/11.2.0/db1/root.sh
    # exit

    創(chuàng)建數(shù)據(jù)庫(kù)實(shí)例

    OTK采用dbSetup來(lái)創(chuàng)建實(shí)例,首先要進(jìn)入$INSTALL_CONF目錄配置實(shí)例參數(shù)

    $ cd $INSTALL_CONF 
    $ ls -1 dbSetup*.cfg
    dbSetup-dev.cfg
    dbSetup-prod.cfg
    dbSetup-test.cfg
    $ vi dbSetup-prod.cfg //prod為生產(chǎn)模式
    $ sdiff -s dbSetup-prod.cfg sample/dbSetup-prod.cfg
    DB_NAME="idm_test" | DB_NAME="prod"
    ORACLE_HOME="$ORACLE_BASE/eesrv/11.2.0/db1" | ORACLE_HOME="$ORACLE_BASE/sesrv/11.1.0/db1"
    NLS_LANG=".AL32UTF8" | NLS_LANG=".UTF8"
    SYSTEM_SIZE=1G | SYSTEM_SIZE=512M
    TEMP_SIZE=2G | TEMP_SIZE=512M
    UNDO_SIZE=2G | UNDO_SIZE=512M
    USERS_SIZE=100M | USERS_SIZE=10M
    LISTENER_PORT="1541" | LISTENER_PORT="1531"
    MEMORY_TARGET=7G | MEMORY_TARGET=512M
    MEMORY_MAX_TARGET=7G | MEMORY_MAX_TARGET=512M
    SGA_TARGET=3G | SGA_TARGET=256M
    PROCESSES=1000 | PROCESSES=100
    $ installManager dbSetup dbSetup-prod.cfg //執(zhí)行這部之前最好先配置下/etc/hosts文件,看下面說(shuō)明

    本文采用dbSetup-prod.cfg生產(chǎn)環(huán)境模式配置,我們看到還有dev(開(kāi)發(fā)環(huán)境)和test(測(cè)試環(huán)境),不過(guò)我沒(méi)試過(guò),有興趣的童鞋可以試試。我在上面列出了我所作出的配置,原文并沒(méi)有修改內(nèi)存參數(shù),我之所以修改是因?yàn)閷?shí)際環(huán)境因?yàn)閮?nèi)存設(shè)置太小導(dǎo)致運(yùn)行一段時(shí)間數(shù)據(jù)庫(kù)經(jīng)常掛掉,經(jīng)過(guò)多次的調(diào)試而得到的經(jīng)驗(yàn)值,這里需要說(shuō)明下我的數(shù)據(jù)庫(kù)配置:
    OS:VMware虛擬機(jī)(RHEL5.5)
    CPU:8核
    內(nèi)存:32G
    硬盤(pán):200GB
    上面用sdiff -s dbSetup-prod.cfg sample/dbSetup-prod.cfg命令可以對(duì)比下我的參數(shù)修改,左面是我的修改參數(shù),右面是原參數(shù),需要特別說(shuō)明的是第二個(gè)參數(shù)ORACLE_HOME,一定要自修修改,原來(lái)的參數(shù)是$ORACLE_BASE/sesrv/11.1.0/db1,要修改為$ORACLE_BASE/eesrv/11.2.0/db1,別改錯(cuò)了!

    installManager dbSetup dbSetup-prod.cfg命令開(kāi)始安裝數(shù)據(jù)庫(kù)實(shí)例,不過(guò)我建議你最好先配置下你的/etc/hosts文件,加入下面的內(nèi)容:

    127.0.0.1    你的hostname

    接下來(lái)就是漫長(zhǎng)的等待,大概需要幾十分鐘,具體根據(jù)你的機(jī)器配置情況。如果你最后看到如下的輸出:

    ---------------------------------------------------------------------------------------------------- 
    20130522_091856: Info: Executing libmiscellaneous.getFooter function
    20130522_091856: Info: Terminating installManager execution
    20130522_091856: Info: Summary log file: /var/opt/oracle/otk/1.0/log-old/installManager/../installManager.log
    20130522_091856: Info: Detailed log file: /var/opt/oracle/otk/1.0/log-old/installManager/dbsetup-20130522_090349.log
    20130522_091856: Info: Action dbSetup of installManager ended successfully
    ----------------------------------------------------------------------------------------------------

    Congratulations!你安裝成功了。

    下面登陸試試:

    Note
    OTK默認(rèn)創(chuàng)建了一個(gè)otk用戶(hù),密碼也是otk, syssystem默認(rèn)密碼是manager
    $ bash 
    $ sourceProdEnv
    $ sqlplus sys/manager@idm_dev as sysdba;
    或者
    $ sqlplus otk/otk@idm_dev

    SQL*Plus: Release 11.2.0.1.0 Production on Wed May 22 11:05:16 2013

    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>

    使用appctl管理oracle

    OTK提供了一個(gè)ctl工具來(lái)幫我們管理Oracle實(shí)例:

    $ ctl status all //查看當(dāng)前狀態(tài) 
    $ ctl stop all //停止數(shù)據(jù)庫(kù)
    $ ctl start all //啟動(dòng)數(shù)據(jù)庫(kù)

    使用backupuManager備份oracle

    $ cd $BACKUP_CONF 
    $ vi prod.cfg
    $ sdiff -s prod.cfg sample/prod.cfg DISK_DEVICE_MOUNT_POINT="/" | DISK_DEVICE_MOUNT_POINT="/backup01"
    $ backupManager full prod.cfg

    定時(shí)備份Job

    $ crontab -l|head -2 
    # Example 1: Daily physical database backup
    # 0 2 * * * [ -d $HOME/../current ] && (ksh -c '. ./.profile >/dev/null; backupManager full <sid_1>.cfg <sid_2>.cfg <sid_n>.cfg >/dev/null')
    $ crontab -e
    $ crontab -l|head -2
    # Example 1: Daily physical database backup
    0 2 * * * [ -d $HOME/../current ] && (ksh -c '. ./.profile >/dev/null; backupManager full prod.cfg >/dev/null')

    創(chuàng)建EM管理控制臺(tái)

    otk并沒(méi)有幫我們創(chuàng)建EM控制臺(tái),對(duì)于習(xí)慣用Web管理的用戶(hù)很不方便,我們需要手工創(chuàng)建:

    $ emca -config dbcontrol db -repos recreate  

    STARTED EMCA at May 22, 2013 11:18:41 AM
    EM Configuration Assistant, Version 11.2.0.0.2 Production
    Copyright (c) 2003, 2005, Oracle. All rights reserved. Enter the following information:
    Database SID: idm_dev //輸入sid
    Listener port number: 1541 //監(jiān)聽(tīng)輸入端口
    Listener ORACLE_HOME [ /opt/oracle/eesrv/11.2.0/db1 ]: //默認(rèn)回車(chē)
    Password for SYS user: //輸入密碼manager
    Password for DBSNMP user: //輸入密碼manager
    Password for SYSMAN user: //輸入密碼manager
    Email address for notifications (optional): //默認(rèn)回車(chē)
    Outgoing Mail (SMTP) server for notifications (optional): //默認(rèn)回車(chē)
    -----------------------------------------------------------------

    You have specified the following settings

    Database ORACLE_HOME ................ /opt/oracle/eesrv/11.2.0/db1

    Local hostname ................ localhost.localdomain
    Listener ORACLE_HOME ................ /opt/oracle/eesrv/11.2.0/db1
    Listener port number ................ 1541
    Database SID ................ idm_dev
    Email address for notifications ...............
    Outgoing Mail (SMTP) server for notifications ...............

    -----------------------------------------------------------------
    Do you wish to continue? [yes(Y)/no(N)]: yes
    May 22, 2013 11:19:20 AM oracle.sysman.emcp.EMConfig perform
    INFO: This operation is being logged at /opt/oracle/cfgtoollogs/emca/idm_dev/emca_2013_05_22_11_18_40.log.
    May 22, 2013 11:19:21 AM oracle.sysman.emcp.EMReposConfig invoke
    INFO: Dropping the EM repository (this may take a while) ...
    May 22, 2013 11:19:23 AM oracle.sysman.emcp.EMReposConfig invoke
    INFO: Repository successfully dropped
    May 22, 2013 11:19:23 AM oracle.sysman.emcp.EMReposConfig createRepository
    INFO: Creating the EM repository (this may take a while) ...
    May 22, 2013 11:24:27 AM oracle.sysman.emcp.EMReposConfig invoke
    INFO: Repository successfully created
    May 22, 2013 11:24:30 AM oracle.sysman.emcp.EMReposConfig uploadConfigDataToRepository
    INFO: Uploading configuration data to EM repository (this may take a while) ... //可能會(huì)等一會(huì)
    May 22, 2013 11:25:19 AM oracle.sysman.emcp.EMReposConfig invoke
    INFO: Uploaded configuration data successfully
    May 22, 2013 11:25:23 AM oracle.sysman.emcp.util.DBControlUtil configureSoftwareLib
    INFO: Software library configured successfully.
    May 22, 2013 11:25:23 AM oracle.sysman.emcp.EMDBPostConfig configureSoftwareLibrary
    INFO: Deploying Provisioning archives ...
    May 22, 2013 11:25:45 AM oracle.sysman.emcp.EMDBPostConfig configureSoftwareLibrary
    INFO: Provisioning archives deployed successfully.
    May 22, 2013 11:25:45 AM oracle.sysman.emcp.util.DBControlUtil secureDBConsole
    INFO: Securing Database Control (this may take a while) ...
    May 22, 2013 11:25:58 AM oracle.sysman.emcp.util.DBControlUtil secureDBConsole
    INFO: Database Control secured successfully.
    May 22, 2013 11:25:58 AM oracle.sysman.emcp.util.DBControlUtil startOMS
    INFO: Starting Database Control (this may take a while) ...
    May 22, 2013 11:26:28 AM oracle.sysman.emcp.EMDBPostConfig performConfiguration
    INFO: Database Control started successfully
    May 22, 2013 11:26:28 AM oracle.sysman.emcp.EMDBPostConfig performConfiguration
    INFO: >>>>>>>>>>> The Database Control URL is https://localhost.localdomain:1158/em <<<<<<<<<<< //這個(gè)是EM的訪問(wèn)鏈接
    May 22, 2013 11:26:31 AM oracle.sysman.emcp.EMDBPostConfig invoke
    WARNING:
    ************************ WARNING ************************

    Management Repository has been placed in secure mode wherein Enterprise Manager data will be encrypted. The encryption key has been placed in the file: /opt/oracle/eesrv/11.2.0/db1/localhost.localdomain_idm_dev/sysman/config/emkey.ora. Please ensure this file is backed up as the encrypted data will become unusable if this file is lost.

    ***********************************************************
    Enterprise Manager configuration completed successfully
    FINISHED EMCA at May 22, 2013 11:26:31 AM

    OK! 大功告成,相信各位童鞋都安裝成功了,OTK的安裝還是很穩(wěn)健的,至少我安裝了幾十次都成功了!

    最后祝各位童鞋好運(yùn)!

    2013-05-21

    posted on 2013-05-24 12:27 kuuyee 閱讀(12030) 評(píng)論(5)  編輯  收藏 所屬分類(lèi): Linux數(shù)據(jù)庫(kù)系統(tǒng)管理

    評(píng)論

    # re: Linux下的ORACLE安裝,成功率99.99999% 2013-05-28 12:45 開(kāi)發(fā)吧

    學(xué)習(xí)啦,真的很不錯(cuò)!  回復(fù)  更多評(píng)論   

    # re: Linux下的ORACLE安裝,成功率99.99999%[未登錄](méi) 2013-08-08 19:36 x

    20130808_193410: Warning: Oracle software runs on CentOS however this combination is NOT supported by Oracle

    出現(xiàn)了這個(gè),還能裝不。。。  回復(fù)  更多評(píng)論   

    # re: Linux下的ORACLE安裝,成功率99.99999% 2015-09-24 06:59 天地華宇

    看不懂 才疏學(xué)淺 呵呵  回復(fù)  更多評(píng)論   

    # re: Linux下的ORACLE安裝,成功率99.99999% 2015-11-06 13:21 王新強(qiáng)

    我就是那0.00001% 的人了  回復(fù)  更多評(píng)論   

    # re: Linux下的ORACLE安裝,成功率99.99999% 2015-11-09 12:58 kuuyee

    @王新強(qiáng)
    這東西好像收費(fèi)了,所以建議使用https://github.com/biemond/biemond-oradb  回復(fù)  更多評(píng)論   

    導(dǎo)航

    <2015年11月>
    25262728293031
    1234567
    891011121314
    15161718192021
    22232425262728
    293012345

    統(tǒng)計(jì)

    隨筆分類(lèi)(139)

    Linux內(nèi)核

    搜索

    •  

    積分與排名

    • 積分 - 319320
    • 排名 - 177

    最新評(píng)論

    閱讀排行榜

    主站蜘蛛池模板: 亚洲AV永久无码精品一福利| 国产小视频在线免费| 大片免费观看92在线视频线视频| 亚洲精品91在线| 亚洲精品二区国产综合野狼 | 亚洲天堂一区二区三区| 亚洲日韩中文字幕在线播放| 免费人妻av无码专区| 免费羞羞视频网站| 亚洲一级免费视频| 外国成人网在线观看免费视频| 一级一级一片免费高清| 亚洲AV成人一区二区三区观看| 国产日本亚洲一区二区三区| 久久国产亚洲精品无码| 亚洲AV日韩AV鸥美在线观看| 在线亚洲精品自拍| 亚洲AV无码不卡在线观看下载| 女人张开腿给人桶免费视频 | 亚洲国产情侣一区二区三区| 久久久久亚洲精品影视| 亚洲精品无码久久久久sm| 亚洲国产av无码精品| 免费a在线观看播放| 免费国产成人午夜电影| 高清国语自产拍免费视频国产| 成人黄动漫画免费网站视频| 久久精品女人天堂AV免费观看| 99久久精品日本一区二区免费| 四虎最新永久免费视频| 国产91免费视频| 国产免费不卡v片在线观看| 国产又大又粗又长免费视频| 麻花传媒剧在线mv免费观看| 真人做人试看60分钟免费视频 | 亚洲成a人片在线观| 91亚洲视频在线观看| 亚洲一区二区久久| 亚洲欧好州第一的日产suv| 亚洲欧美第一成人网站7777 | 国产一区视频在线免费观看 |