共计 40302 个字符,预计需要花费 101 分钟才能阅读完成。
ACFS 是什么,Oracle 官方定义:
Oracle AutomaticStorage Management Cluster File System (Oracle ACFS) is a multi-platform,scalable file system, and storage management technology that extends OracleAutomatic Storage Management (Oracle ASM) functionality to support customerfiles maintained outside of Oracle Database. Oracle ACFS supports many databaseand application files, including executables,database trace files, databasealert logs, application reports, BFILEs, and configuration files. Othersupported files are video, audio, text, images, engineering drawings, and othergeneral-purpose application file data.
下面来介绍下 Oracle 11gR2 RAC 环境下 ACFS 的使用,当前系统环境操作系统版本为 OEL6.5,数据库版本为 Oracle 11.2.0.4。
1. 查看 ACFS 相关的服务
查看 acfs/advm 驱动是否加载
[root@linuxidc1 bin]#lsmod |grep oracle
[root@linuxidc1 bin]#
[root@linuxidc2 bin]#lsmod |grep oracle
[root@linuxidc2 bin]#
查看集群资源
[root@linuxidc1 ~]# su- grid -c crs_stat|grep acfs
[root@linuxidc1 ~]#
[root@linuxidc2 ~]# su- grid -c crs_stat|grep acfs
[root@linuxidc2 ~]#
使用 acfsload 加载驱动
[root@linuxidc1 bin]#./acfsload start -s
ACFS-9459:ADVM/ACFS is not supported on this OS version: ‘3.8.13-16.2.1.el6uek.x86_64’
[root@linuxidc1 bin]#uname -a
Linux linuxidc13.8.13-16.2.1.el6uek.x86_64 #1 SMP Thu Nov 7 17:01:44 PST 2013 x86_64 x86_64x86_64 GNU/Linux
[root@linuxidc1 bin]#
从报错信息中可以看出,OEL6.5 操作系统 11204 数据库并未被支持。升级数据库版本,打补丁 11204.7 后驱动可以被加载,但不能被系统自动加载。处理如下:
[root@linuxidc1 ~]# cat/etc/init.d/acfsload
#!/bin/sh
# chkconfig: 234530 21
# description: LoadOracle ASM volume driver on system startup
ORACLE_HOME=/u01/app/11.2.0/grid
export ORACLE_HOME
$ORACLE_HOME/bin/acfsloadstart -s
[root@linuxidc1 ~]# chkconfigadd acfsload
[root@linuxidc1 ~]#chkconfig –list|grep acfsload
acfsload 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@linuxidc1 ~]#
[root@linuxidc1 bin]#./acfsload start -s
[root@linuxidc1 bin]#lsmod |grep oracle
oracleacfs 877320 0
oracleadvm 221760 0
oracleoks 276880 2 oracleacfs,oracleadvm
[root@linuxidc2bin]# lsmod |grep oracle
oracleacfs 877192 0
oracleadvm 221504 0
oracleoks 277008 2 oracleacfs,oracleadvm
[root@linuxidc2 bin]#
添加资源 ora.registry.acfs
[root@linuxidc1 ~]#/u01/app/11.2.0/grid/bin/crsctl add type ora.registry.acfs.type -basetypeora.local_resource.type -file/u01/app/11.2.0/grid/crs/template/registry.acfs.type
[root@linuxidc1 ~]# /u01/app/11.2.0/grid/bin/crsctladd resource ora.registry.acfs -attrACL=\’owner:root:rwx,pgrp:oinstall:r-x,other::r–\’ -typeora.registry.acfs.type -f
[root@linuxidc1 ~]#
查看是否添加成功
[root@linuxidc1 ~]# su- grid -c crs_stat | grep acfs
NAME=ora.registry.acfs
TYPE=ora.registry.acfs.type
[root@linuxidc1 ~]#
[root@linuxidc2 ~]# su- grid -c crs_stat | grep acfs
NAME=ora.registry.acfs
TYPE=ora.registry.acfs.type
[root@linuxidc2 ~]#
查看添加的资源状态。
[grid@linuxidc1 ~]$crsctl stat res -t
———————————————————————
NAME TARGET STATE SERVER STATE_DETAILS
Local Resources
———————————————————————
ora.ARCH.dg
ONLINE ONLINE linuxidc1
ONLINE ONLINE linuxidc2
ora.CRS.dg
ONLINE ONLINE linuxidc1
ONLINE ONLINE linuxidc2
ora.DATA.dg
ONLINE ONLINE linuxidc1
ONLINE ONLINE linuxidc2
ora.LISTENER.lsnr
ONLINE ONLINE linuxidc1
ONLINE ONLINE linuxidc2
ora.asm
ONLINE ONLINE linuxidc1 Started
ONLINE ONLINE linuxidc2 Started
ora.gsd
OFFLINE OFFLINE linuxidc1
OFFLINE OFFLINE linuxidc2
ora.net1.network
ONLINE ONLINE linuxidc1
ONLINE ONLINE linuxidc2
ora.ons
ONLINE ONLINE linuxidc1
ONLINE ONLINE linuxidc2
ora.registry.acfs
OFFLINE OFFLINE linuxidc1
OFFLINE OFFLINE linuxidc2
Cluster Resources
———————————————————————
ora.LISTENER_SCAN1.lsnr
1 ONLINE ONLINE linuxidc2
ora.cvu
1 ONLINE ONLINE linuxidc2
ora.linuxidc.db
1 ONLINE ONLINE linuxidc1 Open
2 ONLINE ONLINE linuxidc2 Open
ora.linuxidc1.vip
1 ONLINE ONLINE linuxidc1
ora.linuxidc2.vip
1 ONLINE ONLINE linuxidc2
ora.oc4j
1 ONLINE ONLINE linuxidc2
ora.scan1.vip
1 ONLINE ONLINE linuxidc2
[grid@linuxidc1 ~]$
添加的 ora.registry.acfs 资源默认 offline,需手工启动。
[grid@linuxidc1 ~]$crsctl start resource ora.registry.acfs -n linuxidc1
CRS-2672:Attempting to start ‘ora.registry.acfs’ on ‘linuxidc1’
CRS-2676: Start of’ora.registry.acfs’ on ‘linuxidc1’ succeeded
[grid@linuxidc1 ~]$crsctl start resource ora.registry.acfs -n linuxidc2
CRS-2672:Attempting to start ‘ora.registry.acfs’ on ‘linuxidc2’
CRS-2676: Start of’ora.registry.acfs’ on ‘linuxidc2’ succeeded
启动后查看状态如下,已为 online 状态。
[grid@linuxidc1 ~]$crsctl stat res -t
———————————————————————
NAME TARGET STATE SERVER STATE_DETAILS
———————————————————————
Local Resources
ora.ARCH.dg
ONLINE ONLINE linuxidc1
ONLINE ONLINE linuxidc2
ora.CRS.dg
ONLINE ONLINE linuxidc1
ONLINE ONLINE linuxidc2
ora.DATA.dg
ONLINE ONLINE linuxidc1
ONLINE ONLINE linuxidc2
ora.LISTENER.lsnr
ONLINE ONLINE linuxidc1
ONLINE ONLINE linuxidc2
ora.asm
ONLINE ONLINE linuxidc1 Started
ONLINE ONLINE linuxidc2 Started
ora.gsd
OFFLINE OFFLINE linuxidc1
OFFLINE OFFLINE linuxidc2
ora.net1.network
ONLINE ONLINE linuxidc1
ONLINE ONLINE linuxidc2
ora.ons
ONLINE ONLINE linuxidc1
ONLINE ONLINE linuxidc2
ora.registry.acfs
ONLINE ONLINE linuxidc1
ONLINE ONLINE linuxidc2
———————————————————————ClusterResources
———————————————————————
ora.LISTENER_SCAN1.lsnr
1 ONLINE ONLINE linuxidc2
ora.cvu
1 ONLINE ONLINE linuxidc2
ora.linuxidc.db
1 ONLINE ONLINE linuxidc1 Open
2 ONLINE ONLINE linuxidc2 Open
ora.linuxidc1.vip
1 ONLINE ONLINE linuxidc1
ora.linuxidc2.vip
1 ONLINE ONLINE linuxidc2
ora.oc4j
1 ONLINE ONLINE linuxidc2
ora.scan1.vip
1 ONLINE ONLINE linuxidc2
[grid@linuxidc1 ~]$
2. 使用 ASMCMD 命令创建 ACFS
(1)、使用 volcreate 命令创建 vol01,大小为 30G;
ASMCMD>volcreate -G data -s 30G testvol
(2)、使用 volinfo 查看 vol01 的相关信息
ASMCMD> volinfo-G data testvol
Diskgroup Name:DATA
Volume Name: TESTVOL
Volume Device: /dev/asm/testvol-347
State: ENABLED
Size (MB): 30720
Resize Unit (MB): 32
Redundancy: UNPROT
Stripe Columns: 4
Stripe Width (K): 128
Usage:
Mountpath:
ASMCMD>
(2)、使用操作系统命令查看设备名,这里的 /dev/asm/ testvol-347 相当于裸设备。
[grid@linuxidc1 ~]$ cd/dev/asm/
[grid@linuxidc1 asm]$ls -l
total 0
brwxrwx— 1 rootasmadmin 251, 177665 Oct 28 13:20 testvol-347
[grid@linuxidc1 asm]$
(3)、在 v$asm_volume 视图中使用 sql 查看 volume 相关信息
[grid@linuxidc1 asm]$sqlplus / as sysasm
SQL*Plus: Release11.2.0.4.0 Production on Fri Oct 28 13:22:33 2016
Copyright (c) 1982,2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11gEnterprise Edition Release 11.2.0.4.0 – 64bit Production
With the RealApplication Clusters and Automatic Storage Management options
SQL> selectvolume_name,volume_device,size_mb from v$asm_volume;
VOLUME_NAME VOLUME_DEVICE SIZE_MB
———————————————————
TESTVOL /dev/asm/testvol-347 30720
SQL>
(4)、格式化卷,创建文件系统
[root@linuxidc1 ~]#mkfs.acfs /dev/asm/testvol-347
mkfs.acfs:version = 11.2.0.4.0
mkfs.acfs: on-diskversion = 39.0
mkfs.acfs:volume =/dev/asm/testvol-347
mkfs.acfs: volumesize = 32212254720
mkfs.acfs: Formatcomplete.
[root@linuxidc1 ~]#
(5)、注册 ACFS 文件系统,相当于定义挂载点,仅在节点 1 注册一次即可
[root@linuxidc1~]#acfsutil registry -a /dev/asm/testvol-347/u01/app/grid/acfsmounts/data_testvol/
acfsutil registry:mount point /u01/app/grid/acfsmounts/data_testvol successfully added to OracleRegistry
查看文件系统信息
[root@linuxidc1 ~]#acfsutil info fs
/u01/app/grid/acfsmounts/data_testvol
ACFS Version: 11.2.0.4.0
flags: MountPoint,Available
mount time: Fri Oct 28 13:37:27 2016
volumes: 1
total size: 32212254720
total free: 32068386816
primary volume: /dev/asm/testvol-347
label:
flags: Primary,Available,ADVM
on-disk version: 39.0
allocation unit: 4096
major, minor: 251, 177665
size: 32212254720
free: 32068386816
ADVM diskgroup DATA
ADVM resize increment: 33554432
ADVM redundancy: unprotected
ADVM stripe columns: 4
ADVM stripe width: 131072
number of snapshots: 0
snapshot space usage: 0
replication status: DISABLED
[root@linuxidc1 ~]#
(6)、注册成功后自动挂载文件系统,两节点查看如下:
[root@linuxidc1 ~]# df-h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root 532G 34G 476G 7% /
tmpfs 16G 255M 16G 2% /dev/shm
/dev/sda1 477M 55M 397M 13% /boot
/dev/asm/testvol-347 30G 138M 30G 1% /u01/app/grid/acfsmounts/data_testvol
[root@linuxidc1 ~]#
[root@linuxidc2 ~]# df-h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root 533G 24G 487G 5% /
tmpfs 16G 254M 16G 2% /dev/shm
/dev/sda1 477M 55M 397M 13% /boot
/dev/asm/testvol-347 30G 138M 30G 1%/u01/app/grid/acfsmounts/data_testvol
[root@linuxidc2 ~]#
图形界面查看状态如下
更多详情见请继续阅读下一页的精彩内容:http://www.linuxidc.com/Linux/2017-03/141357p2.htm
再次查看集群资源状态
[grid@linuxidc1 ~]$crsctl stat res -t
———————————————————————
NAME TARGET STATE SERVER STATE_DETAILS
———————————————————————
Local Resources
———————————————————————ora.ARCH.dg
ONLINE ONLINE linuxidc1
ONLINE ONLINE linuxidc2
ora.CRS.dg
ONLINE ONLINE linuxidc1
ONLINE ONLINE linuxidc2
ora.DATA.dg
ONLINE ONLINE linuxidc1
ONLINE ONLINE linuxidc2
ora.LISTENER.lsnr
ONLINE ONLINE linuxidc1
ONLINE ONLINE linuxidc2
ora.asm
ONLINE ONLINE linuxidc1 Started
ONLINE ONLINE linuxidc2 Started
ora.gsd
OFFLINE OFFLINE linuxidc1
OFFLINE OFFLINE linuxidc2
ora.net1.network
ONLINE ONLINE linuxidc1
ONLINE ONLINE linuxidc2
ora.ons
ONLINE ONLINE linuxidc1
ONLINE ONLINE linuxidc2
ora.registry.acfs
ONLINE ONLINE linuxidc1
ONLINE ONLINE linuxidc2
———————————————————————
Cluster Resources
———————————————————————ora.LISTENER_SCAN1.lsnr
1 ONLINE ONLINE linuxidc2
ora.cvu
1 ONLINE ONLINE linuxidc2
ora.linuxidc.db
1 ONLINE ONLINE linuxidc1 Open
2 ONLINE ONLINE linuxidc2 Open
ora.linuxidc1.vip
1 ONLINE ONLINE linuxidc1
ora.linuxidc2.vip
1 ONLINE ONLINE linuxidc2
ora.oc4j
1 ONLINE ONLINE linuxidc2
ora.scan1.vip
1 ONLINE ONLINE linuxidc2
[grid@linuxidc1 ~]$
3. asmca 图形界面创建
切换到 grid 用户下,执行 asmca 启动图形界面进行配置
启动图形界面后,点击 asm instance 可以看到 advm driver 状态为 loaded。若 acfs 与 advm 驱动未加载时,状态为 installed,volumes 与 asmcluster file systems 标签栏为灰色无法点击。点击 volumes 标签,创建卷。
图中为使用命令创建成功的卷。再次点击 create
指定卷名为 linuxidcvol,大小为 25G, 点击 OK。
创建成功,点击 ok 退出,显示如下:
点击 asm clusterfile systems 标签
点击 create, 选择刚才创建的卷,选择 database home file system 选项,并指定图中所示挂载点。选择该选项该文件系统将作为集群资源被注册在集群中,由集群进行管理。
点击 ok,创建 ACFS 文件系统。点击 ok 执行的命令如下
Create ACFSCommand:
/sbin/mkfs -t acfs/dev/asm/linuxidc-347
Following commandsshould be run as privileged user :
/u01/app/11.2.0/grid/bin/srvctladd filesystem -d /dev/asm/linuxidc-347 -g ‘DATA’ -v linuxidcvol -m/u01/app/grid/acfsmounts/data_linuxidcvol -u grid
/u01/app/11.2.0/grid/bin/srvctlstart filesystem -d /dev/asm/linuxidc-347
chown grid:oinstall/u01/app/grid/acfsmounts/ data_linuxidcvol
chmod 775/u01/app/grid/acfsmounts/data_linuxidcvol
根据提示使用 root 账户在 ASMCA 图形界面启动的节点上执行途中所示命令,如下:
[root@linuxidc1 ~]#/u01/app/grid/cfgtoollogs/asmca/scripts/acfs_script.sh
ACFS file system isrunning on linuxidc1,jxcw2
[root@linuxidc1 ~]#
备注:途中所执行脚本内容如下:
[root@linuxidc1 ~]# vi/u01/app/grid/cfgtoollogs/asmca/scripts/acfs_script.sh
#!/bin/sh
/u01/app/11.2.0/grid/bin/srvctlstop filesystem -d /dev/asm/linuxidcvol-347
/u01/app/11.2.0/grid/bin/srvctlremove filesystem -d /dev/asm/linuxidcvol-347
/u01/app/11.2.0/grid/bin/srvctladd filesystem -d /dev/asm/linuxidcvol-347 -g ‘DATA’ -v linuxidcVOL -m/u01/app/grid/acfsmounts/data_linuxidcvol -u grid
if [$? =”0″ -o $? = “2”]; then
/u01/app/11.2.0/grid/bin/srvctl startfilesystem -d /dev/asm/linuxidcvol-347
if [$? = “0”]; then
chown grid:oinstall/u01/app/grid/acfsmounts/data_linuxidcvol
chmod 775/u01/app/grid/acfsmounts/data_linuxidcvol
/u01/app/11.2.0/grid/bin/srvctl statusfilesystem -d /dev/asm/linuxidcvol-347
exit 0
fi
/u01/app/11.2.0/grid/bin/srvctl statusfilesystem -d /dev/asm/linuxidcvol-347
fi
执行成功在两节点分别查看,新加 ACFS 文件系统已被挂载。
ACFS 是什么,Oracle 官方定义:
Oracle AutomaticStorage Management Cluster File System (Oracle ACFS) is a multi-platform,scalable file system, and storage management technology that extends OracleAutomatic Storage Management (Oracle ASM) functionality to support customerfiles maintained outside of Oracle Database. Oracle ACFS supports many databaseand application files, including executables,database trace files, databasealert logs, application reports, BFILEs, and configuration files. Othersupported files are video, audio, text, images, engineering drawings, and othergeneral-purpose application file data.
下面来介绍下 Oracle 11gR2 RAC 环境下 ACFS 的使用,当前系统环境操作系统版本为 OEL6.5,数据库版本为 Oracle 11.2.0.4。
1. 查看 ACFS 相关的服务
查看 acfs/advm 驱动是否加载
[root@linuxidc1 bin]#lsmod |grep oracle
[root@linuxidc1 bin]#
[root@linuxidc2 bin]#lsmod |grep oracle
[root@linuxidc2 bin]#
查看集群资源
[root@linuxidc1 ~]# su- grid -c crs_stat|grep acfs
[root@linuxidc1 ~]#
[root@linuxidc2 ~]# su- grid -c crs_stat|grep acfs
[root@linuxidc2 ~]#
使用 acfsload 加载驱动
[root@linuxidc1 bin]#./acfsload start -s
ACFS-9459:ADVM/ACFS is not supported on this OS version: ‘3.8.13-16.2.1.el6uek.x86_64’
[root@linuxidc1 bin]#uname -a
Linux linuxidc13.8.13-16.2.1.el6uek.x86_64 #1 SMP Thu Nov 7 17:01:44 PST 2013 x86_64 x86_64x86_64 GNU/Linux
[root@linuxidc1 bin]#
从报错信息中可以看出,OEL6.5 操作系统 11204 数据库并未被支持。升级数据库版本,打补丁 11204.7 后驱动可以被加载,但不能被系统自动加载。处理如下:
[root@linuxidc1 ~]# cat/etc/init.d/acfsload
#!/bin/sh
# chkconfig: 234530 21
# description: LoadOracle ASM volume driver on system startup
ORACLE_HOME=/u01/app/11.2.0/grid
export ORACLE_HOME
$ORACLE_HOME/bin/acfsloadstart -s
[root@linuxidc1 ~]# chkconfigadd acfsload
[root@linuxidc1 ~]#chkconfig –list|grep acfsload
acfsload 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@linuxidc1 ~]#
[root@linuxidc1 bin]#./acfsload start -s
[root@linuxidc1 bin]#lsmod |grep oracle
oracleacfs 877320 0
oracleadvm 221760 0
oracleoks 276880 2 oracleacfs,oracleadvm
[root@linuxidc2bin]# lsmod |grep oracle
oracleacfs 877192 0
oracleadvm 221504 0
oracleoks 277008 2 oracleacfs,oracleadvm
[root@linuxidc2 bin]#
添加资源 ora.registry.acfs
[root@linuxidc1 ~]#/u01/app/11.2.0/grid/bin/crsctl add type ora.registry.acfs.type -basetypeora.local_resource.type -file/u01/app/11.2.0/grid/crs/template/registry.acfs.type
[root@linuxidc1 ~]# /u01/app/11.2.0/grid/bin/crsctladd resource ora.registry.acfs -attrACL=\’owner:root:rwx,pgrp:oinstall:r-x,other::r–\’ -typeora.registry.acfs.type -f
[root@linuxidc1 ~]#
查看是否添加成功
[root@linuxidc1 ~]# su- grid -c crs_stat | grep acfs
NAME=ora.registry.acfs
TYPE=ora.registry.acfs.type
[root@linuxidc1 ~]#
[root@linuxidc2 ~]# su- grid -c crs_stat | grep acfs
NAME=ora.registry.acfs
TYPE=ora.registry.acfs.type
[root@linuxidc2 ~]#
查看添加的资源状态。
[grid@linuxidc1 ~]$crsctl stat res -t
———————————————————————
NAME TARGET STATE SERVER STATE_DETAILS
Local Resources
———————————————————————
ora.ARCH.dg
ONLINE ONLINE linuxidc1
ONLINE ONLINE linuxidc2
ora.CRS.dg
ONLINE ONLINE linuxidc1
ONLINE ONLINE linuxidc2
ora.DATA.dg
ONLINE ONLINE linuxidc1
ONLINE ONLINE linuxidc2
ora.LISTENER.lsnr
ONLINE ONLINE linuxidc1
ONLINE ONLINE linuxidc2
ora.asm
ONLINE ONLINE linuxidc1 Started
ONLINE ONLINE linuxidc2 Started
ora.gsd
OFFLINE OFFLINE linuxidc1
OFFLINE OFFLINE linuxidc2
ora.net1.network
ONLINE ONLINE linuxidc1
ONLINE ONLINE linuxidc2
ora.ons
ONLINE ONLINE linuxidc1
ONLINE ONLINE linuxidc2
ora.registry.acfs
OFFLINE OFFLINE linuxidc1
OFFLINE OFFLINE linuxidc2
Cluster Resources
———————————————————————
ora.LISTENER_SCAN1.lsnr
1 ONLINE ONLINE linuxidc2
ora.cvu
1 ONLINE ONLINE linuxidc2
ora.linuxidc.db
1 ONLINE ONLINE linuxidc1 Open
2 ONLINE ONLINE linuxidc2 Open
ora.linuxidc1.vip
1 ONLINE ONLINE linuxidc1
ora.linuxidc2.vip
1 ONLINE ONLINE linuxidc2
ora.oc4j
1 ONLINE ONLINE linuxidc2
ora.scan1.vip
1 ONLINE ONLINE linuxidc2
[grid@linuxidc1 ~]$
添加的 ora.registry.acfs 资源默认 offline,需手工启动。
[grid@linuxidc1 ~]$crsctl start resource ora.registry.acfs -n linuxidc1
CRS-2672:Attempting to start ‘ora.registry.acfs’ on ‘linuxidc1’
CRS-2676: Start of’ora.registry.acfs’ on ‘linuxidc1’ succeeded
[grid@linuxidc1 ~]$crsctl start resource ora.registry.acfs -n linuxidc2
CRS-2672:Attempting to start ‘ora.registry.acfs’ on ‘linuxidc2’
CRS-2676: Start of’ora.registry.acfs’ on ‘linuxidc2’ succeeded
启动后查看状态如下,已为 online 状态。
[grid@linuxidc1 ~]$crsctl stat res -t
———————————————————————
NAME TARGET STATE SERVER STATE_DETAILS
———————————————————————
Local Resources
ora.ARCH.dg
ONLINE ONLINE linuxidc1
ONLINE ONLINE linuxidc2
ora.CRS.dg
ONLINE ONLINE linuxidc1
ONLINE ONLINE linuxidc2
ora.DATA.dg
ONLINE ONLINE linuxidc1
ONLINE ONLINE linuxidc2
ora.LISTENER.lsnr
ONLINE ONLINE linuxidc1
ONLINE ONLINE linuxidc2
ora.asm
ONLINE ONLINE linuxidc1 Started
ONLINE ONLINE linuxidc2 Started
ora.gsd
OFFLINE OFFLINE linuxidc1
OFFLINE OFFLINE linuxidc2
ora.net1.network
ONLINE ONLINE linuxidc1
ONLINE ONLINE linuxidc2
ora.ons
ONLINE ONLINE linuxidc1
ONLINE ONLINE linuxidc2
ora.registry.acfs
ONLINE ONLINE linuxidc1
ONLINE ONLINE linuxidc2
———————————————————————ClusterResources
———————————————————————
ora.LISTENER_SCAN1.lsnr
1 ONLINE ONLINE linuxidc2
ora.cvu
1 ONLINE ONLINE linuxidc2
ora.linuxidc.db
1 ONLINE ONLINE linuxidc1 Open
2 ONLINE ONLINE linuxidc2 Open
ora.linuxidc1.vip
1 ONLINE ONLINE linuxidc1
ora.linuxidc2.vip
1 ONLINE ONLINE linuxidc2
ora.oc4j
1 ONLINE ONLINE linuxidc2
ora.scan1.vip
1 ONLINE ONLINE linuxidc2
[grid@linuxidc1 ~]$
2. 使用 ASMCMD 命令创建 ACFS
(1)、使用 volcreate 命令创建 vol01,大小为 30G;
ASMCMD>volcreate -G data -s 30G testvol
(2)、使用 volinfo 查看 vol01 的相关信息
ASMCMD> volinfo-G data testvol
Diskgroup Name:DATA
Volume Name: TESTVOL
Volume Device: /dev/asm/testvol-347
State: ENABLED
Size (MB): 30720
Resize Unit (MB): 32
Redundancy: UNPROT
Stripe Columns: 4
Stripe Width (K): 128
Usage:
Mountpath:
ASMCMD>
(2)、使用操作系统命令查看设备名,这里的 /dev/asm/ testvol-347 相当于裸设备。
[grid@linuxidc1 ~]$ cd/dev/asm/
[grid@linuxidc1 asm]$ls -l
total 0
brwxrwx— 1 rootasmadmin 251, 177665 Oct 28 13:20 testvol-347
[grid@linuxidc1 asm]$
(3)、在 v$asm_volume 视图中使用 sql 查看 volume 相关信息
[grid@linuxidc1 asm]$sqlplus / as sysasm
SQL*Plus: Release11.2.0.4.0 Production on Fri Oct 28 13:22:33 2016
Copyright (c) 1982,2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11gEnterprise Edition Release 11.2.0.4.0 – 64bit Production
With the RealApplication Clusters and Automatic Storage Management options
SQL> selectvolume_name,volume_device,size_mb from v$asm_volume;
VOLUME_NAME VOLUME_DEVICE SIZE_MB
———————————————————
TESTVOL /dev/asm/testvol-347 30720
SQL>
(4)、格式化卷,创建文件系统
[root@linuxidc1 ~]#mkfs.acfs /dev/asm/testvol-347
mkfs.acfs:version = 11.2.0.4.0
mkfs.acfs: on-diskversion = 39.0
mkfs.acfs:volume =/dev/asm/testvol-347
mkfs.acfs: volumesize = 32212254720
mkfs.acfs: Formatcomplete.
[root@linuxidc1 ~]#
(5)、注册 ACFS 文件系统,相当于定义挂载点,仅在节点 1 注册一次即可
[root@linuxidc1~]#acfsutil registry -a /dev/asm/testvol-347/u01/app/grid/acfsmounts/data_testvol/
acfsutil registry:mount point /u01/app/grid/acfsmounts/data_testvol successfully added to OracleRegistry
查看文件系统信息
[root@linuxidc1 ~]#acfsutil info fs
/u01/app/grid/acfsmounts/data_testvol
ACFS Version: 11.2.0.4.0
flags: MountPoint,Available
mount time: Fri Oct 28 13:37:27 2016
volumes: 1
total size: 32212254720
total free: 32068386816
primary volume: /dev/asm/testvol-347
label:
flags: Primary,Available,ADVM
on-disk version: 39.0
allocation unit: 4096
major, minor: 251, 177665
size: 32212254720
free: 32068386816
ADVM diskgroup DATA
ADVM resize increment: 33554432
ADVM redundancy: unprotected
ADVM stripe columns: 4
ADVM stripe width: 131072
number of snapshots: 0
snapshot space usage: 0
replication status: DISABLED
[root@linuxidc1 ~]#
(6)、注册成功后自动挂载文件系统,两节点查看如下:
[root@linuxidc1 ~]# df-h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root 532G 34G 476G 7% /
tmpfs 16G 255M 16G 2% /dev/shm
/dev/sda1 477M 55M 397M 13% /boot
/dev/asm/testvol-347 30G 138M 30G 1% /u01/app/grid/acfsmounts/data_testvol
[root@linuxidc1 ~]#
[root@linuxidc2 ~]# df-h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root 533G 24G 487G 5% /
tmpfs 16G 254M 16G 2% /dev/shm
/dev/sda1 477M 55M 397M 13% /boot
/dev/asm/testvol-347 30G 138M 30G 1%/u01/app/grid/acfsmounts/data_testvol
[root@linuxidc2 ~]#
图形界面查看状态如下
更多详情见请继续阅读下一页的精彩内容:http://www.linuxidc.com/Linux/2017-03/141357p2.htm
[root@linuxidc1 ~]# df-h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root 532G 34G 476G 7% /
tmpfs 16G 258M 16G 2% /dev/shm
/dev/sda1 477M 55M 397M 13% /boot
/dev/asm/testvol-347 30G 138M 30G 1% /u01/app/grid/acfsmounts/data_testvol
/dev/asm/linuxidcvol-347 25G 128M 25G 1% /u01/app/grid/acfsmounts/data_linuxidcvol
[root@linuxidc1 ~]#
[root@linuxidc2 ~]# df-h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root 533G 24G 487G 5% /
tmpfs 16G 255M 16G 2% /dev/shm
/dev/sda1 477M 55M 397M 13% /boot
/dev/asm/testvol-347 30G 138M 30G 1% /u01/app/grid/acfsmounts/data_testvol
/dev/asm/linuxidcvol-347 25G 128M 25G 1% /u01/app/grid/acfsmounts/data_linuxidcvol
[root@linuxidc2 ~]#
再次看集群资源状态,新创建的 ACFS 文件系统被作为资源加入集群。
[grid@linuxidc1 ~]$crsctl stat res -t
———————————————————————
NAME TARGET STATE SERVER STATE_DETAILS
———————————————————————
Local Resources
———————————————————————
ora.ARCH.dg
ONLINE ONLINE linuxidc1
ONLINE ONLINE linuxidc2
ora.CRS.dg
ONLINE ONLINE linuxidc1
ONLINE ONLINE linuxidc2
ora.DATA.dg
ONLINE ONLINE linuxidc1
ONLINE ONLINE linuxidc2
ora.LISTENER.lsnr
ONLINE ONLINE linuxidc1
ONLINE ONLINE linuxidc2
ora.asm
ONLINE ONLINE linuxidc1 Started
ONLINE ONLINE linuxidc2 Started
ora.data.linuxidcvol.acfs
ONLINE ONLINE linuxidc1 mountedon /u01/app
/grid/acfsmounts/dat
a_linuxidcvol
ONLINE ONLINE linuxidc2 mountedon /u01/app
/grid/acfsmounts/dat
a_linuxidcvol
ora.gsd
OFFLINE OFFLINE linuxidc1
OFFLINE OFFLINE linuxidc2
ora.net1.network
ONLINE ONLINE linuxidc1
ONLINE ONLINE linuxidc2
ora.ons
ONLINE ONLINE linuxidc1
ONLINE ONLINE linuxidc2
ora.registry.acfs
ONLINE ONLINE linuxidc1
ONLINE ONLINE linuxidc2
———————————————————————ClusterResources
———————————————————————ora.LISTENER_SCAN1.lsnr
1 ONLINE ONLINE linuxidc2
ora.cvu
1 ONLINE ONLINE linuxidc2
ora.linuxidc.db
1 ONLINE ONLINE linuxidc1 Open
2 ONLINE ONLINE linuxidc2 Open
ora.linuxidc1.vip
1 ONLINE ONLINE linuxidc1
ora.linuxidc2.vip
1 ONLINE ONLINE linuxidc2
ora.oc4j
1 ONLINE ONLINE linuxidc2
ora.scan1.vip
1 ONLINE ONLINE linuxidc2
[grid@linuxidc1 ~]$
再次查看注册信息如下:
[root@linuxidc1 ~]#acfsutil info fs
/u01/app/grid/acfsmounts/data_testvol
ACFS Version: 11.2.0.4.0
flags: MountPoint,Available
mount time: Fri Oct 28 13:37:27 2016
volumes: 1
total size: 32212254720
total free: 32068386816
primary volume: /dev/asm/testvol-347
label:
flags: Primary,Available,ADVM
on-disk version: 39.0
allocation unit: 4096
major, minor: 251, 177665
size: 32212254720
free: 32068386816
ADVM diskgroup DATA
ADVM resize increment: 33554432
ADVM redundancy: unprotected
ADVM stripe columns: 4
ADVM stripe width: 131072
number of snapshots: 0
snapshot space usage: 0
replication status: DISABLED
/u01/app/grid/acfsmounts/data_linuxidcvol
ACFS Version: 11.2.0.4.0
flags: MountPoint,Available
mount time: Fri Oct 28 13:45:44 2016
volumes: 1
total size: 26843545600
total free: 26710327296
primary volume: /dev/asm/linuxidcvol-347
label:
flags: Primary,Available,ADVM
on-disk version: 39.0
allocation unit: 4096
major, minor: 251, 177666
size: 26843545600
free: 26710327296
ADVM diskgroup DATA
ADVM resize increment: 33554432
ADVM redundancy: unprotected
ADVM stripe columns: 4
ADVM stripe width: 131072
number of snapshots: 0
snapshot space usage: 0
replication status: DISABLED
[root@linuxidc1 ~]#
4. 删除 ACFS 文件系统
(1)、当前状态查看
[root@linuxidc1 ~]# df-h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root 532G 34G 476G 7% /
tmpfs 16G 256M 16G 2% /dev/shm
/dev/sda1 477M 55M 397M 13% /boot
/dev/asm/linuxidcvol-347 30G 138M 30G 1% /u01/app/grid/acfsmounts/data_linuxidcvol
/dev/asm/testvol-347 15G 107M 15G 1% /u01/app/grid/acfsmounts/data_testvol
[root@linuxidc1 ~]#
[root@linuxidc2 ~]# df-h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root 533G 24G 487G 5% /
tmpfs 16G 254M 16G 2% /dev/shm
/dev/sda1 477M 55M 397M 13% /boot
/dev/asm/linuxidcvol-347 30G 138M 30G 1% /u01/app/grid/acfsmounts/data_linuxidcvol
/dev/asm/testvol-347 15G 107M 15G 1% /u01/app/grid/acfsmounts/data_testvol
[root@linuxidc2 ~]#
[root@linuxidc1 ~]# su -grid
[grid@linuxidc1 ~]$crsctl stat res -t
——————————————————————————–
NAME TARGET STATE SERVER STATE_DETAILS
——————————————————————————–
Local Resources
——————————————————————————–
ora.ARCH.dg
ONLINE ONLINE linuxidc1
ONLINE ONLINE linuxidc2
ora.CRS.dg
ONLINE ONLINE linuxidc1
ONLINE ONLINE linuxidc2
ora.DATA.dg
ONLINE ONLINE linuxidc1
ONLINE ONLINE linuxidc2
ora.LISTENER.lsnr
ONLINE ONLINE linuxidc1
ONLINE ONLINE linuxidc2
ora.asm
ONLINE ONLINE linuxidc1 Started
ONLINE ONLINE linuxidc2 Started
ora.data.linuxidcvol.acfs
ONLINE ONLINE linuxidc1 mountedon /u01/app
/grid/acfsmounts/dat
a_linuxidcvol
ONLINE ONLINE linuxidc2 mountedon /u01/app
/grid/acfsmounts/dat
a_linuxidcvol
ora.gsd
OFFLINE OFFLINE linuxidc1
OFFLINE OFFLINE linuxidc2
ora.net1.network
ONLINE ONLINE linuxidc1
ONLINE ONLINE linuxidc2
ora.ons
ONLINE ONLINE linuxidc1
ONLINE ONLINE linuxidc2
ora.registry.acfs
ONLINE ONLINE linuxidc1
ONLINE ONLINE linuxidc2
——————————————————————————–
Cluster Resources
——————————————————————————–
ora.LISTENER_SCAN1.lsnr
1 ONLINE ONLINE linuxidc1
ora.cvu
1 ONLINE ONLINE linuxidc2
ora.linuxidc.db
1 ONLINE ONLINE linuxidc1 Open
2 ONLINE ONLINE linuxidc2 Open
ora.linuxidc1.vip
1 ONLINE ONLINE linuxidc1
ora.linuxidc2.vip
1 ONLINE ONLINE linuxidc2
ora.oc4j
1 ONLINE ONLINE linuxidc2
ora.scan1.vip
1 ONLINE ONLINE linuxidc1
[grid@linuxidc1 ~]$
(2)、卸载磁盘
节点 1
[root@linuxidc1 ~]#umount /dev/asm/testvol-347
[root@linuxidc1 ~]#umount /dev/asm/linuxidcvol-347
[root@linuxidc1 ~]# df-h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root 532G 34G 476G 7% /
tmpfs 16G 257M 16G 2% /dev/shm
/dev/sda1 477M 55M 397M 13% /boot
[root@linuxidc1 ~]#
节点 2
[root@linuxidc2 ~]#umount /dev/asm/testvol-347
[root@linuxidc2 ~]#umount /dev/asm/linuxidcvol-347
[root@linuxidc2 ~]# df-h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root 533G 24G 487G 5% /
tmpfs 16G 254M 16G 2% /dev/shm
/dev/sda1 477M 55M 397M 13% /boot
[root@linuxidc2 ~]#
再次查看资源状态
[grid@linuxidc1 ~]$crsctl stat res -t
——————————————————————————-
NAME TARGET STATE SERVER STATE_DETAILS
——————————————————————————-
Local Resources
——————————————————————————-
ora.ARCH.dg
ONLINE ONLINE linuxidc1
ONLINE ONLINE linuxidc2
ora.CRS.dg
ONLINE ONLINE linuxidc1
ONLINE ONLINE linuxidc2
ora.DATA.dg
ONLINE ONLINE linuxidc1
ONLINE ONLINE linuxidc2
ora.LISTENER.lsnr
ONLINE ONLINE linuxidc1
ONLINE ONLINE linuxidc2
ora.asm
ONLINE ONLINE linuxidc1 Started
ONLINE ONLINE linuxidc2 Started
ora.data.linuxidcvol.acfs
OFFLINE OFFLINE linuxidc1 admin unmounted /u0
1/app/grid/acfsmount
s/data_linuxidcvol
OFFLINE OFFLINE linuxidc2 admin unmounted /u0
1/app/grid/acfsmount
s/data_linuxidcvol
ora.gsd
OFFLINE OFFLINE linuxidc1
OFFLINE OFFLINE linuxidc2
ora.net1.network
ONLINE ONLINE linuxidc1
ONLINE ONLINE linuxidc2
ora.ons
ONLINE ONLINE linuxidc1
ONLINE ONLINE linuxidc2
ora.registry.acfs
ONLINE ONLINE linuxidc1
ONLINE ONLINE linuxidc2
——————————————————————————-
Cluster Resources
——————————————————————————-
ora.LISTENER_SCAN1.lsnr
1 ONLINE ONLINE linuxidc2
ora.cvu
1 ONLINE ONLINE linuxidc1
ora.linuxidc.db
1 ONLINE ONLINE linuxidc1 Open
2 ONLINE ONLINE linuxidc2 Open
ora.linuxidc1.vip
1 ONLINE ONLINE linuxidc1
ora.linuxidc2.vip
1 ONLINE ONLINE linuxidc2
ora.oc4j
1 ONLINE ONLINE linuxidc1
ora.scan1.vip
1 ONLINE ONLINE linuxidc2
[grid@linuxidc1 ~]$
可以看出图形界面创建的 linuxidcvol 卷,卸载文件系统后,ora.data.linuxidcvol.acfs
资源自动 offline,卷为 umounted 状态;testvol 关联与 ora.registry.acfs 资源,该资源状态正常。
(3)、停止 ora.registry.acfs 资源
[grid@linuxidc1 ~]$crsctl stop resource ora.registry.acfs -n linuxidc1
CRS-2673: Attemptingto stop ‘ora.registry.acfs’ on ‘linuxidc1’
CRS-2677: Stop of’ora.registry.acfs’ on ‘linuxidc1’ succeeded
[grid@linuxidc1 ~]$crsctl stop resource ora.registry.acfs -n linuxidc2
CRS-2673: Attemptingto stop ‘ora.registry.acfs’ on ‘linuxidc2’
CRS-2677: Stop of’ora.registry.acfs’ on ‘linuxidc2’ succeeded
[grid@linuxidc1 ~]$crsctl stat res -t
——————————————————————————-
NAME TARGET STATE SERVER STATE_DETAILS
——————————————————————————-
Local Resources
——————————————————————————-
ora.ARCH.dg
ONLINE ONLINE linuxidc1
ONLINE ONLINE linuxidc2
ora.CRS.dg
ONLINE ONLINE linuxidc1
ONLINE ONLINE linuxidc2
ora.DATA.dg
ONLINE ONLINE linuxidc1
ONLINE ONLINE linuxidc2
ora.LISTENER.lsnr
ONLINE ONLINE linuxidc1
ONLINE ONLINE linuxidc2
ora.asm
ONLINE ONLINE linuxidc1 Started
ONLINE ONLINE linuxidc2 Started
ora.data.linuxidcvol.acfs
OFFLINE OFFLINE linuxidc1 admin unmounted /u0
1/app/grid/acfsmount
s/data_linuxidcvol
OFFLINE OFFLINE linuxidc2 admin unmounted /u0
1/app/grid/acfsmount
s/data_linuxidcvol
ora.gsd
OFFLINE OFFLINE linuxidc1
OFFLINE OFFLINE linuxidc2
ora.net1.network
ONLINE ONLINE linuxidc1
ONLINE ONLINE linuxidc2
ora.ons
ONLINE ONLINE linuxidc1
ONLINE ONLINE linuxidc2
ora.registry.acfs
OFFLINE OFFLINE linuxidc1
OFFLINE OFFLINE linuxidc2
——————————————————————————-
Cluster Resources
——————————————————————————-
ora.LISTENER_SCAN1.lsnr
1 ONLINE ONLINE linuxidc2
ora.cvu
1 ONLINE ONLINE linuxidc1
ora.linuxidc.db
1 ONLINE ONLINE linuxidc1 Open
2 ONLINE ONLINE linuxidc2 Open
ora.linuxidc1.vip
1 ONLINE ONLINE linuxidc1
ora.linuxidc2.vip
1 ONLINE ONLINE linuxidc2
ora.oc4j
1 ONLINE ONLINE linuxidc1
ora.scan1.vip
1 ONLINE ONLINE linuxidc2
[grid@linuxidc1 ~]$
(4)、删除注册信息
仅在一个节点执行
[root@linuxidc1 ~]#acfsutil registry -d /u01/app/grid/acfsmounts/data_testvol/
acfsutil registry: successfully removed ACFS mount point/u01/app/grid/acfsmounts/data_testvol from Oracle Registry
[root@linuxidc1 ~]#
上一步中已 ora.data.linuxidcvol.acfs 资源 offline,移除注册信息报错正常。
[root@linuxidc1 ~]#acfsutil registry -d /u01/app/grid/acfsmounts/data_linuxidcvol/
acfsutil registry:ACFS-03143: The specified mount point does not exist and therefore cannot bedeleted.
[root@linuxidc1 ~]#
(5)、删除 ACFS 文件系统
仅在一个节点执行删除
[root@linuxidc1 ~]#acfsutil rmfs /dev/asm/testvol-347
[root@linuxidc1 ~]#acfsutil rmfs /dev/asm/linuxidcvol-347
(6)、禁用 volume
需要在两节点执行
节点 1 禁止
[grid@linuxidc1 ~]$asmcmd
ASMCMD>voldisable -G data testvol
ASMCMD>voldisable -G data linuxidcvol
ASMCMD>
节点 2 禁止
[grid@linuxidc2 ~]$asmcmd
ASMCMD>voldisable -G data testvol
ASMCMD> voldisable-G data linuxidcvol
ASMCMD> exit
[grid@linuxidc2 ~]$
(7)、删除卷
仅在一个节点执行。
[grid@linuxidc1 ~]$asmcmd
ASMCMD> ls
ASMCMD> voldelete-G data testvol
ASMCMD> voldelete-G data linuxidcvol
(8)、删除资源对象
[root@linuxidc1~]#/u01/app/11.2.0/grid/bin/srvctl remove filesystem-d /dev/asm/linuxidcvol-347
[grid@linuxidc1 ~]$ crsctl stat res -t
———————————————————————
NAME TARGET STATE SERVER STATE_DETAILS
———————————————————————
Local Resources
ora.ARCH.dg
ONLINE ONLINE linuxidc1
ONLINE ONLINE linuxidc2
ora.CRS.dg
ONLINE ONLINE linuxidc1
ONLINE ONLINE linuxidc2
ora.DATA.dg
ONLINE ONLINE linuxidc1
ONLINE ONLINE linuxidc2
ora.LISTENER.lsnr
ONLINE ONLINE linuxidc1
ONLINE ONLINE linuxidc2
ora.asm
ONLINE ONLINE linuxidc1 Started
ONLINE ONLINE linuxidc2 Started
ora.gsd
OFFLINE OFFLINE linuxidc1
OFFLINE OFFLINE linuxidc2
ora.net1.network
ONLINE ONLINE linuxidc1
ONLINE ONLINE linuxidc2
ora.ons
ONLINE ONLINE linuxidc1
ONLINE ONLINE linuxidc2
ora.registry.acfs
ONLINE ONLINE linuxidc1
ONLINE ONLINE linuxidc2
———————————————————————ClusterResources
———————————————————————
ora.LISTENER_SCAN1.lsnr
1 ONLINE ONLINE linuxidc2
ora.cvu
1 ONLINE ONLINE linuxidc2
ora.linuxidc.db
1 ONLINE ONLINE linuxidc1 Open
2 ONLINE ONLINE linuxidc2 Open
ora.linuxidc1.vip
1 ONLINE ONLINE linuxidc1
ora.linuxidc2.vip
1 ONLINE ONLINE linuxidc2
ora.oc4j
1 ONLINE ONLINE linuxidc2
ora.scan1.vip
1 ONLINE ONLINE linuxidc2
[grid@linuxidc1 ~]$
更多 Oracle 相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12
本文永久更新链接地址:http://www.linuxidc.com/Linux/2017-03/141357.htm