Linux AS4U5 lvm raw oracle10
时间:2010-09-14 来源:uplooking_sh
www.uplooking.com
一、安装oracle软件,
设置系统内核参数等
设置oracle环境变量
[oracle@localhost oradata]$ vi /home/oracle/.bash_profile
export ORACLE_BASE=/opt/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10.2.1/db_1
export ORACLE_SID=ora10
export ORACLE_TERM=xterm
export PATH=$ORACLE_HOME/bin:$PATH:/usr/sbin:$HOME/bin
unset USERNAME
二、配置raw存储
AS4u5默认内核支持lvm2裸设备,模块需要动态加载
1.动态加载模块
编辑rc.local文件
[root@localhost ~]# vi /etc/rc.local
#!/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
#mount lvm2 module
modprobe dm-mod
2.列出加载的模块
[root@localhost ~]# lsmod|grep dm_mod
dm_mod 65001 1 dm_mirror
3.fdisk分区
[root@localhost ~]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.
The number of cylinders for this disk is set to 1305.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): help
h: unknown command
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1305, default 1):
Using default value 1
Last cylinder or size or sizeM or sizeK (1-1305, default 1305):
Using default value 1305
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
4.显示分区大小
[root@localhost ~]# fdisk -l
Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 25 200781 83 Linux
/dev/sda2 26 286 2096482 82 Linux swap
/dev/sda3 287 388 819315 83 Linux
/dev/sda4 389 2610 17848215 5 Extended
/dev/sda5 389 2610 17848183 83 Linux
Disk /dev/sdb: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 1305 10482381 83 Linux
[root@localhost ~]#
5、lvm使用
建立pv
[root@localhost ~]# pvcreate /dev/sdb1 -ff
/dev/cdrom: open failed: Read-only file system
Really INITIALIZE physical volume "/dev/sdb1" of volume group "oravg" [y/n]? y
WARNING: Forcing physical volume creation on /dev/sdb1 of volume group "oravg"
Physical volume "/dev/sdb1" successfully created
[root@localhost ~]# pvdisplay
--- NEW Physical volume ---
PV Name /dev/sdb1
VG Name
PV Size 10.00 GB
Allocatable NO
PE Size (KByte) 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID OO5Na5-7nzB-O4ze-JaId-GQr2-GEMb-zqHK5b
6.建立vg oradata
[root@localhost ~]# vgcreate oradata /dev/sdb1
Volume group "oradata" successfully created
[root@localhost ~]# vgdisplay
--- Volume group ---
VG Name oradata
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 1
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 0
Open LV 0
Max PV 0
Cur PV 1
Act PV 1
VG Size 10.00 GB
PE Size 4.00 MB
Total PE 2559
Alloc PE / Size 0 / 0
Free PE / Size 2559 / 10.00 GB
VG UUID 1VkwE5-N1Kz-2dNj-X0s3-B1ex-AsXA-VGBSM7
[root@localhost ~]#
7.建立lv
[root@localhost /]# lvcreate -L 500M -n system01.dbf oradata
[root@localhost /]# lvcreate -L 500M -n sysaux01.dbf oradata
[root@localhost /]# lvcreate -L 500M -n undotbs01.dbf oradata
[root@localhost /]# lvcreate -L 500M -n redo01.dbf oradata
[root@localhost /]# lvcreate -L 500M -n redo02.dbf oradata
[root@localhost /]# lvcreate -L 500M -n control01.ctl oradata
[root@localhost /]# lvcreate -L 500M -n control02.ctl oradata
[root@localhost /]# lvcreate -L 500M -n temp01.dbf oradata
[root@localhost /]# lvcreate -L 500M -n spfileora10.ora oradata
[root@localhost /]# lvcreate -L 500M -n orapwdora10 oradata
[root@localhost /]# lvcreate -L 2048M -n users01.dbf oradata
知识点:
删除lv命令
lvremove /dev/oradata/system01.dbf
删除vg时要,先删除上面的lv
vgremove
8.将lv关联成raw
vi /etc/sysconfig/rawdevices 加入以下内容:
/dev/raw/raw1 /dev/oradata/system01.dbf
/dev/raw/raw2 /dev/oradata/sysaux01.dbf
/dev/raw/raw3 /dev/oradata/undotbs01.dbf
/dev/raw/raw4 /dev/oradata/redo01.dbf
/dev/raw/raw5 /dev/oradata/redo02.dbf
/dev/raw/raw6 /dev/oradata/control01.ctl
/dev/raw/raw7 /dev/oradata/control02.ctl
/dev/raw/raw8 /dev/oradata/temp01.dbf
/dev/raw/raw9 /dev/oradata/spfileora10.ora
/dev/raw/raw10 /dev/oradata/orapwdora10
/dev/raw/raw11 /dev/oradata/users01.dbf
9.使用raw设备绑定生效:
/sbin/service rawdevices restart
查看裸设备
[root@oraDBServer ~]# raw -qa
/dev/raw/raw1: bound to major 253, minor 0
/dev/raw/raw2: bound to major 253, minor 1
/dev/raw/raw3: bound to major 253, minor 2
/dev/raw/raw4: bound to major 253, minor 3
/dev/raw/raw5: bound to major 253, minor 4
/dev/raw/raw6: bound to major 253, minor 5
/dev/raw/raw7: bound to major 253, minor 6
/dev/raw/raw8: bound to major 253, minor 7
/dev/raw/raw9: bound to major 253, minor 8
/dev/raw/raw10: bound to major 253, minor 9
/dev/raw/raw11: bound to major 253, minor 10
[root@oraDBServer ~]#