欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

AIX使用LV创建ASM磁盘组

程序员文章站 2022-05-25 23:30:40
...

CREATE ASM ON AIX LV DEVICE OS:AIX 6100-03 ASM版本 10205 # lspv hdisk0 000d295a6d68902b rootvg active hdisk1 000d2e62ac906f43 rootvg active hdisk2 000d2e629b38c89d datavg active hdisk3 none None hdisk4 none None # lsvg rootvg datavg # chdev

CREATE ASM ON AIX LV DEVICE
OS:AIX 6100-03
ASM版本 10205
# lspv
hdisk0 000d295a6d68902b rootvg active
hdisk1 000d2e62ac906f43 rootvg active
hdisk2 000d2e629b38c89d datavg active
hdisk3 none None
hdisk4 none None

# lsvg
rootvg
datavg

# chdev -l hdisk3 -a pv=yes --创建PV
hdisk3 changed
hdisk3已识别PVID
# lspv
hdisk0 000d295a6d68902b rootvg active
hdisk1 000d2e62ac906f43 rootvg active
hdisk2 000d2e629b38c89d datavg active
hdisk3 000d2e621c735061 None
hdisk4 none None

创建VG:
# mkvg -y asmvg hdisk3
asmvg

# lsvg -o
asmvg
datavg
rootvg

创建LV
mklv -y lv_asm1 asmvg 8
mklv -y lv_asm2 asmvg 8
mklv -y lv_asm3 asmvg 8
mklv -y lv_asm4 asmvg 8

# mklv -y lv_asm4 asmvg 8
lv_asm1
# mklv -y lv_asm2 asmvg 8
lv_asm2
# mklv -y lv_asm3 asmvg 8
lv_asm3
# mklv -y lv_asm4 asmvg 8
lv_asm4
修改权限
chown oracle.dba /dev/rlv_asm1 chown oracle.dba/dev/rlv_asm2 chown oracle.dba/dev/rlv_asm3 chown oracle.dba/dev/rlv_asm4
查看ASM设备
$ kfod status=TRUE asm_diskstring='/dev/rlv*' disk=all
--------------------------------------------------------------------------------
Disk Size Header Path
================================================================================
1: 256 Mb CANDIDATE /dev/rlv_asm1
2: 256 Mb CANDIDATE /dev/rlv_asm2
3: 256 Mb CANDIDATE /dev/rlv_asm3
4: 256 Mb CANDIDATE /dev/rlv_asm4
--------------------------------------------------------------------------------
ORACLE_SID ORACLE_HOME
================================================================================
+ASM /oracle/product/10.2.0/+ASM


创建磁盘组:
create diskgroup data external redundancy disk '/dev/rlv_asm1','/dev/rlv_asm2','/dev/rlv_asm3','/dev/rlv_asm4';

SQL> create diskgroup data external redundancy disk '/dev/rlv_asm1','/dev/rlv_asm2','/dev/rlv_asm3','/dev/rlv_asm4';
create diskgroup data external redundancy disk '/dev/rlv_asm1','/dev/rlv_asm2','/dev/rlv_asm3','/dev/rlv_asm4'
*
ERROR at line 1:
ORA-15018: diskgroup cannot be created
ORA-15031: disk specification '/dev/rlv_asm4' matches no disks
ORA-15014: location '/dev/rlv_asm4' is not in the discovery set
ORA-15031: disk specification '/dev/rlv_asm3' matches no disks
ORA-15014: location '/dev/rlv_asm3' is not in the discovery set
ORA-15031: disk specification '/dev/rlv_asm2' matches no disks
ORA-15014: location '/dev/rlv_asm2' is not in the discovery set
ORA-15031: disk specification '/dev/rlv_asm1' matches no disks
ORA-15014: location '/dev/rlv_asm1' is not in the discovery set


create diskgroup data external redundancy disk '/dev/rlv_asm*';


SQL> create diskgroup data external redundancy disk '/dev/rlv_asm*';
create diskgroup data external redundancy disk '/dev/rlv_asm*'
*
ERROR at line 1:
ORA-15018: diskgroup cannot be created
ORA-15031: disk specification '/dev/rlv_asm*' matches no disks
ORA-15014: location '/dev/rlv_asm4' is not in the discovery set
ORA-15014: location '/dev/rlv_asm3' is not in the discovery set
ORA-15014: location '/dev/rlv_asm2' is not in the discovery set
ORA-15014: location '/dev/rlv_asm1' is not in the discovery set


SQL> alter system set asm_diskstring='/dev/rlv_asm*';

System altered.

SQL> create diskgroup data external redundancy disk '/dev/rlv_asm*';

Diskgroup created.

查看alter日志:
Wed May 21 10:08:57 GMT+08:00 2014SQL> create diskgroup data external redundancy disk '/dev/rlv_asm1','/dev/rlv_asm2','/dev/rlv_asm3','/dev/rlv_asm4'
Wed May 21 10:08:57 GMT+08:00 2014ERROR: diskgroup DATA was not created
Wed May 21 10:11:46 GMT+08:00 2014SQL> create diskgroup data external redundancy disk '/dev/rlv_asm*'
Wed May 21 10:11:46 GMT+08:00 2014ERROR: diskgroup DATA was not created
Wed May 21 10:15:40 GMT+08:00 2014SQL> create diskgroup data external redundancy disk '/dev/rlv_asm*'
Wed May 21 10:15:40 GMT+08:00 2014ERROR: diskgroup DATA was not created
Wed May 21 10:16:20 GMT+08:00 2014ALTER SYSTEM SET asm_diskstring='/dev/rlv_asm*' SCOPE=BOTH;
Wed May 21 10:16:30 GMT+08:00 2014SQL> create diskgroup data external redundancy disk '/dev/rlv_asm*'
Wed May 21 10:16:30 GMT+08:00 2014NOTE: initializing header on grp 1 disk DATA_0000
NOTE: initializing header on grp 1 disk DATA_0001
NOTE: initializing header on grp 1 disk DATA_0002
NOTE: initializing header on grp 1 disk DATA_0003
NOTE: PST update: grp = 1
Wed May 21 10:16:30 GMT+08:00 2014NOTE: group DATA: initial PST locations: disk 0000 (PST copy 0)
Wed May 21 10:16:30 GMT+08:00 2014NOTE: cache registered group DATA number=1 incarn=0x1649be7b
NOTE: cache opening disk 0 of grp 1: DATA_0000 path:/dev/rlv_asm1
NOTE: cache opening disk 1 of grp 1: DATA_0001 path:/dev/rlv_asm2
NOTE: cache opening disk 2 of grp 1: DATA_0002 path:/dev/rlv_asm3
NOTE: cache opening disk 3 of grp 1: DATA_0003 path:/dev/rlv_asm4
NOTE: cache creating group 1/0x1649BE7B (DATA)
NOTE: cache mounting group 1/0x1649BE7B (DATA) succeeded
NOTE: allocating F1X0 on grp 1 disk DATA_0000
NOTE: diskgroup must now be re-mounted prior to first use
NOTE: cache dismounting group 1/0x1649BE7B (DATA)
SUCCESS: diskgroup DATA was created
NOTE: cache registered group DATA number=1 incarn=0x2769be7e
Wed May 21 10:16:33 GMT+08:00 2014NOTE: Hbeat: instance first (grp 1)
Wed May 21 10:16:37 GMT+08:00 2014NOTE: start heartbeating (grp 1)
NOTE: cache opening disk 0 of grp 1: DATA_0000 path:/dev/rlv_asm1
Wed May 21 10:16:37 GMT+08:00 2014NOTE: F1X0 found on disk 0 fcn 0.0
NOTE: cache opening disk 1 of grp 1: DATA_0001 path:/dev/rlv_asm2
NOTE: cache opening disk 2 of grp 1: DATA_0002 path:/dev/rlv_asm3
NOTE: cache opening disk 3 of grp 1: DATA_0003 path:/dev/rlv_asm4
NOTE: cache mounting (first) group 1/0x2769BE7E (DATA)
NOTE: cache recovered group 1 to fcn 0.0
Wed May 21 10:16:37 GMT+08:00 2014NOTE: LGWR attempting to mount thread 1 for disk group 1
NOTE: LGWR mounted thread 1 for disk group 1
NOTE: opening chunk 1 at fcn 0.0 ABA
NOTE: seq=2 blk=0
Wed May 21 10:16:37 GMT+08:00 2014NOTE: cache mounting group 1/0x2769BE7E (DATA) succeeded
SUCCESS: diskgroup DATA was mounted
Wed May 21 10:16:39 GMT+08:00 2014NOTE: recovering COD for group 1/0x2769be7e (DATA)
SUCCESS: completed COD recovery for group 1/0x2769be7e (DATA)


查看ASM状态:
SQL> select name,state from v$asm_diskgroup;

NAME
--------------------------------------------------------------------------------
STATE
---------------------------------
DATA
MOUNTED


SQL> col name for a30
SQL> col path for a30
SQL> select name,path from v$asm_disk;

NAME PATH
------------------------------ ------------------------------
DATA_0000 /dev/rlv_asm1
DATA_0001 /dev/rlv_asm2
DATA_0002 /dev/rlv_asm3
DATA_0003 /dev/rlv_asm4


select path_kfdsk,state_kfdsk,asmname_kfdsk from x$kfdsk;
PATH_KFDSK STATE_KFDSK ASMNAME_KFDSK
-------------- ----------- ----------------
/dev/rlv_asm1 2 DATA_0000
/dev/rlv_asm2 2 DATA_0001
/dev/rlv_asm3 2 DATA_0002
/dev/rlv_asm4 2 DATA_0003


ASMCMD> lsdg
State Type Rebal Unbal Sector Block AU Total_MB Free_MB Req_mir_free_MB Usable_file_MB Offline_disks Name
MOUNTED EXTERN N N 512 4096 4194304 1024 928 0 928 0 DATA/


1* select INDX,inst_id,group_kffil,number_kffil,filsiz_kffil,ftype_kffil from x$kffil
SQL> /

INDX INST_ID GROUP_KFFIL NUMBER_KFFIL FILSIZ_KFFIL FTYPE_KFFIL
---------- ---------- ----------- ------------ ------------ -----------
0 1 1 1 4194304 15
1 1 1 2 1048576 15
2 1 1 3 46137344 15
3 1 1 4 1392640 15
4 1 1 5 1048576 15
5 1 1 6 1048576 15

6 rows selected.
至此AIX使用LV创建ASM磁盘组操作完成。