--ADVM
ADVM主要是为了使除了数据库之外的第三方应用程序也可以使用asm存储,这样不限于使asm局限于自家的数据库领域。要想使用ADVM首先必须安装grid,已经创建好了asm磁盘,asm磁盘组。一个advm卷可以占用一个磁盘组的所有空间,也可以占用部分空间,一个advm卷的空间只能来自于一个asm磁盘组,但是一个asm磁盘组可以创建多个advm卷。每次创建的advm卷都会在/dev/asm/目录下产生一个文件,用于创建文件系统。
创建ADVM的方法:
1)asmca创建advm卷--略
2)使用asmcmd下的volcreate命令创建advm卷
[grid@node1 ~]$ asmcmd -p
ASMCMD [+] > volcreate -G ADVMDG -s 2g advm02
ASMCMD [+] > volinfo -G ADVMDG advm02
Diskgroup Name: ADVMDG
Volume Name: ADVM02
Volume Device: /dev/asm/advm02-92
State: ENABLED
Size (MB): 2048
Resize Unit (MB): 32
Redundancy: UNPROT
Stripe Columns: 4
Stripe Width (K): 128
Usage:
Mountpath:
ASMCMD [+] >
3)使用SQL创建advm卷
[grid@node1 ~]$ sqlplus / as sysdba --sqlplus下穿件advm不能使用sysdba权限登录,否则会报权限不足,需要使用sysasm权限
SQL*Plus: Release 11.2.0.4.0 Production on Tue Aug 2 17:17:38 2016
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Real Application Clusters and Automatic Storage Management options
SQL> alter diskgroup advmdg add volume advm03 size 2g;
alter diskgroup advmdg add volume advm03 size 2g
*
ERROR at line 1:
ORA-15032: not all alterations performed
ORA-15260: permission denied on ASM disk group
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Real Application Clusters and Automatic Storage Management options
[grid@node1 ~]$ sqlplus / as sysasm
SQL*Plus: Release 11.2.0.4.0 Production on Tue Aug 2 17:18:51 2016
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Real Application Clusters and Automatic Storage Management options
SQL> alter diskgroup advmdg add volume advm03 size 2g;
Diskgroup altered.
SQL>
>调整卷大小:如果advm卷已经创建了文件系统,那么不可以直接通过grid工具的方法修改卷大小,而只能使用文件系统扩展工具调整卷大小,比如acfsutil size命令。
1)asmca调整卷大小--略
2)asmcmd对应命令调整卷大小:
ASMCMD [+] > volresize -G ADVMDG -s 2g advm03
The requested size is smaller than the current size.
Data corruption may occur.
Are you sure? [y/n]: y
ASMCMD [+] > volinfo -G ADVMDG advm03
Diskgroup Name: ADVMDG
Volume Name: ADVM03
Volume Device: /dev/asm/advm03-92
State: ENABLED
Size (MB): 2048
Resize Unit (MB): 32
Redundancy: UNPROT
Stripe Columns: 4
Stripe Width (K): 128
Usage:
Mountpath:
ASMCMD [+] >
3)SQL命令:
[grid@node1 ~]$ sqlplus / as sysasm
SQL*Plus: Release 11.2.0.4.0 Production on Tue Aug 2 17:32:06 2016
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Real Application Clusters and Automatic Storage Management options
SQL> alter diskgroup advmdg resize volume advm03 size 4g;
Diskgroup altered.
SQL>
>监控ADVM视图
v$asm_file视图只能看到类型(type)为asmvol,看不到卷名,v$asm_alias也看不到卷名:
SQL> select group_number,bytes,type from v$asm_file;
GROUP_NUMBER BYTES TYPE
------------ ---------- ------------------------------
1 1536 ASMPARAMETERFILE
1 272756736 OCRFILE
2 775954432 DATAFILE
2 566239232 DATAFILE
2 99622912 DATAFILE
2 5251072 DATAFILE
2 18497536 CONTROLFILE
2 52429312 ONLINELOG
2 52429312 ONLINELOG
2 33562624 TEMPFILE
2 26222592 DATAFILE
2 52429312 ONLINELOG
2 52429312 ONLINELOG
2 3584 PARAMETERFILE
3 18497536 CONTROLFILE
3 52429312 ONLINELOG
3 52429312 ONLINELOG
3 52429312 ONLINELOG
3 52429312 ONLINELOG
4 2147483648 ASMVOL
4 2147483648 ASMVOL
4 4294967296 ASMVOL
22 rows selected.
*****************专用视图****************v$asm_volume可以看到卷名,卷的状态来自于v$asm_volume_stat视图:******************
SQL> select volume_name,size_mb,state,volume_device,mountpath from v$asm_volume;
VOLUME_NAME SIZE_MB STATE VOLUME_DEVICE MOUNTPATH
--------------- ---------- ------------------------ -------------------------------------------------- --------------------------------------------------
ADVM01 2048 ENABLED /dev/asm/advm01-92
ADVM02 2048 ENABLED /dev/asm/advm02-92
ADVM03 4096 ENABLED /dev/asm/advm03-92
SQL> select volume_name,reads,writes,read_errs,bytes_read,bytes_written from v$asm_volume_stat;
VOLUME_NAME READS WRITES READ_ERRS BYTES_READ BYTES_WRITTEN
--------------- ---------- ---------- ---------- ---------- -------------
ADVM01 35 24803 0 140288 101593088
ADVM02 0 0 0 0 0
ADVM03 0 0 0 0 0
>创建标准文件系统:[root@node1 ~]# mkfs.ext3 /dev/asm/advm01-92
--ACFS
>ACFS不能用于linux根分区,不能用于grid的安装目录,不支持数据库文件(即asm存储的文件),使用acfs要依赖于advm卷。
>格式化ADVM卷的为AFCS文件系统方式:
1)普通方式:
[root@node2 advmdg_advm02]# mkfs.acfs /dev/asm/advm03-92
mkfs.acfs: version = 11.2.0.4.0
mkfs.acfs: on-disk version = 39.0
mkfs.acfs: volume = /dev/asm/advm03-92
mkfs.acfs: volume size = 2147483648
mkfs.acfs: Format complete.
[root@node2 advmdg_advm02]#
挂载命令:可以通过asmca获得
[root@node2 ~]# /bin/mount -t acfs /dev/asm/advm03-92 /u01/app/grid/acfsmounts/advmdg_advm03
2)asmca方式:可以直接将acfs磁盘交给grid自动管理--略。
>acfs管理工具:acfsutil