通过lun来创建asm磁盘组,在linux上就是直接使用linux的分区来创建:
1. 新加一块磁盘,并分成四个区:
[root@single ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
29G 23G 4.7G 83% /
/dev/sda1 99M 12M 82M 13% /boot
tmpfs 252M 0 252M 0% /dev/shm
[root@single ~]# fdisk -l | grep -v /dev/sda | grep ^Disk
Disk /dev/sdb doesn't contain a valid partition table
Disk /dev/sdb: 1073 MB, 1073741824 bytes
root@single ~]# 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.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): m
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-130, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-130, default 130): 256M
Value out of range.
Last cylinder or +size or +sizeM or +sizeK (1-130, default 130): +256M
Command (m for help): p
Disk /dev/sdb: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 32 257008+ 83 Linux
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (33-130, default 33):
Using default value 33
Last cylinder or +size or +sizeM or +sizeK (33-130, default 130): +256M
Command (m for help): p
Disk /dev/sdb: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 32 257008+ 83 Linux
/dev/sdb2 33 64 257040 83 Linux
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 3
First cylinder (65-130, default 65):
Using default value 65
Last cylinder or +size or +sizeM or +sizeK (65-130, default 130): +256M
Command (m for help): p
Disk /dev/sdb: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 32 257008+ 83 Linux
/dev/sdb2 33 64 257040 83 Linux
/dev/sdb3 65 96 257040 83 Linux
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Selected partition 4
First cylinder (97-130, default 97):
Using default value 97
Last cylinder or +size or +sizeM or +sizeK (97-130, default 130): +256M
Command (m for help): p
Disk /dev/sdb: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 32 257008+ 83 Linux
/dev/sdb2 33 64 257040 83 Linux
/dev/sdb3 65 96 257040 83 Linux
/dev/sdb4 97 128 257040 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@single ~]# fdisk -l | grep /dev/sd | grep -v sda
Disk /dev/sdb: 1073 MB, 1073741824 bytes
/dev/sdb1 1 32 257008+ 83 Linux
/dev/sdb2 33 64 257040 83 Linux
/dev/sdb3 65 96 257040 83 Linux
/dev/sdb4 97 128 257040 83 Linux
2.修改设备文件的权限
[root@single ~]# ls /dev/sd?? | grep -v sda
/dev/sdb1
/dev/sdb2
/dev/sdb3
/dev/sdb4
[root@single ~]# ls /dev/sd?? | grep -v sda |xargs chown ora10g:dba
[root@single ~]# ls /dev/sd?? | grep -v sda |xargs chmod 660
3.修改asm_diskstring参数,以使oracle能发现disk
idle>show parameter string
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
asm_diskstring string /dev/raw/raw*, /home/db/oracle
/oradata/+ASM/fs/*
idle>alter system set asm_diskstring='/dev/raw/raw*','/home/db/oracle/oradata/+ASM/fs/*','/dev/sd*';
System altered.
idle>show parameter string
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
asm_diskstring string /dev/raw/raw*, /home/db/oracle
/oradata/+ASM/fs/*, /dev/sd*
4.重启ASM实例,就可以发现新增加的分区
idle>shutdown
ASM diskgroups dismounted
ASM instance shutdown
idle>startup
ASM instance started
Total System Global Area 79691776 bytes
Fixed Size 1217812 bytes
Variable Size 53308140 bytes
ASM Cache 25165824 bytes
ASM diskgroups mounted
idle>col path for a50
idle>col library for a20
idle>SELECT path, header_status, library, total_mb, free_mb FROM v$asm_disk;
PATH HEADER_STATU LIBRARY TOTAL_MB FREE_MB
-------------------------------------------------- ------------ -------------------- ---------- ----------
/dev/sdb2 CANDIDATE System 251 0
/dev/sdb3 CANDIDATE System 251 0
/dev/sdb4 CANDIDATE System 251 0
/dev/sdb1 CANDIDATE System 250 0
/dev/raw/raw4 MEMBER System 256 231
/dev/raw/raw3 MEMBER System 256 228
/dev/raw/raw2 MEMBER System 256 233
/dev/raw/raw1 MEMBER System 256 226
/home/db/oracle/oradata/+ASM/fs/filesystem_dsk4 MEMBER System 128 103
/home/db/oracle/oradata/+ASM/fs/filesystem_dsk2 MEMBER System 128 105
/home/db/oracle/oradata/+ASM/fs/filesystem_dsk1 MEMBER System 128 98
/home/db/oracle/oradata/+ASM/fs/filesystem_dsk3 MEMBER System 128 100
12 rows selected.
由于还没有加入到磁盘组中,新加的四个disk的状态为CANDIDATE。
5.创建新的磁盘组
idle>CREATE DISKGROUP LUN_DISK_GROUP NORMAL REDUNDANCY
2 FAILGROUP array1
3 DISK
4 '/dev/sdb1' NAME lun_array1_disk1,
5 '/dev/sdb2' NAME lun_array1_disk2
6 FAILGROUP array2
7 DISK
8 '/dev/sdb3' NAME lun_array2_disk1,
9 '/dev/sdb4' NAME lun_array2_disk2;
Diskgroup created.
idle>SELECT name, block_size, allocation_unit_size, state,
2 type, total_mb, usable_file_mb
3 FROM v$asm_diskgroup;
NAME BLOCK_SIZE ALLOCATION_UNIT_SIZE STATE TYPE TOTAL_MB USABLE_FILE_MB
-------------------- ---------- -------------------- ----------- ------ ---------- --------------
FS_DISK_GROUP 4096 1048576 MOUNTED NORMAL 512 139
TEST_ASM_DG 4096 1048576 MOUNTED NORMAL 1024 331
LUN_DISK_GROUP 4096 1048576 MOUNTED NORMAL 1003 323
现在该asm实例一共有三个磁盘组。
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/10972173/viewspace-684241/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/10972173/viewspace-684241/