---------------------------------------------------------------
参考文档:
http://space.itpub.net/519536/viewspace-557694
http://www.lupaworld.com/home-space-do-blog-uid-26777-id-214009.html
使用 VMware Server 在 Oracle Enterprise Linux 上安装 Oracle RAC 10g
---------------------------------------------------------------
http://wenku.baidu.com/view/6e279dfaaef8941ea76e0521.html
iMB环境: Linux AS 4.0 , 2.6.9-42.ELsmp
Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit
1. 存储管理基本知识
PV(物理卷): 可以是单独磁盘也可以是逻辑上的集合比如/dev/sda1 (RAID之后).
VG/PE(卷组): 卷组的基本单位是PE .
LV/LE: 在卷组中创建逻辑卷,逻辑卷的基本单位是LE .
2. 使用裸设备 - 实战
系统重新启动后raw的属组会改变,所以需要修改以下文件的内容:
imbsmt1$pwd
/etc/udev/permissions.d
imbsmt1$vi 50-udev.permissions
# raw devices
ram*:root:disk:0660
# raw/*:root:disk:0660
raw/*:oracle:dba:0660
备注:
修改 /etc/udev/permissions.d/50-udev.permissions。原始设备在引导时会重新映射。
默认情况下,在引导时原始设备的拥有者将更改为root用户。如果拥有者不是 oracle
用户,则Oracle在访问共享磁盘分区时会出现问题。
在 /etc/udev/permissions.d/50-udev.permissions 中为原始行“raw/*:root:disk:0660”
添加注释,然后添加一个新行“raw/*:oracle:dba:0660” (如上)。
3. 磁盘分区创建PV
#fdisk /dev/sdb 划分好分区后:
在分区的基础上创建物理卷PV
#pvcreate /dev/sdb1 /dev/sdb2
4. 创建VG
在PV的基础上创建卷组,语法:vgcreate vgname pvname .
[root@pridb dev]# vgcreate datavg /dev/sdb1 /dev/sdb2
Volume group "datavg" successfully created
4. 创建LV
在VG中创建逻辑卷,语法: lvcreate -n lvname -L size vgname .
[root@pridb dev]# lvcreate -n system -L 800m datavg
[root@pridb dev]# lvcreate -n sysaux -L 700m datavg
[root@pridb dev]# lvcreate -n users -L 50m datavg
[root@pridb dev]# lvcreate -n undotbs1 -L 2000m datavg
[root@pridb dev]# lvcreate -n temp -L 2000m datavg
[root@pridb dev]# lvcreate -n spfile -L 10m datavg
[root@pridb dev]# lvcreate -n control1 -L 100m datavg
[root@pridb dev]# lvcreate -n control2 -L 100m datavg
[root@pridb dev]# lvcreate -n control3 -L 100m datavg
[root@pridb dev]# lvcreate -n redo1 -L 50m datavg
[root@pridb dev]# lvcreate -n redo2 -L 50m datavg
[root@pridb dev]# lvcreate -n redo3 -L 50m datavg
创建完成后,可以在 /dev/datavg及/dev/mapper 下看到新创建的lv信息。
备注: 删除lv的命令类似
# lvremove /dev/datavg/sysaux
5. 创建裸设备(可以写在shell脚本中批量执行)
备注: raw命令为
# raw /dev/raw/raw1 /dev/mapper/datavg-control1
# raw /dev/raw/raw2 /dev/mapper/datavg-control2
# raw /dev/raw/raw3 /dev/mapper/datavg-control3
# raw /dev/raw/raw4 /dev/mapper/datavg-redo1
# raw /dev/raw/raw5 /dev/mapper/datavg-redo2
# raw /dev/raw/raw6 /dev/mapper/datavg-redo3
# raw /dev/raw/raw7 /dev/mapper/datavg-spfile
# raw /dev/raw/raw8 /dev/mapper/datavg-sysaux
# raw /dev/raw/raw9 /dev/mapper/datavg-system
# raw /dev/raw/raw10 /dev/mapper/datavg-temp
# raw /dev/raw/raw11 /dev/mapper/datavg-undotbs1
# raw /dev/raw/raw12 /dev/mapper/datavg-users
备注: 如果想删除创建的raw, 可以 # raw /dev/rawxx
5. 系统重启自动挂载raw
修改/etc/sysconfig/rawdevices 文件,使系统重启后可自动挂载裸设备。
/dev/raw/raw1 /dev/mapper/datavg-control1
/dev/raw/raw2 /dev/mapper/datavg-control2
....
6. 修改raw的权限
在linux中,会在/dev下存在3个目录:
a. /dev/raw 裸设备目录
b. /dev/mapper/ 裸设备对应的块设备目录
c. /dev/datavg/ 裸设备和块设备的链接文件目录
修改以上3个目录的权限后,Oracle才能使用。 因为上面已经设置了
raw/*:oracle:dba:0660 ,此处就不需要执行了。 但如果权限不正确,
可以将 /dev/raw下的裸设备文件属组修改为oracle的,其他两个目录
可以不做修改。
7. 创建Oracle数据文件
创建oracle的数据文件和参数文件,软连接文件,对应到每一个裸设备文件,编辑
oracle逻辑文件名与raw的映射文件, 批量处理。
# ln -s /dev/raw/raw1 /u01/app/oracle/oradata/orcl/control1.ctl
# ln -s /dev/raw/raw2 /u01/app/oracle/oradata/orcl/control2.ctl
# ln -s /dev/raw/raw3 /u01/app/oracle/oradata/orcl/control3.ctl
# ln -s /dev/raw/raw4 /u01/app/oracle/oradata/orcl/redo1.ctl
# ln -s /dev/raw/raw5 /u01/app/oracle/oradata/orcl/redo2.ctl
# ln -s /dev/raw/raw6 /u01/app/oracle/oradata/orcl/redo3.ctl
# ln -s /dev/raw/raw7 /u01/app/oracle/oradata/orcl/system.ctl
# ln -s /dev/raw/raw8 /u01/app/oracle/oradata/orcl/sysaux.ctl
......
iMB 相关信息:
-------------------------------------------------------------------------------------------
imbsmt1$cat rc.local | more
#!/bin/sh
#
# This script. will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style. init stuff.
touch /var/lock/subsys/local
route add -net 10.0.0.0 netmask 255.0.0.0 gw 10.160.16.1 dev eth0
/usr/sbin/ntpdate -us 10.161.8.200;hwclock -w
vgscan ---- 扫描并显示系统中的卷组
vgchange -a y ---- 激活VG
/usr/bin/raw /dev/raw/raw1 /dev/pv/lvol1
/usr/bin/raw /dev/raw/raw2 /dev/pv/lvol2
/usr/bin/raw /dev/raw/raw3 /dev/pv/lvol3
/usr/bin/raw /dev/raw/raw4 /dev/pv/lvol4
/usr/bin/raw /dev/raw/raw5 /dev/pv/lvol5
/usr/bin/raw /dev/raw/raw6 /dev/pv/lvol6
/usr/bin/raw /dev/raw/raw7 /dev/pv/lvol7
/bin/chmod 600 /dev/raw/raw1
/bin/chmod 600 /dev/raw/raw2
/bin/chmod 600 /dev/raw/raw3
/bin/chmod 600 /dev/raw/raw4
/bin/chmod 600 /dev/raw/raw5
/bin/chmod 600 /dev/raw/raw6
/bin/chmod 600 /dev/raw/raw7
/bin/chown oracle.dba /dev/raw/raw1
/bin/chown oracle.dba /dev/raw/raw2
/bin/chown oracle.dba /dev/raw/raw3
/bin/chown oracle.dba /dev/raw/raw4
/bin/chown oracle.dba /dev/raw/raw5
/bin/chown oracle.dba /dev/raw/raw6
/bin/chown oracle.dba /dev/raw/raw7
ln -s /dev/raw/raw1 /opt/oracle/oradata/smt/CMQuorumFile
ln -s /dev/raw/raw2 /opt/oracle/oradata/smt/SharedSrvctlConfigFile
ln -s /dev/raw/raw3 /opt/oracle/oradata/smt/spfilesmt.ora
ln -s /dev/raw/raw4 /opt/oracle/oradata/smt/control01.ctl
ln -s /dev/raw/raw5 /opt/oracle/oradata/smt/control02.ctl
ln -s /dev/raw/raw6 /opt/oracle/oradata/smt/control03.ctl
ln -s /dev/raw/raw7 /opt/oracle/oradata/smt/indx01.dbf
ln -s /dev/raw/raw8 /opt/oracle/oradata/smt/system01.dbf
ln -s /dev/raw/raw9 /opt/oracle/oradata/smt/temp01.dbf
ln -s /dev/raw/raw10 /opt/oracle/oradata/smt/tools01.dbf
ln -s /dev/raw/raw11 /opt/oracle/oradata/smt/undotbs01.dbf
ln -s /dev/raw/raw12 /opt/oracle/oradata/smt/undotbs02.dbf
ln -s /dev/raw/raw13 /opt/oracle/oradata/smt/undotbs03.dbf
ln -s /dev/raw/raw14 /opt/oracle/oradata/smt/users01.dbf
ln -s /dev/raw/raw15 /opt/oracle/oradata/smt/xdb01.dbf
ln -s /dev/raw/raw16 /opt/oracle/oradata/smt/perfstat01.dbf
ln -s /dev/raw/raw17 /opt/oracle/oradata/smt/cwmlite01.dbf
ln -s /dev/raw/raw18 /opt/oracle/oradata/smt/example01.dbf
ln -s /dev/raw/raw19 /opt/oracle/oradata/smt/drsys01.dbf
ln -s /dev/raw/raw20 /opt/oracle/oradata/smt/odm01.dbf
ln -s /dev/raw/raw21 /opt/oracle/oradata/smt/redo01.log
ln -s /dev/raw/raw22 /opt/oracle/oradata/smt/redo02.log
ln -s /dev/raw/raw23 /opt/oracle/oradata/smt/redo03.log
ln -s /dev/raw/raw24 /opt/oracle/oradata/smt/smt_redo2_2.log
ln -s /dev/raw/raw25 /opt/oracle/oradata/smt/I_SWDL_DATA_01.dbf
ln -s /dev/raw/raw27 /opt/oracle/oradata/smt/D_SWDL_DATA_01.dbf
ln -s /dev/raw/raw28 /opt/oracle/oradata/smt/D_SFIS1_DATA_01a.dbf
ln -s /dev/raw/raw29 /opt/oracle/oradata/smt/D_SFISM4_DATA_01a.dbf
ln -s /dev/raw/raw30 /opt/oracle/oradata/smt/D_SFISM4_DATA_02a.dbf
ln -s /dev/raw/raw31 /opt/oracle/oradata/smt/D_SFISM4_DATA_01b.dbf
ln -s /dev/raw/raw32 /opt/oracle/oradata/smt/D_SMT_SCANDATA_DATA.dbf
ln -s /dev/raw/raw33 /opt/oracle/oradata/smt/D_SNDETAIL_DATA_01a.dbf
ln -s /dev/raw/raw34 /opt/oracle/oradata/smt/D_SNDETAIL_DATA_02a.dbf
ln -s /dev/raw/raw35 /opt/oracle/oradata/smt/D_SNDETAIL_DATA_02b.dbf
ln -s /dev/raw/raw36 /opt/oracle/oradata/smt/D_SNDETAIL_DATA_03a.dbf
ln -s /dev/raw/raw37 /opt/oracle/oradata/smt/D_SNDETAIL_DATA_04a.dbf
ln -s /dev/raw/raw38 /opt/oracle/oradata/smt/D_SNDETAIL_DATA_05a.dbf
ln -s /dev/raw/raw39 /opt/oracle/oradata/smt/D_SNDETAIL_DATA_06a.dbf
ln -s /dev/raw/raw40 /opt/oracle/oradata/smt/D_SNDETAIL_DATA_07a.dbf
ln -s /dev/raw/raw41 /opt/oracle/oradata/smt/D_TEST_DATA_01a.dbf
ln -s /dev/raw/raw42 /opt/oracle/oradata/smt/D_WIPTRACKING_DATA_01a.dbf
ln -s /dev/raw/raw43 /opt/oracle/oradata/smt/I_SFIS1_DATA_01a.dbf
ln -s /dev/raw/raw44 /opt/oracle/oradata/smt/I_SFISM4_DATA_01a.dbf
ln -s /dev/raw/raw45 /opt/oracle/oradata/smt/I_SMT_SCANDATA.dbf
ln -s /dev/raw/raw46 /opt/oracle/oradata/smt/I_SNDETAIL_DATA_01a.dbf
ln -s /dev/raw/raw47 /opt/oracle/oradata/smt/I_SNDETAIL_DATA_01b.dbf
ln -s /dev/raw/raw49 /opt/oracle/oradata/smt/I_WIPTRACKING_DATA_01a.dbf
ln -s /dev/raw/raw56 /opt/oracle/oradata/smt/AGAENT_DATA.dbf
ln -s /dev/raw/raw57 /opt/oracle/oradata/smt/AGAENT_INDEX.dbf
ln -s /dev/raw/raw58 /opt/oracle/oradata/smt/smt_redo1_3.log
ln -s /dev/raw/raw59 /opt/oracle/oradata/smt/smt_redo2_3.log
chown -R oracle.dba /opt/oracle/oradata
. ~oracle/.bash_profile
rm -rf $ORACLE_HOME/oracm/log/*.ts
$ORACLE_HOME/oracm/bin/ocmstart.sh
su - oracle -c "gsdctl start"
#set oracle environment
ORACLE_HOME=/opt/oracle/product/9.2.0;export ORACLE_HOME
ORACLE_SID=smt1; export ORACLE_SID
su oracle -c "/opt/oracle/product/9.2.0/bin/sqlplus /nolog <connect / as sysdba
startup;
exit
EOF"
su oracle -c "/opt/oracle/product/9.2.0/bin/lsnrctl <start
exit
EOF"
imbsmt1$ls
raw1 raw14 raw19 raw23 raw28 raw32 raw37 raw41 raw46 raw50 raw55 raw6 raw64 raw69
raw10 raw15 raw2 raw24 raw29 raw33 raw38 raw42 raw47 raw51 raw56 raw60 raw65 raw7
raw11 raw16 raw20 raw25 raw3 raw34 raw39 raw43 raw48 raw52 raw57 raw61 raw66 raw8
raw12 raw17 raw21 raw26 raw30 raw35 raw4 raw44 raw49 raw53 raw58 raw62 raw67 raw9
raw13 raw18 raw22 raw27 raw31 raw36 raw40 raw45 raw5 raw54 raw59 raw63 raw68
imbsmt1$ls -alhrt
total 0
crw------- 1 oracle dba 162, 1 Oct 1 16:46 raw1
crw------- 1 oracle dba 162, 2 Oct 1 16:46 raw2
crw------- 1 oracle dba 162, 3 Oct 1 16:46 raw3
crw------- 1 oracle dba 162, 4 Oct 1 16:46 raw4
crw------- 1 oracle dba 162, 5 Oct 1 16:46 raw5
crw------- 1 oracle dba 162, 7 Oct 1 16:46 raw7
crw------- 1 oracle dba 162, 8 Oct 1 16:46 raw8
crw------- 1 oracle dba 162, 6 Oct 1 16:46 raw6
crw------- 1 oracle dba 162, 9 Oct 1 16:46 raw9
crw------- 1 oracle dba 162, 10 Oct 1 16:46 raw10
crw------- 1 oracle dba 162, 11 Oct 1 16:46 raw11
drwxr-xr-x 2 root root 1.4K Oct 1 16:46 .
drwxr-xr-x 12 root root 6.0K Oct 1 16:46 ..
imbsmt1$ls
control pv-lvol15 pv-lvol22 pv-lvol3 pv-lvol37 pv-lvol44 pv-lvol51 pv-lvol59 pv-lvol66
pv-lvol0 pv-lvol16 pv-lvol23 pv-lvol30 pv-lvol38 pv-lvol45 pv-lvol52 pv-lvol6 pv-lvol67
pv-lvol1 pv-lvol17 pv-lvol24 pv-lvol31 pv-lvol39 pv-lvol46 pv-lvol53 pv-lvol60 pv-lvol68
pv-lvol10 pv-lvol18 pv-lvol25 pv-lvol32 pv-lvol4 pv-lvol47 pv-lvol54 pv-lvol61 pv-lvol69
pv-lvol11 pv-lvol19 pv-lvol26 pv-lvol33 pv-lvol40 pv-lvol48 pv-lvol55 pv-lvol62 pv-lvol7
pv-lvol12 pv-lvol2 pv-lvol27 pv-lvol34 pv-lvol41 pv-lvol49 pv-lvol56 pv-lvol63 pv-lvol8
pv-lvol13 pv-lvol20 pv-lvol28 pv-lvol35 pv-lvol42 pv-lvol5 pv-lvol57 pv-lvol64 pv-lvol9
pv-lvol14 pv-lvol21 pv-lvol29 pv-lvol36 pv-lvol43 pv-lvol50 pv-lvol58 pv-lvol65
imbsmt1$ls -alh
total 268K
drwxr-xr-x 2 oracle dba 4.0K Jul 30 11:11 .
drwxr-xr-x 3 oracle dba 4.0K Mar 7 2008 ..
lrwxrwxrwx 1 root root 14 Jun 6 2009 AGAENT_DATA.dbf -> /dev/raw/raw56
lrwxrwxrwx 1 root root 14 Jun 6 2009 AGAENT_INDEX.dbf -> /dev/raw/raw57
lrwxrwxrwx 1 root root 13 Mar 7 2008 CMQuorumFile -> /dev/raw/raw1
lrwxrwxrwx 1 root root 13 Mar 7 2008 control01.ctl -> /dev/raw/raw4
lrwxrwxrwx 1 root root 13 Mar 7 2008 control02.ctl -> /dev/raw/raw5
lrwxrwxrwx 1 root root 13 Mar 7 2008 control03.ctl -> /dev/raw/raw6
lrwxrwxrwx 1 root root 14 Mar 7 2008 cwmlite01.dbf -> /dev/raw/raw17
lrwxrwxrwx 1 root root 14 Mar 7 2008 drsys01.dbf -> /dev/raw/raw19
lrwxrwxrwx 1 oracle oinstall 14 Mar 7 2008 D_SFIS1_DATA_01a.dbf -> /dev/raw/raw28
lrwxrwxrwx 1 oracle oinstall 14 Mar 7 2008 D_SFISM4_DATA_01a.dbf -> /dev/raw/raw29
lrwxrwxrwx 1 oracle oinstall 14 Mar 7 2008 D_SFISM4_DATA_01b.dbf -> /dev/raw/raw31
lrwxrwxrwx 1 oracle oinstall 14 Mar 7 2008 D_SFISM4_DATA_02a.dbf -> /dev/raw/raw30
lrwxrwxrwx 1 oracle oinstall 14 Mar 7 2008 D_SMT_SCANDATA_DATA.dbf -> /dev/raw/raw32
lrwxrwxrwx 1 oracle oinstall 14 Mar 7 2008 D_SNDETAIL_DATA_01a.dbf -> /dev/raw/raw33
lrwxrwxrwx 1 oracle oinstall 14 Mar 7 2008 D_SNDETAIL_DATA_02a.dbf -> /dev/raw/raw34
lrwxrwxrwx 1 oracle oinstall 14 Mar 7 2008 D_SNDETAIL_DATA_02b.dbf -> /dev/raw/raw35
lrwxrwxrwx 1 oracle oinstall 14 Mar 7 2008 D_SNDETAIL_DATA_03a.dbf -> /dev/raw/raw36
lrwxrwxrwx 1 oracle oinstall 14 Mar 7 2008 D_SNDETAIL_DATA_04a.dbf -> /dev/raw/raw37
lrwxrwxrwx 1 oracle oinstall 14 Mar 7 2008 D_SNDETAIL_DATA_05a.dbf -> /dev/raw/raw38
lrwxrwxrwx 1 oracle oinstall 14 Mar 7 2008 D_SNDETAIL_DATA_06a.dbf -> /dev/raw/raw39
lrwxrwxrwx 1 oracle oinstall 14 Mar 7 2008 D_SNDETAIL_DATA_07a.dbf -> /dev/raw/raw40
lrwxrwxrwx 1 oracle oinstall 14 Mar 7 2008 D_SWDL_DATA_01.dbf -> /dev/raw/raw27
查看裸设备的大小:
lslv lvsybase_data1
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/35489/viewspace-709259/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/35489/viewspace-709259/