歡迎您光臨本站 註冊首頁

oracle10.2.01_x86_64_for_centos4.5實戰安裝

←手機掃碼閱讀     火星人 @ 2014-03-05 , reply:0

oracle10.2.01_x86_64_for_centos4.5實戰安裝

+++++++++++++++++++++++++++++++++++
秀脫linux實戰筆記之oracle10g篇:
下載該文章:oracle10.2.01_x86_64_for_centos4.5實戰安裝手冊.txt
聽電影-看字幕-打造欣賞電影-學習英語新模式
    QQ:    6541657
EMAIL xiutuo@gmail.com   
其他附件下載: dbstart   dbora                                                               
+++++++++++++++++++++++++++++++++++

○:安裝環境說明
---------------------------------------------------------------------
1.操作系統centos4.5,內核:2.6.9-55.EL
   ip:192.168.1.159/255.255.255.0
2.oracle版本10.2.01,即Oracle 10g Release 2 (10.2) for Linux x86_64,
    軟體包名10201_database_linux_x86_64.cpio.gz,64位版本
3.安裝路徑:/home/app/oracle/
   全局資料庫名: db01            
            SID:   db01
 資料庫字符集:簡體中文ZHS16GBK
---------------------------------------------------------------------
   
一:安裝系統
--------------------------------------------------------------------
1. 安裝centos4.5,內核:2.6.9-55.EL
  安裝方式的選項:
  ⊙   定製要安裝的軟體包(C)
  桌面選項:
  (√)   X窗口系統 (選取全部)
  (√)   GNOME桌面環境 (選取全部)
  應用程序選項:
  (   )   工程和科學 (選取默認)
  (√)   圖形化互聯網 (選取默認)
  (√)   基於文本的互聯網 (選取默認)
  ( )   辦公/生產率 (視個人情況選擇)
  伺服器選項:
  (√)   伺服器配置工具 (選取全部)
  (   )   萬維網伺服器 (視個人情況選擇)
  (   )   Windows文件伺服器 (視個人情況選擇)
  (   )   DNS伺服器 (視個人情況選擇)
     (   )   遺留服務 (視個人情況選擇)
  
  開發選項:
  (√)   開發工具   (選擇全部)
   
     (√)   原有開發工具   (全部選取)
  系統選項:
  (√)   管理工具   (選取默認)
  (   )   列印支持   (視個人情況選擇)
      特別說明,由於這樣的自定義安裝沒有安裝libaio這個軟體包
      等系統安裝完后,通過yum -y install libaio安裝libaio包   
      (在centos4.5光碟里找不到這個包,但是沒有關係,通過
        # yum -y install libaio)
-----------------------------------------------------------
2.安裝好系統后,請先檢查oracle所必要的軟體包。通過運行:
# rpm -q binutils compat-db control-center gcc
gcc-c++ glibc glibc-common gnome-libs libstdc++
libstdc++-devel make pdksh sysstat xscreensaver
確保:sysstat,libaio-i386,libaio-x86_64,libaio-devel包已安裝
通過上面的查詢少了哪些包,可以通過第一張光碟來進入Centos/Rpm目錄
rpm -ivh 軟體包名稱
或者
yum -y install 軟體包名稱
倆種方式安裝
安裝好系統后,記得做個軟連接,防止安裝到86%的時候出錯
# cd /usr/lib64/
# ln -s libstdc++.so.6 libstdc++.so.5


------------------------------------------------------------------

二:創建oracle用戶和用戶組、從屬組
------------------------------------------------------------------
/usr/sbin/groupadd oinstall
/usr/sbin/groupadd dba
/usr/sbin/useradd -m -g oinstall -G dba oracle
---------------------------------------------
id oracle    //查看相關信息,看起來類似如下:
---------------------------------------------
/usr/sbin/groupadd -g 501 oinstall
/usr/sbin/groupadd -g 502 dba
/usr/sbin/useradd -m -u 501 -g oinstall -G dba oracle
passwd oracle
------------------------------------------------
mkdir -p /home/app/oracle
chown -R oracle:oinstall /home/app/oracle
chmod -R 775 /home/app/oracle
三:設置oracle運行參數
------------------------------------------------------------------
1.設置sysctl.conf文件
------------------------------------
#vi /etc/sysctl.conf //添加一下幾行
kernel.shmall = 2097152   
kernel.shmmax = 536870912
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.wmem_default = 262144
net.core.rmem_max = 262144
net.core.wmem_max = 262144
#su - root
#sysctl -p    //使設置的值生效
-------------------------------------------------------------------
註釋:
-----------------------------------------------
在安裝oracle過程中有個檢測內核參數的過程,
請隨時留意你的默認內核參數和、oracle推薦的最基本的內核參數。
以更好的設置內核參數。
一般推薦:
kernel.shmall = 2097152   
kernel.shmmax = 536870912
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.wmem_default = 262144
net.core.rmem_max = 262144
net.core.wmem_max = 262144
---------------------------------------------
其中shmmax後面的值根據cat /proc/sys/kernel/shmmax查詢得到
(一般比查詢出來的值相等或者更大就可以了)
其中kernel.sem後面的值根據semmsl,semmns,semopm,semmni來填寫。
(一般比查詢出來的值相等或者更大就可以了)
其中file-max後面的值根據cat /proc/sys/kernel/file-max查詢得到
(一般比查詢出來的值相等或者更大就可以了)
其中ip_local_port_range後面的值根據
cat /proc/sys/kernel/ip_local_port_range查詢得到
(一般比查詢出來的值相等或者更大就可以了)
To see all kernel parameters, execute:
su - root
sysctl -a
For Oracle10g, the following kernel parameters have to
be set to values greater than or equal to the recommended
values which can be changed in the proc filesystem:
shmmax   = 2147483648  
(To verify, execute: cat /proc/sys/kernel/shmmax)
shmmni   = 4096        
(To verify, execute: cat /proc/sys/kernel/shmmni)
shmall   = 2097152     
(To verify, execute: cat /proc/sys/kernel/shmall)    (for 10g R1)
shmmin   = 1           
(To verify, execute: ipcs -lm |grep "min seg size")
shmseg   = 10         
(It's hardcoded in the kernel - the default is much higher)
semmsl   = 250         
(To verify, execute: cat /proc/sys/kernel/sem | awk '{print $1}')
semmns   = 32000      
(To verify, execute: cat /proc/sys/kernel/sem | awk '{print $2}')
semopm   = 100         
(To verify, execute: cat /proc/sys/kernel/sem | awk '{print $3}')
semmni   = 128         
(To verify, execute: cat /proc/sys/kernel/sem | awk '{print $4}')
file-max = 65536         
(To verify, execute: cat /proc/sys/fs/file-max)
ip_local_port_range = 1024 65000
                        
(To verify, execute: cat /proc/sys/net/ipv4/ip_local_port_range)

----------------------------------------------------------------
-------------------------------------------------
2.設置limits.conf
# cat >> /etc/security/limits.conf << EOF
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
EOF
-------------------------------------------------
3.設置login
# cat >> /etc/pam.d/login << EOF
session required /lib/security/pam_limits.so
EOF
------------------------------------------------
4.設置profile
# cat >> /etc/profile << EOF
if [ \$USER = "oracle" ]; then
if [ \$SHELL = "/bin/ksh" ]; then
      ulimit -p 16384
      ulimit -n 65536
else
     ulimit -u 16384 -n 65536
    fi
    umask 022
fi
EOF
--------------------------------------------------
5.設置csh.login
# cat >> /etc/csh.login << EOF
if ( \$USER == "oracle" ) then
limit maxproc 16384
limit descriptors 65536
umask 022
endif
EOF
---------------------------------------------------
6.設置rc.local
# cat >> /etc/rc.d/rc.local << EOF
modprobe hangcheck-timer hangcheck_tick=30 hangcheck_margin=180
EOF
---------------------------------------------------
三:設置oracle的環境變數
使用oracle用戶登入:
$ vi .bash_profile    //增加如下幾行
export ORACLE_BASE=/home/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
export ORACLE_SID=db01
export PATH=.:${PATH}:$HOME/bin:$ORACLE_HOME/bin
export PATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin
export PATH=${PATH}:$ORACLE_BASE/common/oracle/bin
export ORACLE_TERM=xterm
export TNS_ADMIN=$ORACLE_HOME/network/admin
export ORA_NLS10=$ORACLE_HOME/nls/data
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/lib
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib
export CLASSPATH=$ORACLE_HOME/jre
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib
export THREADS_FLAG=native
export TEMP=/tmp
export TMPDIR=/tmp
export NLS_LANG=american_america.WE8ISO8859P1
設置以上參數后,重器機器吧。
-------------------------------------------------------------------------
四:安裝oracle
1.以oracle用戶登入xwindows,進入10201_database_linux_x86_64.cpio.gz所在目錄
$ # cd /home/
$ # su -
# # gunzip 10201_database_linux_x86_64.cpio.gz
   # cpio -idcmv<10201_database_linux_x86_64.cpio
# #ls //其中database就是解壓后的oracle目錄
# # chown -R oracle:oinstall database
# # exit
$ $ sh runInstaller
  經過一小段的時間,會出現「選擇安裝方法」的信息窗口;
  點選「高級安裝(A)」,繼續安裝請單擊「下一步(N)」按鍵;
  同時「終端」窗口也會出現以下的提示信息:
  進入「指定產品清單目錄和身份證明」窗口:

  繼續安裝請單擊「下一步(N)」按鍵;
  檢查產品清單目錄和身份證明的過程如下圖:
  進入「選擇安裝類型」窗口,點選「企業版(E)(1.26GB)」,
     繼續安裝請單擊「下一步(N)」按鍵;
  進入「指定主目錄詳細信息」窗口:
  名稱(M):db01
  路徑(A):/home/oracle/oracle/product/10.2.0/db_1 (本例子使用默認路徑)
             或者:
             /oracle/product/10.2.0/db_1
  繼續安裝請單擊「下一步(N)」按鍵;
  進入「產品特定的選決條件檢查」窗口,經過一小段時間檢查,
     會出現以下的檢查信息窗口;
  在「正在檢查網路配置需要」項目內,選中狀態欄目的內容,
     繼續安裝請單擊「下一步(N)」按鍵;
  
  進入「選擇配置選項」窗口,點選「創建資料庫(C)」 ,
     繼續安裝請單擊「下一步(N)」按鍵;
  進入「選擇資料庫配置」窗口,點選「一般用途(G)」 ,
     繼續安裝請單擊「下一步(N)」按鍵;
  進入「指定資料庫配置選項」窗口:
  資料庫命名中的:
  全局資料庫名: db01             SID: db01
  資料庫字符集:
  簡體中文ZHS16GBK   
  繼續安裝請單擊「下一步(N)」按鍵;
  進入「選擇資料庫管理選項」窗口,點選「使用Database Control管理資料庫」,
     繼續安裝請單擊「下一步(N)」按鍵;
  進入「指定資料庫存儲選項」窗口,點選「文件系統」:
  指定資料庫文件位置:/home/oracle/oracle/product/10.2.0/oradta/
  繼續安裝請單擊「下一步(N)」按鍵;
  進入「指定備份和恢複選項」窗口,點選「不啟用自動備份」,
     繼續安裝請單擊「下一步(N)」按鍵;
  進入「指定資料庫方案的口令」窗口:
  點選「所有的帳戶都使用同一個口令」:
  輸入口令: 1234567         確認口令: 1234567
  口令處理過程如下圖,繼續安裝請單擊「下一步(N)」按鍵;
  進入「概要信息」窗口,繼續安裝請單擊「下一步(N)」按鍵;
  進入「安裝」窗口,詳細安裝如下圖片;
  A、安裝部分圖片;
  
  B、複製文件部分;
  C、連接數據系統部分;
  D、設置數據系統部分;
  進入「配置助手」窗口:
  配置:Oracle Net Configuration Assistant
  配置:Oracle Database Configuration Assistant時:
  會出現「Database Configuration Assistant」新窗口,詳細配置過程:
  A、正在複製資料庫文件;
  B、正在創建並啟動Oracle實例;
  C、正在進行資料庫創建;
  完成以上三個部分,會出現一個資料庫創建完成信息提示窗口,點擊「確定」按鍵
  配置:iSQL*Plus配置輔助程序
  配置過程中,會出現一個執行配置腳本信息提示窗口,詳細信息如下圖:
  執行orainstRoot.sh腳本的詳細過程:
  點擊「任務欄」 → 「應用程序」 → 「系統工具」   → 「終端」:
  轉換用戶和執行orainstRoot.sh腳本的詳細過程:
  詳細操作:
  $ su root (轉換成root超級用戶環境)
  Password:   123456(輸入root用戶的密碼)
  # /home/app/oracle/oraInventory/orainstRoot.sh (輸入執行腳本的詳細路徑)
  執行root.sh腳本的詳細過程:
  詳細操作:
  # /home/app/oracle/product/10.2.0/db_1/root.sh (輸入執行腳本的詳細路徑)
  執行完成orainstRoot.sh、root.sh腳本后,關閉「超級用戶的終端」,
     回到「執行配置腳本」提示窗口,繼續安裝請單擊「確定」按鍵;
  進入「安裝結束」窗口,退出安裝程序請單擊「退出(X)」按鍵;
------------------------------------------------------------------------------
六:啟動資料庫
以oracle用戶登入
1.啟動listener
   $ lsnrctl start|stop
2.啟動資料庫
   $ sqlplus /nolog
   >conn /as sysdba
   >startup     //啟動
   >shutdown    //關閉
   >alter user system identified by 密碼; //修改ys,system,systeman密碼,記得結尾有分號
   >alter user sys identified by 密碼;
   >alter user systeman identified by 密碼;
   >select username,password from dba_users;
五:安裝時出現的錯誤
#--------------------------
#安裝錯誤:
#
#用DBCA創建資料庫時,出現ora-12547 tns lost contact錯誤
#
#已解決:安裝libaio的x86包和libaio包
在centos4.5光碟里找不到這個包,但是沒有關係,通過
# yum -y install libaio
#命令安裝即可
#---------------------------

七:開機自動啟動資料庫
使用倆個腳本:
    dbstart啟動資料庫
    dbshut關閉資料庫
1.創建/etc/orata文件
用root用戶登入,編輯/etc/orata文件
# vi /etc/oratab
SID:ORACLE_HOME:{Y|N|W}
改成
SID:ORACLE_HOME:Y
---------------------------------------------------------
註釋:
如果有多個資料庫實列,需要多增加幾條
SID:ORACLE_HOME:Y
In this example, the values Y and N specify whether you want the scripts
to start up or shut down the database, respectively. For each database
for which you want to automate shutdown and startup,
first determine the instance identifier (SID) for that database,
which is identified by the SID in the first field.
Then, change the last field for each to Y.
You can set dbstart to autostart a single-instance database that uses
an Automatic Storage Management installation that is auto-started by
Oracle Clusterware. This is the default behavior for an Automatic
Storage Management cluster. If you want to do this, then you must
change the oratab entry of the database and the Automatic Storage
Management installation to use a third field with the value W and N,
respectively. These values specify that dbstart auto-starts the
database only after the Automatic Storage Management instance is started.
Note:
If you add new database instances to the system and if you want to
automate startup for them, then you must edit the entries for those
instances in the oratab file.Change directory to one of
the following depending on your operating system.
------------------------------------------------------------
2.創建開機啟動腳本/etc/init.d/dbora文件
Linux and Solaris平台初始化目錄 /etc/init.d
在此目錄下增加一個dbora文件,並增加以下內容
#!/bin/bash
#/etc/init.d/dbora
#開機啟動需要建立相關連接
# ln -s /etc/init.d/dbora /etc/rc.d/rc3.d/K01dbora
# ln -s /etc/init.d/dbora /etc/rc.d/rc3.d/S99dbora
# ln -s /etc/init.d/dbora /etc/rc.d/rc5.d/K01dbora
# ln -s /etc/init.d/dbora /etc/rc.d/rc5.d/S99dbora
# description: init script to start/stop oracle database 10g, TNS listener, EMS
#
#
#改成oracle安裝路徑
export ORACLE_HOME=/home/app/oracle/product/10.2.0/db_1
#
export ORACLE_SID=db01
export PATH=$PATH:$ORACLE_HOME/bin
ORA_OWNR="oracle"
# Check if the oracle installed
# Warning: if $ORACLE_HOME dir not accessiable for other user
# this will get the wrong result!
if [ ! -f $ORACLE_HOME/bin/dbstart -o ! -d $ORACLE_HOME ]
then
echo "Oracle startup: Cannot start"
exit 1
fi
# depending on parameter -- startup, shutdown restart
case "$1" in
start)
#Oracle listenner and instance startup
echo -n "Starting Oracle: "
su $ORA_OWNR -c $ORACLE_HOME/bin/dbstart
touch /var/lock/oracle
#su $ORA_OWNR -c "$ORACLE_HOME/bin/isqlplusctl start"
#su $ORA_OWNR -c "$ORACLE_HOME/bin/emctl start dbconsole"
echo "OK"
;;
stop)
#Oracle listener and instance shutdown
echo -n "Shutdown Oracle: "
su $ORA_OWNR -c $ORACLE_HOME/bin/dbshut
su $ORA_OWNR -c "$ORACLE_HOME/bin/lsnrctl stop LISTENER"
rm -f /var/lock/oracle
#su $ORA_OWNR -c "$ORACLE_HOME/bin/isqlplusctl stop"
#su $ORA_OWNR -c "$ORACLE_HOME/bin/emctl stop dbconsole"
echo "OK"
;;
reload|restart)
$0 stop
$0 start
;;
*)
echo "Usage: `basename $0` start|stop|reload|restart"
exit 1
esac
exit 0
#
----------------------------------------------------------------
註釋:這個腳本只能用來停止Oracle Net listener,
因為oralce用戶的密碼沒有設置,如果listener name不是默認的值的話,
你必須在stop 和 start命令里指定listener name,如:
$ORACLE_HOME/bin/lsnrctl {start|stop} listener_name
----------------------------------------------------------------
改變dbora的所屬組為dba,設置dbora的許可權750
# chgrp dba dbora
# chmod 750 dbora
建立軟連接
Linux
# ln -s /etc/init.d/dbora /etc/rc.d/rc3.d/K01dbora
# ln -s /etc/init.d/dbora /etc/rc.d/rc3.d/S99dbora
# ln -s /etc/init.d/dbora /etc/rc.d/rc5.d/K01dbora
# ln -s /etc/init.d/dbora /etc/rc.d/rc5.d/S99dbora
當測試/etc/init.d/dbora start出現Oracle startup: Cannot start時,
請修改dbora腳本中export ORACLE_HOME=后的oracle安裝路徑。
由於該dbora腳本是調用dbstart,dbshut這倆個腳本來啟動,關閉資料庫的,
所以必須先測試dbstart和dbshut,測試方法:
切換到oracle用戶:
# su - oracle
$ dbstart
或者
---------------------------------------
//切換到oracle安裝目錄的bin目錄
$ cd /home/app/oracle/product/10.2.0/db_1/bin/
$./dbstart
---------------------------------------
如果出現:
Failed to auto-start Oracle Net Listene using
/ade/vikrkuma_new/oracle/bin/tnslsnr
解決方法:
$ cd /home/app/oracle/product/10.2.0/db_1/bin/
$ vi dbstart
修改 ORACLE_HOME_LISTNER=/ade/vikrkuma_new/oracle 為
ORACLE_HOME_LISTNER=$ORACLE_HOME
附件:本文實踐的正確的dbora,和dbstart文件
dbora(/etc/init.d/dbora)
dbstart(/home/app/oracle/product/10.2.0/db_1/bin/dbstart)

[ 本帖最後由 xiutuo 於 2007-6-22 23:46 編輯 ]
《解決方案》

不錯的東西。學習一下。

不錯的東西。學習一下。
順便問一據4.4和4.5有什麼區別嗎?
內核是一樣的吧?

[火星人 ] oracle10.2.01_x86_64_for_centos4.5實戰安裝已經有607次圍觀

http://coctec.com/docs/service/show-post-38037.html