在aix下使用raw device建oracle分配vg和lv的shell

时间:2021-07-17 22:52:56
$Id: 20070326_mk_lv.txt,v 1.2 2007/03/25 01:47:36 albert Exp $

在aix下使用raw device建oracle分配vg和lv的shell

###
# 机器上有16个vpath,2T的容量,存储为IBM DS8000。2块光纤卡,2个通道。
# 文件系统用2个vpath,数据库用剩下的14个vpath
# lspv可以看到有几个vpath
#
# 建文件系统vg,64mb一个pp,为oracle achive log使用
#
####
mkvg -B -f -s 64 -V51 -y fsvg vpath14 vpath15

#
# ora_vg1有14个vpath,mklv是 upperbound最大只能14故 -u 14
#
mkvg -B -f -s 64 -V50 -y ora_vg1 vpath0 vpath1 vpath2 vpath3 vpath4 vpath5 vpath6 vpath7 vpath8 vpath9 vpath10 vpath11 vpath12 vpath13

###
# 建数据库用的lv -u 14 upbound 14个vpath,条带化为1mb -S 1m
#
#  -e Range
#  Sets the inter-physical volume allocation policy (the number of physical volumes to extend across, using the
#  volumes that provide the best allocation). The Range value is limited by the UpperBound variable, (set with the
#  -u flag) and can be one of the following:
#       x
#           Allocates across the maximum number of physical volumes.
#       m
#           Allocates logical partitions across the minimum number of physical volumes. This is the default range.
#
####

# 第一组数据库lv
mklv -u 14 -t raw -S 1m -y db1_redolv1 ora_vg1 14
mklv -u 14 -t raw -S 1m -y db1_redolv2 ora_vg1 14
mklv -u 14 -t raw -S 1m -y db1_redolv3 ora_vg1 14
mklv -u 14 -t raw -S 1m -y db1_syslv ora_vg1 42
mklv -u 14 -t raw -S 1m -y db1_undolv ora_vg1 420
mklv -u 14 -t raw -S 1m -y db1_templv ora_vg1 420
mklv -u 14 -t raw -S 1m -y db1_userslv ora_vg1 280
mklv -u 2 -t raw -S 1m -y db1_ctllv1 ora_vg1 2
mklv -u 1 -t raw -e x -y db1_spfilelv ora_vg1 1

# 第二组数据库lv
mklv -u 14 -t raw -S 1m -y db2_redolv1 ora_vg1 14
mklv -u 14 -t raw -S 1m -y db2_redolv2 ora_vg1 14
mklv -u 14 -t raw -S 1m -y db2_redolv3 ora_vg1 14
mklv -u 14 -t raw -S 1m -y db2_syslv ora_vg1 42
mklv -u 14 -t raw -S 1m -y db2_undolv ora_vg1 420
mklv -u 14 -t raw -S 1m -y db2_templv ora_vg1 420
mklv -u 14 -t raw -S 1m -y db2_userslv ora_vg1 280
mklv -u 2 -t raw -S 1m -y db2_ctllv1 ora_vg1 2
mklv -u 1 -t raw -e x -y db2_spfilelv ora_vg1 1

###
# 数据文件的lv,280*64MB
# -u 使用条带化时最大不能超过vg上vpath的数目,mkvg时ora_vg1有14个vpath,故这里用14
# -u UpperBound
#  Sets the maximum number of physical volumes for new allocation. The value of the Upperbound variable should be
#  between one and the total number of physical volumes. When using super strictness, the upper bound indicates
#  the maximum number of physical volumes allowed for each mirror copy. When using striped logical volumes, the
#  upper bound must be multiple of Stripe_width. If upper_bound is not specified it is assumed to be stripe_width
#  for striped logical volumes.
#
# -S 1M 条带化
#  -S StripeSize
#   Specifies the number of bytes per striped. Valid values include 4K, 8K, 16K, 32K, 64K, 128K, 1M, 2M, 4M, 8M,
#   16M, 32M, 64M, and 128M. Note: The -d, -e, and -s flags are not valid when creating a striped logical volume
#   using the -S flag.
#
# 每个lv 280个pp,每个pp 64mb
#

i=60
while [ $i -lt 100 ]
do
i=`expr $i + 1 `
l=`printf "%03d" $i`
mklv -u 14 -t raw -S 1m -y vg1lv$l ora_vg1 280
done

# 下面是vg中某个lv的具体参数
root@res /dev #lslv vg1lv001
LOGICAL VOLUME:     vg1lv001               VOLUME GROUP:   ora_vg1
LV IDENTIFIER:      00cfa7bc00004c00000001114f5fc1ab.1 PERMISSION:     read/write
VG STATE:           active/complete        LV STATE:       closed/syncd
TYPE:               raw                    WRITE VERIFY:   off
MAX LPs:            512                    PP SIZE:        64 megabyte(s)
COPIES:             1                      SCHED POLICY:   striped
LPs:                280                    PPs:            280
STALE PPs:          0                      BB POLICY:      relocatable
INTER-POLICY:       maximum                RELOCATABLE:    no
INTRA-POLICY:       middle                 UPPER BOUND:    14
MOUNT POINT:        N/A                    LABEL:          None
MIRROR WRITE CONSISTENCY: on/ACTIVE                             
EACH LP COPY ON A SEPARATE PV ?: yes (superstrict)                     
Serialize IO ?:     NO                                    
STRIPE WIDTH:       14                                    
STRIPE SIZE:        1m