在OracleLinux5.11上構建基於LVM的裸設備的Oracle10g數據庫
軟件:vmware11 操作系統: OracleLinux 5.11 x64數據庫: oracle 10.2.0.5 x64主機名: odb.test.localIP地址: 192.168.223.100 #使用的是虛擬機主機網絡 實例: odb
一、系統安裝過程略,安裝過程中選擇GNOME Desktop環境,將“Development Libraries","Development Tools","Legacy Software Development"記得選上安裝,其它根據默認即可,像JAVA、OFFICE之類的可不安裝。二、系統基本配置1.將光盤配置為本地yum安裝源[root@odb ~]# cd /etc/yum.repos.d/[root@odb yum.repos.d]# cat local.repo[local]name=localbaseurl=file:///media/cdrom/Servergpgcheck=0enable=1
2.禁用selinux、iptables服務[root@odb ~]# sed -i 's/=enforcing/=disabled/g' /etc/sysconfig/selinux
[root@odb ~]# chkconfig iptables off[root@odb ~]# chkconfig ip6tables off其它系統服務根據實際情況禁用
3.安裝oracle-validated包,進行oracle預置環境配置[root@odb ~]#yum -y install oracle-validated.x86_64
[root@odb ~]# oracle-validated-verify
執行該命令後會自動進行oracle軟件安裝所需的環境配置,如安裝缺少的包,添加sysctl配置,ulimited相關等,像oracle用戶,dba組之類的在系統安裝好後會自動創建,用這個比使用centos的方便多了[root@odb ~]# sed -i '1i\redhat 4' /etc/redhat-release
[root@odb ~]# sed -i '$a\192.168.223.100 odb.test.local odb' /etc/hosts
4.安裝rlwrap軟件(使用該軟件時可使sqlplus等增加上下翻頁歷史記錄等功能)
[root@odb ~]# tar -xf rlwrap-0.42.tar.gz -C /tmp/
[root@odb ~]# cd /tmp/rlwrap-0.42/[root@odb rlwrap-0.42]# ./configure ;make all;make install
5.安裝vmware-tools,過程略6.安裝配置vncserver[oracle@odb ~]# yum -y install vncserver
[oracle@odb ~]# cd /etc/sysconfig/[oracle@odb sysconfig]# vim vncserversVNCSERVERS="1:root"VNCSERVERARGS[1]="-geometry 1024x768 -depth 24"保存好以後配置後,[root@odb ~]# vncserver #第一次執行會提示輸入vnc的密碼,並自動在用戶目錄下生成初始配置
[root@odb ~]# cd .vnc
[root@odb .vnc]# vim xstartup#!/bin/sh
# Uncomment the following two lines for normal desktop:unset SESSION_MANAGER exec /etc/X11/xinit/xinitrc
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresourcesxsetroot -solid greyvncconfig -iconic &xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &#twm & gnome-session & 修改很容易,將上兩行紅色的去掉注釋,最後一行注釋掉,添加使用gnome-session &就行了
7.設置oracle安裝目錄,基本環境等
[root@odb ~]# mkdir -p /opt/oracle/
[root@odb ~]# chown -R oracle:oinstall /opt/oracle/
[root@odb ~]# chmod -R 775 /opt/oracle/
添加oracle環境變量[oracle@odb ~]$ su - oracle
[oracle@odb ~]$ vim .bash_profile #添加以下內容
export ORACLE_SID=odbexport ORACLE_BASE=/opt/oracleexport ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1export PATH=$PATH:$ORACLE_HOME/binexport ORACLE_TERM=xtermexport LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/libexport CLASSPATH=$ORACLE_HOME/jre:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlibalias sqlplus='rlwrap sqlplus'
alias rman='rlwrap rman'
三、Oracle數據庫軟件安裝前期工作做完了,准備正式安裝oracle數據庫了,使用vnc客戶端連接到該服務器(怎麼連接這個沒法教了,自己查資料吧),連接上後,打開一個新的terminal[root@odb ~]# xhost +access control disabled, clients can connect from any host[root@odb ~]# export DISPLAY=:1[root@odb ~]# su - oracle[oracle@odb ~]$cpio -idmv < /mnt/hgfs/Oracle/Oracle10g/linux.x64/10201_database_linux_x86_64.cpio [oracle@odb ~]$ cd database/[oracle@odb database]$ ./runInstaller後面就是圖形化的安裝過程了,也懶得講了,如果在環境檢查中有部分通不過,根據提示修改即可,安裝時選擇只安裝software即可。
安裝完後再進行補丁安裝[oracle@odb ~]$unzip /mnt/hgfs/Oracle/Oracle10g/linux.x64/p8202632_10205_Linux-x86-64.zip -d . [oracle@odb ~]$ cd Disk1/[oracle@odb Disk1]$ ./runInstaller也是圖形化界面,過程懶得說了
四、裸設備環境配置1.在線添加一塊scsi虛擬硬盤,並使用以下方法在不重啟系統時識別到
[root@odb ~]#echo "- - -" > /sys/class/scsi_host/host0/scan
2.創建卷組及相關邏輯卷[root@odb ~]# fdisk /dev/sdb #創建一個單獨的分區即可
[root@odb ~]# pvcreate /dev/sdb1
[root@odb ~]# vgcreate oradata /dev/sdb1
然後創建oracle數據庫需要的lvm邏輯卷lvcreate -L 8M -n lv_spfile oradata lvcreate -L 20M -n lv_control01 oradata lvcreate -L 20M -n lv_control02 oradata lvcreate -L 20M -n lv_control03 oradata lvcreate -L 100M -n lv_redo01 oradata lvcreate -L 100M -n lv_redo02 oradata lvcreate -L 100M -n lv_redo03 oradata lvcreate -L 1g -n lv_system01 oradata lvcreate -L 1g -n lv_sysaux01 oradata lvcreate -L 1g -n lv_users01 oradata lvcreate -L 1g -n lv_undo01 oradata lvcreate -L 1g -n lv_temp01 oradata 創建成功後使用lvscan浏覽一下[root@odb ~]# lvscan /dev/hdc: open failed: No medium found ACTIVE '/dev/oradata/lv_spfile' [8.00 MB] inherit ACTIVE '/dev/oradata/lv_control01' [20.00 MB] inherit ACTIVE '/dev/oradata/lv_control02' [20.00 MB] inherit ACTIVE '/dev/oradata/lv_control03' [20.00 MB] inherit ACTIVE '/dev/oradata/lv_redo01' [100.00 MB] inherit ACTIVE '/dev/oradata/lv_redo02' [100.00 MB] inherit ACTIVE '/dev/oradata/lv_redo03' [100.00 MB] inherit ACTIVE '/dev/oradata/lv_system01' [1.00 GB] inherit ACTIVE '/dev/oradata/lv_sysaux01' [1.00 GB] inherit ACTIVE '/dev/oradata/lv_users01' [1.00 GB] inherit ACTIVE '/dev/oradata/lv_undo01' [1.00 GB] inherit ACTIVE '/dev/oradata/lv_temp01' [1.00 GB] inherit ACTIVE '/dev/VolGroup00/LogVol00' [14.06 GB] inherit ACTIVE '/dev/VolGroup00/LogVol01' [5.81 GB] inherit3.綁定裸設備,並設置開機自動加載[root@odb ~]# vim /etc/sysconfig/rawdevices
/dev/raw/raw1 /dev/oradata/lv_spfile/dev/raw/raw2 /dev/oradata/lv_control01/dev/raw/raw3 /dev/oradata/lv_control02/dev/raw/raw4 /dev/oradata/lv_control03/dev/raw/raw5 /dev/oradata/lv_redo01/dev/raw/raw6 /dev/oradata/lv_redo02/dev/raw/raw7 /dev/oradata/lv_redo03/dev/raw/raw8 /dev/oradata/lv_sysaux01/dev/raw/raw9 /dev/oradata/lv_system01/dev/raw/raw10 /dev/oradata/lv_users01/dev/raw/raw11 /dev/oradata/lv_undo01/dev/raw/raw12 /dev/oradata/lv_temp01[root@odb ~]#chkconfig rawdevices on
[root@odb ~]#/etc/init.d/rawdevices start
[root@odb ~]# ll /dev/raw*
total 0cr--r----- 1 root root 162, 1 Jan 18 21:52 raw1cr--r----- 1 root root 162, 10 Jan 18 21:52 raw10cr--r----- 1 root root 162, 11 Jan 18 21:52 raw11cr--r----- 1 root root 162, 12 Jan 18 21:52 raw12cr--r----- 1 root root 162, 2 Jan 18 21:52 raw2cr--r----- 1 root root 162, 3 Jan 18 21:52 raw3cr--r----- 1 root root 162, 4 Jan 18 21:52 raw4cr--r----- 1 root root 162, 5 Jan 18 21:52 raw5cr--r----- 1 root root 162, 6 Jan 18 21:52 raw6cr--r----- 1 root root 162, 7 Jan 18 21:52 raw7cr--r----- 1 root root 162, 8 Jan 18 21:52 raw8cr--r----- 1 root root 162, 9 Jan 18 21:52 raw9
4.設置裸設備屬組和訪問權限(直接修改是沒用的,在重啟後會自動恢復root屬組)[root@odb ~]# vim /etc/udev/rules.d/60-raw.rules
ACTION=="add",KERNEL=="raw*",OWNER="oracle",GROUP="dba",MODE="0660"
[root@odb ~]# start_udevStarting udev: [ OK ][root@odb ~]# ll /dev/raw*crw-rw---- 1 oracle dba 162, 0 Jan 18 21:52 /dev/rawctl
/dev/raw:total 0crw-rw---- 1 oracle dba 162, 1 Jan 18 21:52 raw1crw-rw---- 1 oracle dba 162, 10 Jan 18 21:52 raw10crw-rw---- 1 oracle dba 162, 11 Jan 18 21:52 raw11crw-rw---- 1 oracle dba 162, 12 Jan 18 21:52 raw12crw-rw---- 1 oracle dba 162, 2 Jan 18 21:52 raw2crw-rw---- 1 oracle dba 162, 3 Jan 18 21:52 raw3crw-rw---- 1 oracle dba 162, 4 Jan 18 21:52 raw4crw-rw---- 1 oracle dba 162, 5 Jan 18 21:52 raw5crw-rw---- 1 oracle dba 162, 6 Jan 18 21:52 raw6crw-rw---- 1 oracle dba 162, 7 Jan 18 21:52 raw7crw-rw---- 1 oracle dba 162, 8 Jan 18 21:52 raw8crw-rw---- 1 oracle dba 162, 9 Jan 18 21:52 raw9
5.創建數據文件指向裸設備的軟連接[root@odb ~]# mkdir -p /opt/oracle/oradata/odb
ln -s /dev/raw/raw1 /opt/oracle/oradata/odb/spfileln -s /dev/raw/raw2 /opt/oracle/oradata/odb/control01ln -s /dev/raw/raw3 /opt/oracle/oradata/odb/control02ln -s /dev/raw/raw4 /opt/oracle/oradata/odb/control03ln -s /dev/raw/raw5 /opt/oracle/oradata/odb/redo01ln -s /dev/raw/raw6 /opt/oracle/oradata/odb/redo02ln -s /dev/raw/raw7 /opt/oracle/oradata/odb/redo03ln -s /dev/raw/raw8 /opt/oracle/oradata/odb/sysaux01ln -s /dev/raw/raw9 /opt/oracle/oradata/odb/system01ln -s /dev/raw/raw10 /opt/oracle/oradata/odb/users01ln -s /dev/raw/raw11 /opt/oracle/oradata/odb/undo01ln -s /dev/raw/raw12 /opt/oracle/oradata/odb/temp01創建完軟連接後,建議將這些鏈接文件的屬組和權限也改一下[root@odb ~]# chown -R oracle:oinstall /opt/oracle/oradata/odb/
[root@odb ~]# chmod -R 775 /opt/oracle/oradata/odb/
6.創建裸設備映射文件DBCA_RAW_CONFIG.txt[root@odb ~]# su - oracle[oracle@odb ~]$ vim DBCA_RAW_CONFIG.txtspfile=/opt/oracle/oradata/spfilecontrol1=/opt/oracle/oradata/odb/control01control2=/opt/oracle/oradata/odb/control02control3=/opt/oracle/oradata/odb/control03redo1_1=/opt/oracle/oradata/odb/redo01redo2_1=/opt/oracle/oradata/odb/redo02redo3_1=/opt/oracle/oradata/odb/redo03sysaux=/opt/oracle/oradata/odb/sysaux01system=/opt/oracle/oradata/odb/system01users=/opt/oracle/oradata/odb/users01undotbs1=/opt/oracle/oradata/odb/undo01temp=/opt/oracle/oradata/odb/temp01
7.先運行 netca 創建LISTENTER和TNSNAMES之類的,過程略8.運行DBCA創建數據庫[oracle@odb ~]$ export DBCA_RAW_CONFIG=/home/oracle/DBCA_RAW_CONFIG.txt
[oracle@odb ~]$ dbca
後面的安裝過程略,建議選擇自定義安裝,安裝過程中裸設備文件如果沒有到,可以手工指定軟鏈接的文件位置
以上就是基於LVM的裸設備安裝ORACLE數據庫的方法。