每日一得

          不求多得,只求一得 about java,hibernate,spring,design,database,Ror,ruby,快速開(kāi)發(fā)
          最近關(guān)心的內(nèi)容:SSH,seam,flex,敏捷,TDD
          本站的官方站點(diǎn)是:顛覆軟件

            BlogJava :: 首頁(yè) :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理 ::
            220 隨筆 :: 9 文章 :: 421 評(píng)論 :: 0 Trackbacks

          轉(zhuǎn)自: 這里

          1. 配置RedHat AS 3

          操作系統(tǒng)版本:
          Red Hat Enterprise Linux AS release 3 (Taroon)
          Kernel 2.4.21-4.EL on an i686
          按照常規(guī)來(lái)安裝操作系統(tǒng),記得要安裝開(kāi)發(fā)工具(gcc等必要工具).

          1.1 檢查必要的硬件信息

          檢查內(nèi)容 最小值 檢查命令參考
          物理內(nèi)存 512M # grep MemTotal /proc/meminfo
          交換空間 1.0 GB或者2倍內(nèi)存大小 # grep SwapTotal /proc/meminfo
          /tmp 空間 400 MB # df -k /tmp
          軟件所需空間 2.5 GB # df -k (空間越大越好,如果是正式系統(tǒng),應(yīng)該進(jìn)行詳盡的規(guī)劃)
          數(shù)據(jù)庫(kù)文件 1.2 GB # df -k (空間越大越好,如果是正式系統(tǒng),應(yīng)該進(jìn)行詳盡的規(guī)劃)
          檢查完如上各項(xiàng)之后, 應(yīng)該修改核心參數(shù).執(zhí)行如下命令:

          #vi /etc/sysctl.conf

          #注釋:
          #表示使用root用戶(hù)操作,$表示使用oracle 用戶(hù)進(jìn)行操作.提示符后面的藍(lán)色部分表示需要輸入的命令,以下同.

          在該文件末尾加入如下內(nèi)容:
          kernel.shmall = 2097152
          kernel.shmmax = 2147483648
          kernel.shmmni = 4096
          kernel.sem = 250 32000 100 128
          fs.file-max = 65536
          net.ipv4.ip_local_port_range = 1024 65000

          編輯完之后,保存,執(zhí)行 # /sbin/sysctl -p 命令操作來(lái)使我們所做的變更生效.
          注:上面kernel.shmmax/kernel.sem等是典型的核心參數(shù)配置.您可能需要根據(jù)您的實(shí)際環(huán)境進(jìn)行適當(dāng)?shù)淖儎?dòng).

          關(guān)于這些核心參數(shù)的說(shuō)明在Oracle的 Oracle9i Installation Guide Release 2 (9.2.0.1.0) for UNIX Systems 中有很詳細(xì)的說(shuō)明.( http://download-west.oracle.com/docs/html/A96167_01/toc.htm )

          然后,應(yīng)該檢查一下上面的操作是否正確:
          # /sbin/sysctl -a | grep sem
          # /sbin/sysctl -a | grep shm
          # /sbin/sysctl -a | grep file-max
          # /sbin/sysctl -a | grep ip_local_port_range

          為Oracle用戶(hù)設(shè)定Shell的限制
          一般來(lái)說(shuō),出于性能上的考慮,還需要需要進(jìn)行如下的設(shè)定,以便改進(jìn)Oracle用戶(hù)的有關(guān) nofile(可打開(kāi)的文件描述符的最大數(shù))和nproc(單個(gè)用戶(hù)可用的最大進(jìn)程數(shù)量)

          # vi /etc/security/limits.conf
          # 添加如下的行

          *?????????????? soft??? nproc?? 2047
          *?????????????? hard??? nproc?? 16384
          *?????????????? soft??? nofile? 1024
          *?????????????? hard??? nofile? 65536

          添加如下的行到/etc/pam.d/login 文件:
          session??? required???? /lib/security/pam_limits.so

          編輯 /etc/profile 文件,添加如下部分:
          if [ $USER = "oracle" ]; then?
          ??????? if [ $SHELL = "/bin/ksh" ]; then?
          ??????????????? ulimit -p 16384?
          ??????????????? ulimit -n 65536?
          ??????? else?
          ??????????????? ulimit -u 16384 -n 65536?
          ??????? fi?
          fi
          之后,執(zhí)行$ ulimit 驗(yàn)證一下.

          1.2 檢查并安裝相關(guān)補(bǔ)丁
          在這個(gè)版本的RHEL上安裝Oracle,必須要有幾個(gè)軟件包. 確認(rèn)以下 rpm包都已經(jīng)安裝:

          make-3.79
          binutils-2.11
          openmotif-2.2.2-16
          setarch-1.3-1
          compat-db-4.0.14.5
          compat-gcc-7.3-2.96.122
          compat-gcc-c++-7.3-2.96.122
          compat-libstdc++-7.3-2.96.122
          compat-libstdc++-devel-7.3-2.96.122

          # rpm -qa | grep compat
          # 在機(jī)器上輸出如下:

          compat-gcc-c++-7.3-2.96.122
          compat-libstdc++-7.3-2.96.122
          compat-libstdc++-devel-7.3-2.96.122
          compat-glibc-7.x-2.2.4.32.5
          compat-db-4.0.14-5
          compat-gcc-7.3-2.96.122

          # rpm -qa | grep openmotif
          openmotif-devel-2.2.2-16
          openmotif-2.2.2-16

          # rpm -qa | grep setarch
          setarch-1.3-1


          上面顯示的內(nèi)容是在筆者已經(jīng)安裝了具體的RPM包之后的結(jié)果.一般情況下,你的系統(tǒng)上的輸出結(jié)果和這個(gè)不同.如果個(gè)別包沒(méi)有安裝,把系統(tǒng)安裝光盤(pán)mount上,找到具體的軟件包(大多數(shù)在第三張光盤(pán)上),然后利用如下的命令來(lái)安裝相應(yīng)的包:
          # rpm -ivh *.rpm

          要額外注意的是,這些軟件包之間是有依賴(lài)性的,先后的順序要找好.否則會(huì)報(bào)告不能安裝的錯(cuò)誤. 此外,最好驗(yàn)證一下 gcc和glibc的版本(要求是gcc-3.2.3-2 或者更高):
          #gcc -v
          #rpm -q glibc

          1.3 創(chuàng)建用戶(hù)和相關(guān)的組
          # /usr/sbin/groupadd oinstall
          # /usr/sbin/groupadd dba
          # /usr/sbin/useradd -g oinstall -G dba oracle
           

          如果只是測(cè)試目的的話,不創(chuàng)建oinstall組也沒(méi)什么. 不過(guò)還是規(guī)范一點(diǎn)比較好.如果oracle 用戶(hù)和dba組等已經(jīng)存在,作適當(dāng)?shù)恼{(diào)整即可.

          1.4 檢查并調(diào)整環(huán)境變量
          登錄為oracle用戶(hù)

          # su - oracle
          $ cd
          $ vi .bash_profile

          #添加如下內(nèi)容,你的具體值應(yīng)該不會(huì)和這個(gè)完全相同.
          export ORACLE_BASE=/oracle
          export ORACLE_HOME=$ORACLE_BASE/product/dbse
          export ORACLE_SID=orcl
          export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
          export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
          export LC_CTYPE=en_US.UTF-8

          然后執(zhí)行
          $ source .bash_profile

          使環(huán)境變量生效. /oracle 等目錄應(yīng)該建立好并做合適的授權(quán).

          2. 安裝Orale10g
          mount安裝盤(pán).由于10g無(wú)法以root安裝,以前面建的oracle用戶(hù)登錄.執(zhí)行:

          $ ./runInstaller

          按照提示安裝即可,最后還需要以root運(yùn)行兩個(gè)腳本。

          3. 配置TNS參數(shù)
          在 /oracle/product/dbse/network/admin/ 目錄下有 listener.ora 和 tnsnames.ora 兩個(gè)文件,設(shè)置如下:

          #listener.ora
          SID_LIST_LISTENER =
          ? (SID_LIST =
          ???? (SID_DESC =
          ????? (GLOBAL_DBNAME = orcl)
          ????? (ORACLE_HOME = /oracle/product/dbse)
          ????? (SID_NAME = orcl)
          ???? )
          ? )

          LISTENER =
          ? (DESCRIPTION_LIST =
          ??? (DESCRIPTION =
          ??????? (ADDRESS_LIST =
          ????? (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
          ??????? )
          ??????? (ADDRESS_LIST =
          ????? (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.100)(PORT = 1521))
          ??????? )
          ??? )
          ? )

          #tnsnames.ora
          ORCL =
          ? (DESCRIPTION =
          ??? (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.100)(PORT = 1521))
          ??? (CONNECT_DATA =
          ????? (SERVER = DEDICATED)
          ????? (SERVICE_NAME = orcl)
          ??? )
          ? )

          EXTPROC_CONNECTION_DATA =
          ? (DESCRIPTION =
          ????? (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
          ??????? (CONNECT_DATA =
          ????? (SID = PLSExtProc)
          ????? (PRESENTATION = RO)
          ??? )
          ? )

          其中SERVICE_NAME與SID_NAME一定要和.bash_profile中的ORACLE_SID相一致,否則無(wú)法啟動(dòng)

          4. 啟動(dòng)Oracle
          以oracle用戶(hù)登錄

          4.1 啟動(dòng)TNS監(jiān)聽(tīng)器
          $ lsnrctl start
          出現(xiàn)如下顯示,表示監(jiān)聽(tīng)服務(wù)成功開(kāi)啟
          LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 22-FEB-2006 10:24:03

          Copyright (c) 1991, 2005, Oracle.? All rights reserved.

          Starting /oracle/product/dbse/bin/tnslsnr: please wait...

          TNSLSNR for Linux: Version 10.2.0.1.0 - Production
          System parameter file is /oracle/product/dbse/network/admin/listener.ora
          Log messages written to /oracle/product/dbse/network/log/listener.log
          Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC)))
          Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.100)(PORT=1521)))

          Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC)))
          STATUS of the LISTENER
          ------------------------
          Alias???????????????????? LISTENER
          Version?????????????????? TNSLSNR for Linux: Version 10.2.0.1.0 - Production
          Start Date??????????????? 22-FEB-2006 10:24:03
          Uptime??????????????????? 0 days 0 hr. 0 min. 0 sec
          Trace Level?????????????? off
          Security????????????????? ON: Local OS Authentication
          SNMP????????????????????? OFF
          Listener Parameter File?? /oracle/product/dbse/network/admin/listener.ora
          Listener Log File???????? /oracle/product/dbse/network/log/listener.log
          Listening Endpoints Summary...
          ? (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC)))
          ? (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.100)(PORT=1521)))
          Services Summary...
          Service "orcl" has 1 instance(s).
          ? Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
          The command completed successfully


          4.2啟動(dòng)數(shù)據(jù)庫(kù)
          9i 之后已經(jīng)沒(méi)有 svrmgrl 了,所有的管理工作都通過(guò) sqlplus 來(lái)完成:
          $ sqlplus /nolog
          SQL> connect system/change_on_install as sysdba
          SQL> startup

          出現(xiàn)如下顯示,表示Oracle已經(jīng)成功啟動(dòng)
          ORACLE instance started.

          Total System Global Area? 285212672 bytes
          Fixed Size????????????????? 1218968 bytes
          Variable Size????????????? 88082024 bytes
          Database Buffers????????? 188743680 bytes
          Redo Buffers??????????????? 7168000 bytes
          Database mounted.
          Database opened.

          4.3 自動(dòng)啟動(dòng)與關(guān)閉

          編輯 /etc/oratab ,把所有的 instance 的重啟動(dòng)標(biāo)志設(shè)置成 'Y',如:
          orcl:/oracle/product/dbse:Y

          做一個(gè)啟動(dòng)腳本 /etc/init.d/dbora ,如下所示:

          #!/bin/sh
          # description: Oracle auto start-stop script.
          # chkconfig: - 20 80
          #
          # Set ORA_HOME to be equivalent to the $ORACLE_HOME
          # from which you wish to execute dbstart and dbshut;
          #
          # Set ORA_OWNER to the user id of the owner of the
          # Oracle database in ORA_HOME.

          ORA_HOME=/oracle/product/dbse
          ORA_OWNER=oracle
          if [ ! -f $ORA_HOME/bin/dbstart ]
          then
          echo "Oracle startup: cannot start"
          exit
          fi
          case "$1" in
          'start')

          # Start the Oracle databases:
          # The following command assumes that the oracle login
          # will not prompt the user for any values

          su - $ORA_OWNER -c $ORA_HOME/bin/dbstart
          su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl start"
          ;;
          'stop')

          # Stop the Oracle databases:
          # The following command assumes that the oracle login
          # will not prompt the user for any values

          su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl stop"
          su - $ORA_OWNER -c $ORA_HOME/bin/dbshut
          ;;
          'restart')
          $0 stop
          $0 start
          ;;
          esac

          賦予執(zhí)行權(quán)限
          chmod 750 /etc/init.d/dbora

          作成以下鏈接:
          ln -s /etc/init.d/dbora /etc/rc0.d/K10dbora
          ln -s /etc/init.d/dbora /etc/rc3.d/S99dbora


          執(zhí)行以下命令:
          chkconfig --level 345 dbora on

          這樣就OK了。下次開(kāi)關(guān)機(jī)的時(shí)候,Oracle也會(huì)隨之啟動(dòng)/停止。

          參考信息

          http://www.dbanotes.net

          posted on 2006-05-09 13:12 Alex 閱讀(921) 評(píng)論(5)  編輯  收藏 所屬分類(lèi): linuxdataBase

          評(píng)論

          # re: [轉(zhuǎn)]RHEL AS 3 安裝及啟動(dòng) Oracle10g 指南 2006-07-26 18:12 Alex
          關(guān)于 TNS-00511: 無(wú)監(jiān)聽(tīng)程序 Linux Error: 111: Connection refused
          錯(cuò)誤 :

          最后發(fā)現(xiàn)是/etc/hosts搞得鬼

          127.0.0.1 localhost.localdomain localhost
          127.0.0.1 foxlog

          改為

          127.0.0.1 localhost.localdomain localhost
          192.168.1.134 foxlog

          就OK了

            回復(fù)  更多評(píng)論
            

          # re: [轉(zhuǎn)]RHEL AS 3 安裝及啟動(dòng) Oracle10g 指南 2006-07-26 18:14 Alex
          常用命令:

          dbca:創(chuàng)建數(shù)據(jù)庫(kù)

          netca: 配置net服務(wù),監(jiān)聽(tīng)

          lsnrctl start listener1
          lsnrctl start listener2
            回復(fù)  更多評(píng)論
            

          # re: [轉(zhuǎn)]RHEL AS 3 安裝及啟動(dòng) Oracle10g 指南 2006-07-26 21:20 Alex
          how to install multi instance ?
          answer: still use the old user,such as "oracle", setup a new instance with 'dbca' command,then put the control file in /u2/oradata,
          after finish it,add a new user: such as ilearn,then add it to the group:oinstall (useradd -g oinstall -G dba ilearn)

          during the install,maybe have some permition questions,just chmod it.

          That's all.  回復(fù)  更多評(píng)論
            

          # 10g EM亂碼之快速解決 2006-08-07 10:39 Alex
          [oracle@danaly ~]$ cd $ORACLE_HOME/jdk/jre/lib
          [oracle@danaly lib]$ ls font*zh_CN*
          font.properties.zh_CN.Redhat font.properties.zh_CN.Redhat2.1
          font.properties.zh_CN.Sun font.properties.zh_CN_UTF8.Sun

          [oracle@danaly lib]$ cd $ORACLE_HOME/jre/1.4.2/lib/
          [oracle@danaly lib]$ ls font*zh_CN*
          font.properties.zh_CN.Redhat font.properties.zh_CN.Redhat2.1
          font.properties.zh_CN.Sun font.properties.zh_CN_UTF8.Sun

          我們只要用合適的中文字符集文件替換缺省文件即可,我選擇使用font.properties.zh_CN.Redhat來(lái)替換缺省字體定義文件:

          [oracle@danaly lib]$ cp font.properties.zh_CN.Redhat font.properties

          替換之后需要清理一下Cache,重啟EM即可.

          Cache路徑通常位于:

          $ORACLE_HOME/oc4j/j2ee/oc4j_applications/applications/em/em/cabo/images/cache/zhs

          清除所有g(shù)if文件即可.然后重新啟動(dòng)EM:  回復(fù)  更多評(píng)論
            

          # 插入內(nèi)容為亂碼解決辦法 2006-08-07 11:04 Alex
          主要還是在安裝的時(shí)候選擇zhs16GBK編碼。

          如果已經(jīng)安裝好,可以
          select value$ from props$ where name = 'NLS_CHARACTERSET';

          update it.  回復(fù)  更多評(píng)論
            

          主站蜘蛛池模板: 繁昌县| 安平县| 新郑市| 宝丰县| 万年县| 绥江县| 海门市| 清新县| 德惠市| 张家港市| 阳城县| 长治县| 海门市| 五莲县| 彝良县| 小金县| 辰溪县| 永城市| 丹巴县| 蓬莱市| 普陀区| 牙克石市| 洛川县| 郯城县| 桐庐县| 资阳市| 营口市| 牟定县| 七台河市| 澄江县| 承德市| 西峡县| 天气| 牡丹江市| 汉源县| 留坝县| 琼结县| 恭城| 武威市| 密云县| 保定市|