Home >php教程 >php手册 >在OracleLinux5.11上构建基于LVM的裸设备的Oracle10g数据库

在OracleLinux5.11上构建基于LVM的裸设备的Oracle10g数据库

WBOY
WBOYOriginal
2016-06-13 08:47:321303browse

在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 安装完后再进行补丁安装[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数据库的方法。










Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn