本例的环境是Redhat linux 5.3,数据库是Oracle 10.2.0.5
1. asm的管理命令oracleasm命令的使用说明
[root@ocmdb1 disks]# oracleasm
Usage: oracleasm [--exec-path=<exec_path>] <command> [ <args> ]
oracleasm --exec-path
oracleasm -h
oracleasm -V
The basic oracleasm commands are:
configure Configure the Oracle Linux ASMLib driver
init Load and initialize the ASMLib driver
exit Stop the ASMLib driver
scandisks Scan the system for Oracle ASMLib disks
status Display the status of the Oracle ASMLib driver
listdisks List known Oracle ASMLib disks
querydisk Determine if a disk belongs to Oracle ASMlib
createdisk Allocate a device for Oracle ASMLib use
deletedisk Return a device to the operating system
renamedisk Change the label of an Oracle ASMlib disk
update-driver Download the latest ASMLib driver
[root@ocmdb1 init.d]# which oracleasm
/usr/sbin/oracleasm
[root@ocmdb1 disks]# cd /etc/init.d
[root@ocmdb1 init.d]# ./oracleasm
Usage: ./oracleasm {start|stop|restart|enable|disable|configure|createdisk|deletedisk|querydisk|listdisks|scandisks|status}
查看oracle使用已经运行
[root@ocmdb1 init.d]# lsmod |grep oracleasm
oracleasm 46356 1
2. 查询操作系统的磁盘情况,文件系统的挂载情况
[root@ocmdb1 init.d]# fdisk -l
Disk /dev/sda: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device BootStartEnd Blocks Id System
/dev/sda1 * 1 6 48163+ 83 Linux
/dev/sda2 7 515 4088542+ 83 Linux
/dev/sda3 516 776 2096482+ 82 Linux swap / Solaris
/dev/sda4 777 1305 4249192+ 5 Extended
/dev/sda5 777 1305 4249161 83 Linux
Disk /dev/sdb: 4294 MB, 4294967296 bytes
255 heads, 63 sectors/track, 522 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device BootStartEnd Blocks Id System
/dev/sdb1 1 522 4192933+ 83 Linux
[root@ocmdb1 init.d]# df -ha
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 3.8G 2.0G 1.7G 55% /
proc 000 - /proc
…..
oracleasmfs00 0 - /dev/oracleasm
3. 查询asm的状态和asm的磁盘信息
[root@ocmdb1 init.d]# ./oracleasm status
Checking if ASM is loaded: yes
Checking if /dev/oracleasm is mounted: yes
[root@ocmdb1 init.d]# ./oracleasm listdisks
VOL1
[root@ocmdb1 init.d]# ./oracleasm querydisk VOL1
Disk "VOL1" is a valid ASM disk
到目前为止,无法知道VOL1与物理磁盘分区的对应关系,也就说VOL1到底对应于操作系统的设备(/dev/sda5,…/dev/sdb1)需要进一步确定.
4. 确定asm磁盘与操作系统磁盘设备的对应关系.
[root@ocmdb1 disks]# cd /dev/oracleasm/disks
[root@ocmdb1 disks]# ls -lt
total 0
brw-rw---- 1 oracle dba 8, 17 Jan 14 19:06 VOL1
[root@ocmdb1 disks]# cd /dev
[root@ocmdb1 dev]# ls -lt sd*
brw-r----- 1 root disk 8, 17 Jan 14 19:10 sdb1
brw-r----- 1 root disk 8, 1 Jan 14 19:06 sda1
brw-r----- 1 root disk 8, 5 Jan 14 19:06 sda5
brw-r----- 1 root disk 8, 2 Jan 14 19:06 sda2
brw-r----- 1 root disk 8, 0 Jan 14 19:05 sda
brw-r----- 1 root disk 8, 3 Jan 14 19:05 sda3
brw-r----- 1 root disk 8, 4 Jan 14 19:05 sda4
brw-r----- 1 root disk 8, 16 Jan 14 19:05 sdb
可以看到/dev/sdb1,/dev/oracleasm/disks/VOL1两个设备的设备号8,17是相同的,说明它们是一一对应的关系.
通过oracleasm命令也可以查询出这种对应关系.
[root@ocmdb1 dev]# oracleasm listdisks
VOL1
[root@ocmdb1 dev]# oracleasm querydisk -d VOL1
Disk "VOL1" is a valid ASM disk on device /dev/sdb1[8,17]
[root@ocmdb1 dev]# oracleasm querydisk /dev/sdb1
Device "/dev/sdb1" is marked an ASM disk with the label "VOL1"
[root@ocmdb1 dev]# oracleasm querydisk -d VOL1
Disk "VOL1" is a valid ASM disk on device [8, 17]
[root@ocmdb1 dev]# oracleasm querydisk /dev/sda5
Device "/dev/sda5" is not marked as an ASM disk ##/dev/sda5不是asm盘