通过命令行创建ACFS文件系统

其实使用asmca图形创建ACFS文件系统既简单又不容易出错,但是考虑到某些客户场景不允许我们调取图形,所以本文演示下通过命令行创建ACFS文件系统的步骤。
可以通过MOS搜索到下面这篇文档:

  • ASM/ACFS 11.2 How To Create “A CRS Managed” ACFS FileSystem On a Cluster RAC Configuration Through the ASMCA Assistance Or Command-Line (Doc ID 1484221.1)
    以此作为参考,在我自己的环境实际演练下。

1.使用root用户在所有节点创建挂载点

--1.Please create the mount points on all the nodes (as root user):
mkdir /ggs

2.创建ACFS磁盘组(在+ASM1实例上操作)

--2.Connect to the ASM instance & create the ACFS diskgroup (from the +ASM1 instance):
CREATE DISKGROUP ACFS EXTERNAL REDUNDANCY
DISK 'ORCL:ASMDISK18' SIZE 4157 M
DISK 'ORCL:ASMDISK19' SIZE 4157 M
ATTRIBUTE 'compatible.asm' = '11.2', 'compatible.advm' = '11.2';

注意:实际生产强烈建议使用单独的ACFS磁盘组,专门用于创建ACFS集群文件系统。因我这里演示没有额外资源,故借用当前已存在的FRA磁盘组来演示。

3.创建ACFS卷组(在+ASM1实例上操作)

--3.Create the ACFS volume (from the +ASM1 instance)
$ sqlplus / as sysasm
SQL> 
ALTER DISKGROUP FRA ADD VOLUME ggs SIZE 2G;

4.确认卷组已建立

--4.Verify the volume was created and obtain the new volume name:
$ asmcmd
ASMCMD> volinfo -a
Diskgroup Name: FRA

         Volume Name: GGS
         Volume Device: /dev/asm/ggs-57
         State: ENABLED
         Size (MB): 2048
         Resize Unit (MB): 32
         Redundancy: UNPROT
         Stripe Columns: 4
         Stripe Width (K): 128
         Usage: 
         Mountpath: 

ASMCMD> 

5.使用root用户在节点1的新卷上创建ACFS文件系统

--5.From the first node, please create the ACFS filesystem on the new volume ( e.g. “/dev/asm/acfstestvol-76”) as “root” user:
/sbin/mkfs -t acfs -b 4k /dev/asm/ggs-57
mkfs.acfs: version                   = 11.2.0.4.0
mkfs.acfs: on-disk version           = 39.0
mkfs.acfs: volume                    = /dev/asm/ggs-57
mkfs.acfs: volume size               = 2147483648
mkfs.acfs: Format complete.

6.使用root用户添加ACFS文件系统到CRS中

--6.Register the ACFS filesystem & new volume with the CRS as root user:
/opt/app/11.2.0/grid/bin/srvctl add filesystem -d /dev/asm/ggs-57 -g 'FRA' -v ggs -m /ggs -u oracle

7.使用root用户启动ACFS文件系统资源

--7.Start the new ACFS CRS resource (as root user):
/opt/app/11.2.0/grid/bin/srvctl start filesystem -d /dev/asm/ggs-57

8.使用root用户设置属组和权限

--8.Set the desired new ownership and permissions as root user:
chown oracle:oinstall /ggs
chmod 755 /ggs

9.核实ACFS在两边节点都OK

--9.Verify the new ACFS CRS managed filesystem is mounted on both nodes:

Node #1
df -k /ggs
df -TH /ggs

Node #2
df -k /ggs
df -TH /ggs

查看所有节点都挂载成功这个ACFS的文件系统,就可以看到:

[grid@jystdrac1 ~]$ df -k /ggs
Filesystem      1K-blocks  Used Available Use% Mounted on
/dev/asm/ggs-57   2097152 82256   2014896   4% /ggs
[grid@jystdrac1 ~]$ df -TH /ggs
Filesystem      Type  Size  Used Avail Use% Mounted on
/dev/asm/ggs-57 acfs  2.2G   85M  2.1G   4% /ggs

[oracle@jystdrac2 ggs]$ df -k /ggs
Filesystem      1K-blocks  Used Available Use% Mounted on
/dev/asm/ggs-57   2097152 82256   2014896   4% /ggs
[oracle@jystdrac2 ggs]$ df -TH /ggs
Filesystem      Type  Size  Used Avail Use% Mounted on
/dev/asm/ggs-57 acfs  2.2G   85M  2.1G   4% /ggs

10.核实ACFS CRS资源是否正常显示

--10.Verify the ACFS CRS resource is present in the CRS:
crsctl stat res -w  "TYPE = ora.acfs.type"

[grid@jystdrac1 ~]$ crsctl stat res -w  "TYPE = ora.acfs.type"
NAME=ora.fra.ggs.acfs
TYPE=ora.acfs.type
TARGET=ONLINE             , ONLINE
STATE=ONLINE on jystdrac1, ONLINE on jystdrac2
This entry was posted in Oracle日常运维 and tagged . Bookmark the permalink.