ACFS简单介绍
Oracle ACFS:Oracle Automatic Storage Management Cluster File System(Oracle自动存储管理集群文件系统)是一种基于ASM的集群文件系统,支持多节点共享。Oracle ACFS提供了动态文件系统大小调整,通过跨所有可用存储的分布、平衡和条带化技术提高了性能,并通过Oracle ASM的镜像和奇偶校验保护提供了存储可靠性。
ADVM: ACFS文件系统使用的一种卷格式,Oracle ACFS通过Oracle ADVM接口与Oracle ASM通信。
使用ACFS目的是让数据库之外的第三方应用也可以使用asm存储,比如OGG软件可以安装在ACFS上,实现高可用。
查看ACFS模块
检查是否加载ACFS模块
# lsmod |grep -i oracle
oracleacfs 5222400 0
oracleadvm 729088 0
oracleoks 761856 2 oracleadvm,oracleacfs
如果没有加载,则使用下面的命令进行启动,RAC所有节点都要单独执行
# /u01/app/19.3.0/grid/bin/acfsload start
ACFS-9391: Checking for existing ADVM/ACFS installation.
ACFS-9392: Validating ADVM/ACFS installation files for operating system.
ACFS-9393: Verifying ASM Administrator setup.
ACFS-9308: Loading installed ADVM/ACFS drivers.
ACFS-9325: Driver OS kernel version = 5.4.17-2011.0.7.el7uek.x86_64.
ACFS-9326: Driver build number = 231203.
ACFS-9231: Driver build version = 19.0.0.0.0 (19.22.0.0.0).
ACFS-9547: Driver available build number = 231203.
ACFS-9232: Driver available build version = 19.0.0.0.0 (19.22.0.0.0).
ACFS-9549: Kernel and command versions.
Kernel:Build version: 19.0.0.0.0Build full version: 19.22.0.0.0Build hash: 9256567290Bug numbers: NoTransactionInformation
Commands:Build version: 19.0.0.0.0Build full version: 19.22.0.0.0Build hash: 9256567290Bug numbers: NoTransactionInformation
ACFS-9327: Verifying ADVM/ACFS devices.
ACFS-9156: Detecting control device '/dev/asm/.asm_ctl_spec'.
ACFS-9156: Detecting control device '/dev/ofsctl'.
ACFS-9294: updating file /etc/sysconfig/oracledrivers.conf
ACFS-9322: completed
检查磁盘组的compatibility,要大于或等于11.2
SQL> col name for a20;
SQL> col COMPATIBILITY for a20;
SQL> set linesize 200;
SQL> select name,compatibility from v$asm_diskgroup;NAME COMPATIBILITY
-------------------- --------------------
DATA 19.0.0.0.0
OCR 19.0.0.0.0
创建ACFS方法
图形化方式创建
创建advm卷
使用asmca,调出图形,进行创建
[grid@rac19c01:~]$ asmca
右击“Volumes”,选择“create”,输入卷名和大小
查看advm卷
[grid@rac19c01:~]$ crsctl stat res -t
--------------------------------------------------------------------------------
Name Target State Server State details
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATA.OGG.advmONLINE ONLINE rac19c01 STABLEONLINE ONLINE rac19c02 STABLE
创建ACFS并挂载
创建挂载点
[root@rac19c01:~]# mkdir /ogg
[root@rac19c01:~]# chown oracle.oinstall /ogg
root执行脚本
[root@rac19c01:~]# sh /u01/app/grid/cfgtoollogs/asmca/scripts/acfs_script.sh
ACFS file system /ogg is mounted on nodes rac19c01,rac19c02
集群层面查看acfs挂载情况
[grid@rac19c01:~]$ crsctl stat res -t
--------------------------------------------------------------------------------
Name Target State Server State details
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATA.OGG.advmONLINE ONLINE rac19c01 STABLEONLINE ONLINE rac19c02 STABLE
ora.LISTENER.lsnrONLINE ONLINE rac19c01 STABLEONLINE ONLINE rac19c02 STABLE
ora.chadONLINE ONLINE rac19c01 STABLEONLINE ONLINE rac19c02 STABLE
ora.data.ogg.acfsONLINE ONLINE rac19c01 mounted on /ogg,STABLEONLINE ONLINE rac19c02 mounted on /ogg,STABLE
命令行方式创建
创建advm卷
# su - grid
$ asmcmd volcreate -G data -s 2G ogg或使用sqlplus命令行创建
$ sqlplus / as sysasm
SQL> alter diskgroup DATA add volume ogg size 2g;
本次创建2G大小的空间,如果你的空间需要更大,按实际调整即可,ACFS支持大空间创建,只要你的ASM磁盘组剩余空间足够。
查看advm信息
$ asmcmd volinfo --all
Diskgroup Name: DATAVolume Name: OGGVolume Device: /dev/asm/ogg-172State: ENABLEDSize (MB): 2048Resize Unit (MB): 64Redundancy: UNPROTStripe Columns: 8Stripe Width (K): 1024Usage: ACFSMountpath: /ogg
或
$ asmcmd volinfo -G data ogg
Diskgroup Name: DATAVolume Name: OGGVolume Device: /dev/asm/ogg-172State: ENABLEDSize (MB): 2048Resize Unit (MB): 64Redundancy: UNPROTStripe Columns: 8Stripe Width (K): 1024Usage: Mountpath:
或
$ sqlplus / as sysasmSQL*Plus: Release 19.0.0.0.0 - Production on Wed Dec 4 22:52:23 2024
Version 19.22.0.0.0Copyright (c) 1982, 2023, Oracle. All rights reserved.Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.22.0.0.0SQL> SELECT volume_name, volume_device FROM V$ASM_VOLUME;VOLUME_NAME
--------------------------------------------------------------------------------
VOLUME_DEVICE
--------------------------------------------------------------------------------
OGG
/dev/asm/ogg-172
创建ACFS文件系统
[grid@rac19c02:~]$ ls -l /dev/asm/ogg-172
brwxrwx--- 1 root asmadmin 251, 88065 Dec 4 22:50 /dev/asm/ogg-172
[grid@rac19c02:~]$ /sbin/mkfs -t acfs /dev/asm/ogg-172
mkfs.acfs: version = 19.0.0.0.0
mkfs.acfs: on-disk version = 46.0
mkfs.acfs: volume = /dev/asm/ogg-172
mkfs.acfs: volume size = 2147483648 ( 2.00 GB )
mkfs.acfs: Format complete.
注册文件系统并挂载
如果不被集群所管理,每次集群重启不会进行自动挂载,需将其写在/etc/fstab中。
使用srvctl命令注册文件系统:
# /u01/app/19.3.0/grid/bin/srvctl add filesystem -device /dev/asm/ogg-172 -path /ogg -user grid,oracle
查看注册信息:
# su - grid
[grid@rac19c01:~]$ crsctl stat res -t
--------------------------------------------------------------------------------
Name Target State Server State details
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATA.OGG.advmONLINE ONLINE rac19c01 STABLEONLINE ONLINE rac19c02 STABLE
ora.LISTENER.lsnrONLINE ONLINE rac19c01 STABLEONLINE ONLINE rac19c02 STABLE
ora.chadONLINE ONLINE rac19c01 STABLEONLINE ONLINE rac19c02 STABLE
ora.data.ogg.acfsOFFLINE OFFLINE rac19c01 STABLEOFFLINE OFFLINE rac19c02 STABLE
注册完,服务状态为OFFLINE,启动服务,启动完会自动挂载
$ srvctl start filesystem -device /dev/asm/ogg-172
或使用acfsutil registry注册并自动挂载
# /sbin/acfsutil registry -a /dev/asm/ogg-172 /ogg
acfsutil registry: mount point /ogg successfully added to Oracle Registry
查看注册信息:
$ crsctl stat res -t
--------------------------------------------------------------------------------
Name Target State Server State details
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATA.OGG.advmONLINE ONLINE rac19c01 STABLEONLINE ONLINE rac19c02 STABLE
ora.LISTENER.lsnrONLINE ONLINE rac19c01 STABLEONLINE ONLINE rac19c02 STABLE
ora.chadONLINE ONLINE rac19c01 STABLEONLINE ONLINE rac19c02 STABLE
ora.data.ogg.acfsONLINE ONLINE rac19c01 mounted on /ogg,STABLEONLINE ONLINE rac19c02 mounted on /ogg,STABLE
检查挂载状态
使用下列的命令检查挂载情况:
df -h
crsctl stat res -t
crsctl stat res ora.proxy_advm -t
crsctl stat res ora.DATA.OGG.advm -t
crsctl stat res ora.data.ogg.acfs -t
示例:
[grid@rac19c01:~]$ crsctl stat res ora.proxy_advm -t
--------------------------------------------------------------------------------
Name Target State Server State details
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.proxy_advmONLINE ONLINE rac19c01 STABLEONLINE ONLINE rac19c02 STABLE
--------------------------------------------------------------------------------
[grid@rac19c01:~]$ crsctl stat res ora.DATA.OGG.advm -t
--------------------------------------------------------------------------------
Name Target State Server State details
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATA.OGG.advmONLINE ONLINE rac19c01 STABLEONLINE ONLINE rac19c02 STABLE
--------------------------------------------------------------------------------
[grid@rac19c01:~]$ crsctl stat res ora.data.ogg.acfs -t
--------------------------------------------------------------------------------
Name Target State Server State details
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.data.ogg.acfsONLINE ONLINE rac19c01 mounted on /ogg,STABLEONLINE ONLINE rac19c02 mounted on /ogg,STABLE
--------------------------------------------------------------------------------
ACFS管理维护
取消注册
取消注册(取消后就不会自动挂载)
# /sbin/acfsutil registry -d /ogg
acfsutil registry: successfully removed ACFS mount point /ogg from Oracle Registry
注册
[root@rac19c02:~]# /sbin/acfsutil registry -a /dev/asm/ogg-172 /ogg
acfsutil registry: mount point /ogg successfully added to Oracle Registry
ACFS文件系统扩大和缩小
https://docs.oracle.com/en/database/oracle/oracle-database/19/ostmg/acfs-commands-utilities.html#GUID-79A8333D-4E1C-4788-944D-EC86E4278C00
--扩大
[root@rac19c02:~]# acfsutil size +1G /ogg
acfsutil size: new file system size: 3221225472 (3072MB)
[root@rac19c02:~]# df -h |grep ogg
/dev/asm/ogg-172 3.0G 555M 2.5G 19% /ogg--缩小
[root@rac19c01:~]# acfsutil size -1G /ogg
acfsutil size: new file system size: 2147483648 (2048MB)
[root@rac19c01:~]# df -h|grep ogg
/dev/asm/ogg-172 2.0G 428M 1.6G 21% /ogg
删除ACFS
(1)取消注册
# /sbin/acfsutil registry -d /ogg
acfsutil registry: successfully removed ACFS mount point /ogg from Oracle Registry
(2)如果还没卸载掉,手动取消挂载,否则忽略
# umount /ogg
(3)删除文件系统
# /sbin/acfsutil rmfs /dev/asm/ogg-172
(4)删除ADVM
# su - grid
[grid@rac19c01:~]$ asmcmd voldisable -G data ogg
[grid@rac19c01:~]$ asmcmd voldelete -G data ogg
#也可以直接删除,不执行disable也行
(5)删除挂载点
rm -rf /ogg
(6)移除proxy asm instance
[grid@rac19c01:~]$ srvctl stop asm -proxy
[grid@rac19c01:~]$ srvctl remove asm -proxy
关注我,学习更多的数据库知识!