future2012lg

博客园 首页 新随笔 联系 订阅 管理

关于这个问题我们首先来看一下AIX的vg的3种类型:
original vg 普通卷组
big vg 大卷组
scalable vg 动态的或者可扩展的卷组
如何快速区分这三组卷组呢?
通过其参数MAX PVS,上述3个类型的卷组对应的限制是:32、128、1024;除此之外,还可以通过readvgda命令来读取pv的元数据判断。
好了,实际来看几个例子。

db1:/#uname -a
AIX db1 1 6 00F7B72A4C00
db1:/#oslevel -r
6100-07
这是一台aix6.1下的环境,含有rootvg和vg01两个卷组:
db1:/#lsvg -o
vg01
rootvg
其中rootvg当然是系统使用的vg,vg01是准备用来被oracle使用的。
现有pv如下:
db1:/#lspv
hdisk0          00f7b72ab2370b93                    rootvg          active      
hdisk1          00f7b72aacb2dab0                    rootvg          active      
hdisk2          none                                None                        
hdisk3          none                                None                        
hdisk4          none                                None                        
hdisk5          none                                None                        
hdisk6          none                                None                        
hdisk7          none                                None                        
hdisk8          00f7b72af78cefac                    vg01            active      
hdisk9          00f7b72af78cf3f9                    vg01            active      
hdisk10         00f7b72af78cf834                    vg01            active      
hdisk11         00f7b72af7a7bf97                    diskhb                      
现在我们通过MAX PVS这个参数判断卷组类型:
db1:/#lsvg rootvg
VOLUME GROUP:       rootvg                   VG IDENTIFIER:  00f7b72a00004c000000013bb2371f49
VG STATE:           active                   PP SIZE:        512 megabyte(s)
VG PERMISSION:      read/write               TOTAL PPs:      1116 (571392 megabytes)
MAX LVs:            256                      FREE PPs:       650 (332800 megabytes)
LVs:                16                       USED PPs:       466 (238592 megabytes)
OPEN LVs:           13                       QUORUM:         1 (Disabled)
TOTAL PVs:          2                        VG DESCRIPTORS: 3
STALE PVs:          0                        STALE PPs:      0
ACTIVE PVs:         2                        AUTO ON:        yes
MAX PPs per VG:     32512                                     
MAX PPs per PV:     1016                     MAX PVs:        32
LTG size (Dynamic): 1024 kilobyte(s)         AUTO SYNC:      no
HOT SPARE:          no                       BB POLICY:      relocatable
PV RESTRICTION:     none                     INFINITE RETRY: no
db1:/#lsvg vg01
VOLUME GROUP:       vg01                     VG IDENTIFIER:  00f7b72a00004c000000013ef78cf9e8
VG STATE:           active                   PP SIZE:        256 megabyte(s)
VG PERMISSION:      read/write               TOTAL PPs:      3597 (920832 megabytes)
MAX LVs:            256                      FREE PPs:       3565 (912640 megabytes)
LVs:                2                        USED PPs:       32 (8192 megabytes)
OPEN LVs:           0                        QUORUM:         2 (Enabled)
TOTAL PVs:          3                        VG DESCRIPTORS: 3
STALE PVs:          0                        STALE PPs:      0
ACTIVE PVs:         3                        AUTO ON:        no
MAX PPs per VG:     32768                    MAX PVs:        1024
LTG size (Dynamic): 256 kilobyte(s)          AUTO SYNC:      no
HOT SPARE:          no                       BB POLICY:      relocatable
MIRROR POOL STRICT: off                                       
PV RESTRICTION:     none                     INFINITE RETRY: no
根据参数我们可以得出rootvg是original vg,而vg01是scalable vg,通过readvgda也可以得出相同的结论:
db1:/#readvgda hdisk0  | grep -i type
.....    readvgda_type: smallvg
vgtype:         0
对应的0就是original vg了,其他的还有1对应big vg,2对应scalable vg。

接下来我们看下关于4k offset的问题。首先分别在original和scalable vg创建2个lv,一共4个lv:
db1:/#/usr/sbin/mklv -y'lv_system03_512' -t'raw' rootvg 4
lv_system03_512
db1:/#/usr/sbin/mklv -T O -y'lv_system04_512' -t'raw' rootvg 4
lv_system04_512
db1:/#/usr/sbin/mklv -y'lv_system01_4g' -t'raw' vg01 16
lv_system01_4g
db1:/#/usr/sbin/mklv -T O -y'lv_system02_4g' -t'raw' vg01 16
lv_system02_4g
查看下创建出来的lv:
db1:/#lslv lv_system03_512
LOGICAL VOLUME:     lv_system03_512        VOLUME GROUP:   rootvg
LV IDENTIFIER:      00f7b72a00004c000000013bb2371f49.15 PERMISSION:     read/write
VG STATE:           active/complete        LV STATE:       closed/syncd
TYPE:               raw                    WRITE VERIFY:   off
MAX LPs:            512                    PP SIZE:        512 megabyte(s)
COPIES:             1                      SCHED POLICY:   parallel
LPs:                4                      PPs:            4
STALE PPs:          0                      BB POLICY:      relocatable
INTER-POLICY:       minimum                RELOCATABLE:    yes
INTRA-POLICY:       middle                 UPPER BOUND:    32
MOUNT POINT:        N/A                    LABEL:          None
MIRROR WRITE CONSISTENCY: on/ACTIVE                              
EACH LP COPY ON A SEPARATE PV ?: yes                                    
Serialize IO ?:     NO                                     
INFINITE RETRY:     no                                     
db1:/#lslv lv_system04_512
LOGICAL VOLUME:     lv_system04_512        VOLUME GROUP:   rootvg
LV IDENTIFIER:      00f7b72a00004c000000013bb2371f49.16 PERMISSION:     read/write
VG STATE:           active/complete        LV STATE:       closed/syncd
TYPE:               raw                    WRITE VERIFY:   off
MAX LPs:            512                    PP SIZE:        512 megabyte(s)
COPIES:             1                      SCHED POLICY:   parallel
LPs:                4                      PPs:            4
STALE PPs:          0                      BB POLICY:      relocatable
INTER-POLICY:       minimum                RELOCATABLE:    yes
INTRA-POLICY:       middle                 UPPER BOUND:    32
MOUNT POINT:        N/A                    LABEL:          None
MIRROR WRITE CONSISTENCY: on/ACTIVE                              
EACH LP COPY ON A SEPARATE PV ?: yes                                    
Serialize IO ?:     NO                                     
INFINITE RETRY:     no           

db1:/#lslv lv_system01_4g
LOGICAL VOLUME:     lv_system01_4g         VOLUME GROUP:   vg01
LV IDENTIFIER:      00f7b72a00004c000000013ef78cf9e8.1 PERMISSION:     read/write
VG STATE:           active/complete        LV STATE:       closed/syncd
TYPE:               raw                    WRITE VERIFY:   off
MAX LPs:            512                    PP SIZE:        256 megabyte(s)
COPIES:             1                      SCHED POLICY:   parallel
LPs:                16                     PPs:            16
STALE PPs:          0                      BB POLICY:      relocatable
INTER-POLICY:       minimum                RELOCATABLE:    yes
INTRA-POLICY:       middle                 UPPER BOUND:    1024
MOUNT POINT:        N/A                    LABEL:          None
MIRROR WRITE CONSISTENCY: on/ACTIVE                              
EACH LP COPY ON A SEPARATE PV ?: yes                                    
Serialize IO ?:     NO                                     
INFINITE RETRY:     no                                     
DEVICESUBTYPE:      DS_LVZ                                        
COPY 1 MIRROR POOL: None                                   
COPY 2 MIRROR POOL: None                                   
COPY 3 MIRROR POOL: None                                   
db1:/#lslv lv_system02_4g
LOGICAL VOLUME:     lv_system02_4g         VOLUME GROUP:   vg01
LV IDENTIFIER:      00f7b72a00004c000000013ef78cf9e8.2 PERMISSION:     read/write
VG STATE:           active/complete        LV STATE:       closed/syncd
TYPE:               raw                    WRITE VERIFY:   off
MAX LPs:            512                    PP SIZE:        256 megabyte(s)
COPIES:             1                      SCHED POLICY:   parallel
LPs:                16                     PPs:            16
STALE PPs:          0                      BB POLICY:      relocatable
INTER-POLICY:       minimum                RELOCATABLE:    yes
INTRA-POLICY:       middle                 UPPER BOUND:    1024
MOUNT POINT:        N/A                    LABEL:          None
MIRROR WRITE CONSISTENCY: on/ACTIVE                              
EACH LP COPY ON A SEPARATE PV ?: yes                                    
Serialize IO ?:     NO                                     
INFINITE RETRY:     no                                     
DEVICESUBTYPE:      DS_LVZ                                        
COPY 1 MIRROR POOL: None                                   
COPY 2 MIRROR POOL: None                                   
COPY 3 MIRROR POOL: None                                   

结合结果,有如下结论:
0. Origninal VG无论是否使用“-T O”参数,创建出来的lv都是DS_LV;
1. Scalable VG无论是否使用“-T O”参数,创建出来的lv都是DS_LVZ;
2. Big VG使用“-T O”参数创建出来的lv是DS_LVZ类型,否则是DS_LV类型。

通过查看lv的属性DEVICESUBTYPE:DS_LVZ也就是没有偏移的lv,初次之外Oracle也提供了一个工具来检查是有offset:
db1:/#ls -l /dev/lv_*
brw-rw----    1 root     system       53,  1 Jul 02 09:12 /dev/lv_system01_4g
brw-rw----    1 root     system       53,  2 Jul 02 09:15 /dev/lv_system02_4g
brw-rw----    1 root     system       10, 15 Jul 02 09:16 /dev/lv_system03_512
brw-rw----    1 root     system       10, 16 Jul 02 09:18 /dev/lv_system04_512
db1:/#ls -l /dev/rlv_*
crw-rw----    1 root     system       53,  1 Jul 02 09:12 /dev/rlv_system01_4g
crw-rw----    1 root     system       53,  2 Jul 02 09:15 /dev/rlv_system02_4g
crw-rw----    1 root     system       10, 15 Jul 02 09:16 /dev/rlv_system03_512
crw-rw----    1 root     system       10, 16 Jul 02 09:18 /dev/rlv_system04_512
其中每个lv对应有快设备和字符设备,oracle使用的是字符设备:
db1:/#chown oracle:oinstall /dev/rlv_*
db1:/#chmod 700 /dev/rlv_*
db1:/#ls -l /dev/rlv_*
crwx------    1 oracle   oinstall     53,  1 Jul 02 09:12 /dev/rlv_system01_4g
crwx------    1 oracle   oinstall     53,  2 Jul 02 09:15 /dev/rlv_system02_4g
crwx------    1 oracle   oinstall     10, 15 Jul 02 09:16 /dev/rlv_system03_512
crwx------    1 oracle   oinstall     10, 16 Jul 02 09:18 /dev/rlv_system04_512
由于该工具只能检查被用于数据文件的lv,因此只能在被使用之后检查,现在先删除掉上述4个lv,之后重新创建用于测试,注意要用root用户执行:
db1:/oracle$ dbfsize /dev/rlv_system01_4g
/dev/rlv_system01_4g: Header block magic number is bad; trying raw file format...
/dev/rlv_system01_4g: Header block magic number is bad
db1:/oracle$ dbfsize /dev/rlv_system03_512
        /dev/rlv_system03_512: Header block magic number is bad
删除  rmlv -f 'rlv_system01_4g' rmlv -f 'rlv_system02_4g' rmlv -f 'rlv_system03_512' rmlv -f 'rlv_system04_512'

在创建数据库之后重新执行下如下结果就可以结果:
db1:/#/oracle/app/oracle/product/10.2/db1/bin/dbfsize /dev/lv_control_01

Database file: /dev/lv_control_01
Database file type: raw device without 4K starting offset
Database file size: 334 16384 byte blocks      
 
这个是没有offset的.
接着来看下有offset的结果:
/usr/sbin/mklv -y'lvtest' -t'raw' rootvg 1            
chown oracle:oinstall /dev/rlvtest
chmod 700 /dev/rlvtest
db1:/#su - oracle
db1:/oracle$ sqlplus "/as sysdba"

SQL*Plus: Release 10.2.0.4.0 - Production on Tue Jul 2 11:50:32 2013

Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> create tablespace gtlions datafile '/dev/rlvtest' size 10m;

Tablespace created.

SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
db1:/oracle$ /oracle/app/oracle/product/10.2/db1/bin/dbfsize /dev/lvtest   

Database file: /dev/lvtest
Database file type: raw device     
Database file size: 1280 8192 byte blocks     
而且使用有offset的lv创建表空间的时候在后台日志也会做相应的记录并提出建议:
create tablespace gtlions datafile '/dev/rlvtest' size 10m
WARNING: You are creating datafile /dev/rlvtest.
WARNING: Oracle recommends creating new datafiles on devices with zero offset. The command "/usr/sbin/mklv -y LVname -T O -w n -s n -r n VGname NumPPs" can be used. Please contact Oracle customer support for more details.
WARNING: You are creating/reusing datafile /dev/rlvtest.
WARNING: Oracle recommends creating new datafiles on devices with zero offset. The command "/usr/sbin/mklv -y LVname -T O -w n -s n -r n VGname NumPPs" can be used. Please contact Oracle customer support for more details.
Completed: create tablespace gtlions datafile '/dev/rlvtest' size 10m  

转载:http://blog.csdn.net/gtlions/article/details/9223705

posted on 2014-04-29 22:15  future2012lg  阅读(344)  评论(0编辑  收藏  举报