RedHat 安裝Oracle

來源:互聯網
上載者:User

版本

Linux  :RedHat 5.6

Oracle:10.2

安裝前準備

1.修改作業系統版本,oracle安裝前會驗證作業系統版本如果不認識的版本就無法安裝

  1. vi /etc/redhat-release  
  2.   
  3. #注釋掉原內容,把內容改為redhat-4  

2.建立oracle使用者

2.1建立使用者組

  1. groupadd oinstall
  2. groupadd dba  

2.2建立使用者 
  1. useradd oracle -g oinstall -G dba  
2.3建立使用者的密碼
  1. passwd oracle  
輸入兩次密碼


3.準備安裝目錄
3.1建立目錄

  1. mkdir /usr/local/src/oracle10g  
  2.   
  3. mkdir /usr/local/src/oracle10g/oradata  
3.2給oracle使用者指派目錄許可權
  1. chown -R oracle:oinstall /usr/local/src/oracle10g  
  2.   
  3. chown -R oracle:oinstall /usr/local/src/oracle10g/oradata  
  4.   
  5. chmod -R 755 /usr/local/src/oracle10g  
  6.   
  7. chmod -R 755 /usr/local/src/oracle10g/oradata  
4.切換oracle使用者
這步很重要,不要用su oracle,要登出當前的root使用者後用oracle使用者登入
5.設定oracle使用者的環境變數
5.1修改環境變數
編輯~路徑下.bash_profile
  1. vi .bash_profile  
在檔案末尾加入以下內容
  1. export PATH  
  2. export ORACLE_BASE=/usr/local/src/oracle10g  
  3. export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1  
  4. export ORACLE_SID=risespdb  
  5. export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin  
  6. export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib  
5.2生效環境變數
  1. source ~/.bash_profile  
安裝oracle
1.解壓縮

如果oracle安裝檔案為1021_database_linux32.zip

  1. unzip 10201_database_linux32.zip 10201_database_linux32  
  2. cd 10201_database_linux32  
  3. chmod a+rwx -R database  

2.運行安裝  用oracle使用者從圖形介面登入,如果當前Redhat語言環境為中文那麼安裝介面會看到亂碼,修改一下語言環境就好
  1. export LANG=en  
執行安裝,在database目錄下運行
  1. ./runInstall  
後面就是各種"下一步",直到開始安裝
安裝到最後可能會有兩個指令檔因許可權無法執行
哥們記不住確切名字了,記下這兩個檔案在哪,用root使用者登入分別到檔案所在目錄下執行
  1. ./(指令檔名).sh  

3.完成後修改檔案

  1. vi /etc/oratab  
內容改為
  1. orcl:/usr/local/src/oracle10g/product/10.2.0/db_1:Y  
注意orcl為執行個體名,要和自己資料庫的執行個體名統一

4.修改$ORACLE_HOME/bin/dbstart

  1. cd $ORACLE_HOME  
  2. cd bin  
  3. vi dbstart  
將以下內容
  1. ORACLE_HOME_LISTNER=/ade/vikrkuma_new/oracle  

更改為

  1. ORACLE_HOME_LISTNER=$ORACLE_HOME  
5.啟動資料庫
  1. ./dbstart  

6.建立oracled服務啟動指令碼

在/etc/init.d目錄下建立檔案名稱為oracled的檔案
在oracled檔案中添加如下內容(指令碼為網上搜尋非原創)

  1. #! /bin/bash  
  2. # chkconfig: - 85 15  
  3.   
  4. # description: oracle 10g is database. It is used to serve  
  5. # file : /etc/init.d/oracled  
  6.   
  7. # Run-level Startup script for the Oracle Instance, Listener, Web Interface  
  8.   
  9. export ORACLE_BASE=/usr/local/src/oracle10g  
  10. export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1  
  11. export ORACLE_SID=orcl  
  12.   
  13. ORA_OWNER="oracle"  
  14.   
  15. #if the executables do not exist ,then display error  
  16. if [ ! -f $ORACLE_HOME/bin/dbstart -o ! -d $ORACLE_HOME ]  
  17. then  
  18.     echo "oracle startup : can't start"  
  19.     exit 1  
  20. fi  
  21.   
  22. # the oracle10g database depending on parameter -- start, shutdown,restart  
  23. case "$1" in  
  24.   
  25. start)  
  26.     echo -n "starting oracle:"  
  27.     su $ORA_OWNER -c "$ORACLE_HOME/bin/dbstart"  
  28.     touch /var/lock/oracle  
  29.     echo "ok"  
  30. ;;  
  31.   
  32. stop)  
  33.     echo -n "shutdown oracle:"  
  34.     su $ORA_OWNER -c "$ORACLE_HOME/bin/dbshut"  
  35.     rm -f /var/lock/oracle  
  36.     echo "ok"  
  37. ;;  
  38.   
  39. reload|restart)  
  40. $0 stop  
  41. $0 start  
  42. ;;  
  43. *)  
  44.   
  45. echo "Usage:`basename $0` start|stop|restart|reload"  
  46. exit 1  
  47.   
  48. esac  
  49. exit 0  
7.授權檔案並添加服務
  1. cd /etc/init.d  
  2. chmod 755 oracled  
  3. chkconfig -add oracled  
  4. service oracled start  
至此算比較全面地完成

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.