確定asm磁碟與物理磁碟的對應關係

djb1008發表於2012-01-15

本例的環境是Redhat linux 5.3,資料庫是Oracle 10.2.0.5

1. asm的管理命令oracleasm命令的使用說明

[root@ocmdb1 disks]# oracleasm

Usage: oracleasm [--exec-path=] [ ]

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

[@more@]

[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 Boot Start End 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 Boot Start End 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 0 0 0 - /proc

…..

oracleasmfs 0 0 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 VOL1

Disk "VOL1" is a valid ASM disk

[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盤

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/32980/viewspace-1057131/,如需轉載,請註明出處,否則將追究法律責任。

相關文章