1.首先创建共享磁盘组
https://blog.csdn.net/chenshijie2011/article/details/80594986
2.2创建ASM Disk Volumes
对磁盘需要新进行fdisk分区,在rac1上面进行分区。
[root@rac1 ~]# 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 11748.
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): m
–输入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
–输入p添加主分区
Partition number (1-4): 1
–填写分区号
First cylinder (1-11748, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-11748, default 11748):
Using default value 11748
Command (m for help): p
–打印分区列表
Disk /dev/sdb: 96.6 GB, 96636764160 bytes
255 heads, 63 sectors/track, 11748 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 11748 94365778+ 83 Linux
Command (m for help): w
–保存退出
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
oracleasm configure -i之后两个节点需要重启!
oracleasm configure -i――两个节点上都要操作
节点一上:
[root@rac1 soft]# oracleasm configure -i
Configuring the Oracle ASM library driver.
This will configure the on-boot properties of the Oracle ASM library
driver. The following questions will determine whether the driver is
loaded on boot and what permissions it will have. The current values
will be shown in brackets (‘[]’). Hitting without typing an
answer will keep that current value. Ctrl-C will abort.
Default user to own the driver interface []: grid
Default group to own the driver interface []: asmadmin
Start Oracle ASM library driver on boot (y/n) [n]: y
Scan for Oracle ASM disks on boot (y/n) [y]: y
Writing Oracle ASM library driver configuration: done
配置后reboot重启主机!
节点二上:
[root@rac2 disks]# oracleasm configure -i
Configuring the Oracle ASM library driver.
This will configure the on-boot properties of the Oracle ASM library
driver. The following questions will determine whether the driver is
loaded on boot and what permissions it will have. The current values
will be shown in brackets (‘[]’). Hitting without typing an
answer will keep that current value. Ctrl-C will abort.
Default user to own the driver interface [grid]:
Default group to own the driver interface [asmadm]: asmadmin
Start Oracle ASM library driver on boot (y/n) [y]:
Scan for Oracle ASM disks on boot (y/n) [y]:
Writing Oracle ASM library driver configuration: done
配置后reboot重启主机!
oracleasm configure――查看配置
[root@rac2 ~]#oracleasm configure
ORACLEASM_ENABLED=true
ORACLEASM_UID=grid
ORACLEASM_GID=asmadmin
ORACLEASM_SCANBOOT=true
ORACLEASM_SCANORDER=””
ORACLEASM_SCANEXCLUDE=””
ORACLEASM_USE_LOGICAL_BLOCK_SIZE=”false
[root@rac1 soft]# oracleasm init
Loading module “oracleasm”: oracleasm
Mounting ASMlib driver filesystem: /dev/oracleasm
[root@rac1 soft]#
[root@rac2 soft]# oracleasm init
Loading module “oracleasm”: oracleasm
Mounting ASMlib driver filesystem: /dev/oracleasm
[root@rac2 soft]#
在节点一上创建即可,节点二上可以直接扫描出来:
[root@rac1 soft]# oracleasm createdisk CRSVOL /dev/sdb1
Writing disk header: done
Instantiating disk: done
[root@rac1 soft]# oracleasm createdisk DATAVOL /dev/sdc1
Writing disk header: done
Instantiating disk: done
[root@rac1 soft]#
[root@rac1 soft]# oracleasm listdisks
CRSVOL
DATAVOL
[root@rac1 soft]# oracleasm-discover
Using ASMLib from /opt/oracle/extapi/64/asm/orcl/1/libasm.so
[ASM Library - Generic Linux, version 2.0.4 (KABI_V2)]
Discovered disk: ORCL:CRSVOL [2088387 blocks (1069254144 bytes), maxio 512]
Discovered disk: ORCL:DATAVOL [20964762 blocks (10733958144 bytes), maxio 512]
[root@rac1 soft]#
在节点二上直接scandisks后就会出现已创建的asmdisk.
[root@rac2 soft]#oracleasm scandisks
Reloading disk partitions: done
Cleaning any stale ASM disks…
Scanning system for ASM disks…
Instantiating disk “CRSVOL”
Instantiating disk “DATAVOL”
[root@rac2 soft]# oracleasm listdisks
CRSVOL
DATAVOL
[root@rac2 soft]#
[grid@rac1 disks]$ ls -atl /dev/oracleasm/disks――查看属性grid:asmadmin
total 0
brw-rw—- 1 grid asmadmin 8, 33 May 7 08:42 DATAVOL
brw-rw—- 1 grid asmadmin8, 17 May 7 08:42 CRSVOL
drwxr-xr-x 1 root root 0 May 7 08:37 .
drwxr-xr-x 4 root root 0 May 7 08:37 ..