目前隻有linux 作業系統上有asmlib 包,其他的系統暫時還沒有。asmlib 簡化磁盤管理,取代原來我們在linux 上常用rawdevices 服務。(也就是說,asmlib是由幾個os庫檔案組成的,用來簡化管理磁盤,安裝了它,不用使用raw devices了)
根據uname –r 檢測結果,下載下傳的驅動程式包名稱與其一緻。務必!!!
1、asmlib的安裝過程
1、檢視核心:
[root@rac2 ~]# uname -a
Linux rac2.lyg.com 2.6.18-164.el5#1 SMP Tue Aug 18 15:51:48 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux
2、Oracle ASMlib下載下傳位址:
http://www.oracle.com/technetwork/server-storage/linux/downloads/index.html
下載下傳以下rpm包(注意rpm包版本和Linux核心版本一緻):
oracleasm-support-2.1.8-1.el5.x86_64
oracleasm-2.6.18-164.el5-2.0.5-1.el5.x86_64
oracleasmlib-2.0.4-1.el5.x86_64
3、安裝(所有節點)
[root@rac2 package]# chmod 755 oracle*
[root@rac2 package]# rpm -ivh oracle*
warning: oracleasm-2.6.18-164.el5-2.0.5-1.el5.x86_64.rpm: HeaderV3 DSA signature: NOKEY, key ID 1e5e0159
Preparing... ########################################### [100%]
1:oracleasm-support ########################################### [ 33%]
2:oracleasm-2.6.18-164.el###########################################[ 67%]
3:oracleasmlib ########################################### [100%]
4、初始化asmlib (在所有節點執行)
[root@rac1 Desktop]# oracleasm configure -i
Configuring the Oracle ASM library driver.
This will configure the on-boot properties of the Oracle ASMlibrary
driver. The followingquestions will determine whether the driver is
loaded on boot and what permissions it will have. The current values
will be shown in brackets ('[]'). Hitting <ENTER> 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 []: oinstall
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
[root@rac1 Desktop]# oracleasm init
Creating /dev/oracleasm mount point: /dev/oracleasm
Loading module "oracleasm": oracleasm
Mounting ASMlib driver filesystem: /dev/oracleasm
在rac2上的操作完全一樣,忽略之。
以上操作執行完成了四大任務:
1 、建立了配置檔案/etc/sysconfig/oracleasm(其實這個是一個軟連接配接,修改的話,要修改那個真實的檔案)
2 、建立了挂載點/dev/oracleasm
3 、加載oracleasm 核心子產品
4 、挂載ASM 函數驅動檔案系統
使用asmlib 管理磁盤後,需要建立一系列磁盤。其實,這不是真正意義上磁盤分區建立,如fdisk 上的建立磁盤操作。這裡隻是一個标記命名。将系統上的磁盤分區在asmlib 的配置檔案中做一個辨別,使得ASMLIB 能加載使用,ASM 執行個體從ASMLIB 中讀取的到。
這點和RAW DEVICES 其實很相似的。不知道性能差異如何?目前沒有測試結果。
建立指令如下,在root 使用者下執行。
在一個節點上以root身份做
我們做如下規劃:
sdb1 OCR-VOTE
sdc1 DATA
sdd1 FRA
[root@rac1 ~]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGIor OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, theprevious
content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will becorrected by w(rite)
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-652, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-652, default 652):
Using default value 652
Command (m for help): p
Disk /dev/sdb: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 652 5237158+ 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@rac1 ~]#
另外兩個盤sdc,sdd以同樣的方式建立。
在rac1節點上以root身份做,建立asm磁盤:
[root@rac1 ~]# oracleasm createdisk OCR_VOTE /dev/sdb1
Writing disk header: done
Instantiating disk: done
[root@rac1 ~]# oracleasm createdisk DATA /dev/sdc1
[root@rac1 ~]# oracleasm createdisk FRA /dev/sdd1
[root@rac1 ~]# oracleasm scandisks
Reloading disk partitions: done
Cleaning any stale ASM disks...
Scanning system for ASM disks...
ASM 磁盤使用oracleasm 工具進行管理。
[root@db4 ~]# oracleasm -h
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
使用oracleasm listdisks 列出所有建立的磁盤。
[root@rac1 ~]# oracleasm listdisks
DATA
FRA
OCR_VOTE
使用oracleasm querydisk 列出某一磁盤的詳細資訊,如指向的哪個磁盤分區。
[root@db4 ~]# oracleasm querydisk
Usage: oracleasm-querydisk [-l <manager>] [-v] [-d|-p] <label>|<device> ...
[root@db4 ~]# oracleasm querydisk vol1
Disk "VOL1" is a valid ASM disk
[root@db4 ~]# oracleasm querydisk -v vol1
[root@db4 ~]# oracleasm querydisk -v -d vol1
Disk "VOL1" is a valid ASM disk on device /dev/sdb1[8,17]
加選項 -v -p, 顯示出實體盤分區。
[root@db4 ~]# oracleasm querydisk -v -p vol1
/dev/sdb1: LABEL="VOL1" TYPE="oracleasm"
/dev/mapper/mpath1p1: LABEL="VOL1" TYPE="oracleasm"
[root@db4 ~]#
ASMLIB 磁盤在10g 環境中,隻有一個用途,給ASM 執行個體使用。在11g 中,增加了ADVM 和ACFS的功能,類似邏輯卷和檔案系統。
我測試了檔案系統,它還是不能給資料庫儲存資料檔案資訊,類似普通的檔案系統,隻是在RAC下多節點可以同時讀取。
在ASM 執行個體中,初始化參數需要注意ASMLIB 的磁盤的挂載點資訊。它的挂載點是/dev/oracleasm/ 。
初始化參數關鍵點如下:
*.asm_diskgroups='VG1','VG2'
*.asm_diskstring='/dev/oracleasm/disks/VOL1','/dev/oracleasm/disks/VOL2'