Centos5.3+oracle10g 安裝

本人因爲工作需要所以又開始接觸oracle10g,雖然以前瞭解也簡單的玩過oracle11g,但是對它並不熟悉,現在開始認真的接觸它。一開始接觸肯定是瞭解oracle10g的概念,然後就是安裝。這裏我簡單的介紹一下它在centos5.3 32位上的安裝。
 
一、安裝軟硬件環境介紹
 
        1、用虛擬機軟件vware
        2、內存:512M
        3、硬盤:80G
        4、系統:centos 5.3 32位
        5、oracle10g的安裝文件10201_database_linux32.zip放在/home/tmp目錄下
        oracle10g的下載地址http://apps.hi.baidu.com/share/detail/1605442
       
 
二、安裝系統是最後需要選定製安裝包,需要安裝的包有(這是我裝的時候選擇的包,如果你有別的需求可以選別的包):
 
GNOME Desktop Environment 

Editors 

Graphical Internet 

Text-based Internet 

Development Libraries 

Development Tools 

Server Configuration Tools 

Administration Tools 

Base 

System Tools 

      X Window System
       注意:在選包的時候,勾選了後下面有個包詳細選項,需要點擊這裏繼續添加包。
 
三、檢查操作系統的rpm包是否完整
         進入系統,用root用戶登陸
         #rpm -q gcc make binutils openmotif setarch compat-db compat-gcc compat-gcc-c++ compat-libstdc++
         如果缺少以上的包,在安裝光盤裏就可以找到,然後在用rpm -Uvh 包裝上就行了。
         有一些包可能在你裝系統的時候沒有裝上,你在安裝光盤裏找到,包有
         compat-db*,libaio*,compat-libstdc++-*,compat-gcc*,openmotif*,gcc*,
         glibc*
         我裝這些包用yum裝的,yum工具方便,筆者建議用yum,可以解決包的依賴性
 
vi /etc/hosts,在文件裏添加以下文件內容:
127.0.0.1               hxqm
       192.168.81.1         hxqm

 
        注意:oracle安裝隨在的服務器的IP最好是固定IP地址,這樣可以避免以後必要的麻煩,還有主機名不要隨便更改,因爲oracle已經把當前的主機名寫入到了自己的配置文件中,切忌!
 
四、建立用戶和組
 
        
[root@test-server home]# groupadd oinstall

[root@test-server home]# groupadd dba
[root@test-server home]# useradd -m -g oinstall -G dba oracle
[root@test-server home]# id oracle
uid=500(oracle) gid=500(oinstall) groups=500(oinstall),501(dba)
[root@hxqm tmp]# 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.

 
五、 創建oracle10g數據存放目錄:

mkdir -p /app/oracle/product/10.2.0/db_1

       chown -R oracle.oinstall /app
 
六、配置LINUX內核參數

[root@yjsgl rc2.d]# vi /etc/sysctl.conf

添加以下內容

kernel.shmall = 2097152

kernel.shmmax = 6442450944

kernel.shmmni = 4096

kernel.sem = 250 32000 100 128

fs.file-max = 65536

net.ipv4.ip_local_port_range = 1024 65000

net.core.rmem_default=262144

net.core.rmem_max=262144

net.core.wmem_default=262144

net.core.wmem_max=262144

運行下面命令使設置生效/sbin/sysctl p或重新啓動服務器

 
七、ORACLE用戶設置SHELL限制(Oracle 建議對每個 Linux 帳戶可以使
    用的進程數和打開的文件數設置限制

[root@test-server home]# vi /etc/security/limits.conf

添加以下內容

     oracle               soft    nproc   2047
*       oracle               hard    nproc   16384
*       oracle               soft    nofile  1024
*       oracle               hard    nofile  65536
解釋:這步是爲oracle用戶設立sheel限制。一般出於性能上的考慮還需要進行以上設置,以便改進oracle有關的onfile(可打開文件描述符的最大數)和nproc(單個用戶可用的最大進程數)。
 
八、修改/etc/pam.d/login文件,並在文件末尾添加以下內容
 
       #user for oracle
       seesion required pam_limist.so
 
        查看/etc/selinux/config文件,確保selinux爲disabled狀態
        SELINUX=disabled
 
        至於操作系統的修改就到這裏。
 
九、用oracle用戶爲安裝文件解壓縮
 
       #chown -R oracle:oinstall /home/tmp
       #su - oracle
       #cd tmp
       #unzip 10201_database_linux32.zip
 
十、設置oracle的環境變量,修改文件.bash_profile
       用oracle用戶登陸,編輯宿主目錄下的.bash_profile文件,在尾部添加一下內容:
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR
ORACLE_BASE=/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1; export ORACLE_HOME
ORACLE_SID=cadb  #cadb是實例名,這個你可以根據自己的需求填寫
export ORACLE_SID
ORACLE_TERM=xterm export ORACLE_TERM
PATH=/usr/sbin:$PATH; export PATH
PATH=$ORACLE_HOME/bin:$PATH; export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH
stty erase ^h
DISPLAY=192.168.81.1:0; export DISPLAY
 
解釋:“DISPLAY” 這是是一個監聽參數,由於我選用了xmanage工具,需要添加了這個參數,這時就不用在centos的圖像界面安裝oracle了,這樣可以爲虛擬機節省資源。可以google一下xmanage下載,查看應用。應用過程先打看你安裝好的xmanage passive,再執行圖形界面安裝的命令,如 ./runInstaller或netca或dbca 
 
編輯完.bash_profile文件後,在當前目錄下執行source .bash_profile,使當前配置的環境變量生效,如果不這樣也可以重啓系統。    
 
十一、圖形界面安裝oracle10g
         
         #su - oracle
         #cd /tmp
         #cd databases
         #./runInstaller  #然後xmanage會出現圖形界面安裝嚮導
 
         安裝圖片我會作爲附近給大家上傳,請下載看
 
十二、
 
oracle解決啓動問題
數據庫創建完成後,修改/etc/oratab,把最後一行的N改成Y。
注意:如果你想把你裝的數據庫都啓動了,你可以把最後幾行的N都改成Y,然後重啓系統,這是我係統的方式,呵呵。重啓oracle也可以。
root@lc ~]# vi /app/oracle/product/10.2.0/db_1/bin/dbstart
 # Set this to bring up Oracle Net Listener
  ORACLE_HOME_LISTNER=/ade/vikrkuma_new/oracle
 if [ ! $ORACLE_HOME_LISTNER ] ; then
  echo "ORACLE_HOME_LISTNER is not SET, unable to auto-start Oracle Net         Listener"
修改  ORACLE_HOME_LISTNER=$ORACLE_HOME
然後執行dbstart啓動數據庫
自啓動:
添加自啓動:
vi etc/rc.d/rc.local
添加:
su - oracle -c 'lsnrctl start'
su - oracle -c 'dbstart'
設置數據庫自動關閉腳本
#vi /etc/rc.d/init.d/dbshutdown

寫入內容:
su - oracle -c 'lsnrctl stop'
su - oracle -c 'dbshut'
 
保存退出。爲文件加上執行權限
chmod +x /etc/rc.d/init.d/dbshutdown

設置數據庫自動關閉服務
#ln -s /etc/rc.d/init.d/dbshutdown  /etc/rc.d/rc3.d/K04dbshutdown

 重新啓動EM服務
    cd $ORACLE_HOME/bin/
    ./emctl stop dbconsole
    ./emctl start dbconsole
   
    [oracle@koalca bin]$ ./emctl start dbconsole
TZ set to PRC
Oracle Enterprise Manager 10g Database Control Release 10.2.0.1.0 
Copyright (c) 1996, 2005 Oracle Corporation.  All rights reserved.
http://192.168.81.1:1158/em/console/aboutApplication
Agent Version     : 10.1.0.4.1
OMS Version       : Unknown
Protocol Version  : 10.1.0.2.0
Agent Home        : /app/oracle/product/10.2/db_1/koalca_cadb
Agent binaries    : /app/oracle/product/10.2/db_1
Agent Process ID  : 3240
Parent Process ID : 1753
Agent URL         : http://192.168.81.1:3938/emd/main
Started at        : 2009-12-06 00:06:58
Started by user   : oracle
Last Reload       : 2009-12-06 00:06:58
Last successful upload                       : (none)
Last attempted upload                        : (none)
Total Megabytes of XML files uploaded so far :     0.00
Number of XML files pending upload           :       10
Size of XML files pending upload(MB)         :     0.04
Available disk space on upload filesystem    :    23.22%
Agent is already started. Will restart the agent
Stopping agent ... stopped.
Starting Oracle Enterprise Manager 10g Database Control ................... started.
------------------------------------------------------------------
Logs are generated in directory /app/oracle/product/10.2/db_1/koalca_cadb/sysman/log
Oracle10g啓用isqlplus
---------------------------------------------------------------
版本:
SQL> select * from v$version;
BANNER----------------------------------------------------------------Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - ProdPL/SQL Release 10.2.0.1.0 - ProductionCORE 10.2.0.1.0 ProductionTNS for 32-bit Windows: Version 10.2.0.1.0 - ProductionNLSRTL Version 10.2.0.1.0 - Production
通過以下命令啓動和停止isqlplus服務:
isqlplusctl start
isqlplusctl stop
通過查看$ORACLE_HOME/install/portlist.ini 文件可以找到當前的isqlplus application server的監聽端口,默認是5560.
然後打開瀏覽器,輸入地址http://youserverip:5560/isqlplus就可以訪問isqlplus了
 
          
 
因爲寫文檔的時候可能有地方沒有說明清楚或遺漏了什麼,請大家原諒,謝謝
也可以一起談論技術問題,
我的郵箱是[email protected]
 
 
 
 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章