Oracle Study之--ASM文件系统ACFS管理

Oracle Study之--ASM文件系统ACFS管理
客居天涯 2015-09-30 16:17:52 1406 收藏
分类专栏: 数据库技术 文章标签: oracle
版权
Oracle Study之--ASM文件系统ACFS管理
系统环境:
      操作系统: RedHat EL5.5
      Cluster:   Oracle Grid 11.2.0.1.0
      Oracle:     Oracle 11g  11.2.0.1.0

在Oracle Database 11gR2中,以ASM技术为基础,Oracle推出了强劲的ACFS文件系统,进一步推进了自动存储管理技术。

在Oracle 11gR2中,ASM技术仍旧着眼于支持数据库运行和备份的核心文件等,包括数据文件、控制文件、归档日志、spfile、RMAN备份文件、Change Tracking文件、数据泵Dump文件以及OCR文件等;而ACFS和Oracle ADVM(ASM Dynamic Volume Manager)则进一步延展了ASM的支持范围,可以存储Oracle软件、告警日志、跟踪文件、BFILEs大对象,还有影像、图片以及其他应用的普通文件。

在ASMCA中,可以通过ASM集群文件系统(ASM Cluster File Systems)选项页来查看ACFS相关设置,"ASM集群文件系统(ACFS)可用于存储文件,如可执行文件、Oracle诊断文件、应用程序配置文件等。要使用ACFS,必须先创建ASM卷"。

ASM卷的创建方式有两种,一种是ASMCA工具,一种是通过命令行;

一、ASMCA创建acfs

1、首先创建asm diskgroup(asm diskgroup如果使用asmca创建,默认compatible为“11.2”,如果使用sqlplus命令,默认compatible为“11.1”,要更新到“11.2”)

SQL> create diskgroup dg2
  2  external redundancy
  3  disk ‘ORCL:ASM_EXT1‘ attribute ‘compatible.asm‘=‘11.2‘;
Diskgroup created.
SQL> create diskgroup dg3
  2  external redundancy
  3  disk ‘ORCL:ASM_EXT2‘;
Diskgroup created.
SQL> alter diskgroup dg3 set attribute ‘compatible.asm‘=‘11.2‘;     //更新compatible到“11.2”
Diskgroup altered.

查看磁盘组信息:

SQL> select name,state,COMPATIBILITY from v$asm_diskgroup
NAME                           STATE       COMPATIBILITY
------------------------------ ----------- ------------------------------------------------------------
DG1                            MOUNTED     11.2.0.0.0
OCR_VOTE                       MOUNTED     11.2.0.0.0
RCY1                           MOUNTED     11.2.0.0.0
DG2                            MOUNTED     11.2.0.0.0
DG3                            MOUNTED     11.2.0.0.0

2、通过asmca创建acfs

1、查看asm istance状态


2、查看asm下的asm diskgroup状态


3、选择可用的asm diskgroup 建立asm volume


4、查看以建立的asm volume


2、建立acfs文件系统,并选择默认挂载点


ACFS创建完成,在系统下查看:

因为ACFS文件系统为共享的,所有会自动在所有RAC node被mount。

在文件系统下存储文件测试:
[grid@zcx2 ~]$ echo "hello,world" >/u01/app/oracle/acfsmounts/dg2_asm_vol1/1.txt
[grid@zcx2 ~]$ ls -l /u01/app/oracle/acfsmounts/dg2_asm_vol1
total 68
-rw-r--r-- 1 grid oinstall    12 Sep 30 15:07 1.txt
drwx------ 2 root root     65536 Sep 30 15:04 lost+found

二、通过acfsutil命令创建acfs

1、创建挂载点
[root@zcx2 ~]# mkdir /u02
[root@zcx2 ~]# su - grid

2、通过asmca创建asm volume
[grid@zcx2 ~]$ asmcmd
ASMCMD> volcreate -G dg3 -s 1g asm_vol2

ASMCMD> volinfo -G dg3 asm_vol2
Diskgroup Name: DG3
         Volume Name: ASM_VOL2
         Volume Device: /dev/asm/asm_vol2-129
         State: ENABLED
         Size (MB): 1024
         Resize Unit (MB): 256
         Redundancy: UNPROT
         Stripe Columns: 4
         Stripe Width (K): 128
         Usage:
         Mountpath:

3、查看asm卷属性
[root@node3 ~]# ls -l /dev/asm/asm_vol2-129
brwxrwx--- 1 root asmadmin 252, 66049 Sep 30 15:10 /dev/asm/asm_vol2-129

 SQL> select GROUP_NUMBER ,VOLUME_NAME  ,state from v$asm_volume;

GROUP_NUMBER VOLUME_NAME                    STATE
------------ ------------------------------ --------
           4 ASM_VOL1                       ENABLED
           5 ASM_VOL2                       ENABLED
 
4、格式化asm volume建立acfs         
 [root@zcx2 ~]# mkfs.acfs /dev/asm/asm_vol2-129
mkfs.acfs: version                   = 11.2.0.1.0.0
mkfs.acfs: on-disk version           = 39.0
mkfs.acfs: volume                    = /dev/asm/asm_vol2-129
mkfs.acfs: volume size               = 1073741824
mkfs.acfs: Format complete.

5、注册acfs
[root@zcx2 ~]#acfsutil registry -a /dev/asm/asm_vol2-129

6、建立acfs的挂载
[root@zcx2 ~]# mount -t acfs /dev/asm/asm_vol2-129  /u02      

7、查看挂载信息
[root@zcx2 ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/asm/asm_vol1-211
                      2.0G  173M  1.9G   9% /u01/app/oracle/acfsmounts/dg2_asm_vol1
/dev/asm/asm_vol2-129
                      1.0G   39M  986M   4% /u02

通过asmca查看acfs:


8、测试acfs应用                                          
[root@node3 ~]# su - grid
[grid@node3 ~]$ cd /u02
[grid@node3 u02]$ touch g.txt
touch: cannot touch `g.txt‘: Permission denied
[grid@node3 u02]$ su -
Password:
su: incorrect password
[grid@node3 u02]$ su -
Password:
[root@node3 ~]# ls -ld /u02
drwxr-xr-x 4 root root 4096 Sep 30 15:20 /u02
[root@node3 ~]# chown oracle:oinstall /u02
[root@node3 ~]# ls -ld /u02
drwxr-xr-x 4 oracle oinstall 4096 Sep 30 15:20 /u02
[root@node3 ~]# chmod 775 /u02
[root@node3 ~]# su - grid
[grid@node3 ~]$ cd /u02
[grid@node3 u02]$ touch g.txt
[grid@node3 u02]$ su - oracle
Password:
[oracle@node3 ~]$ touch /u02/o.txt
[oracle@node3 ~]$ ls -l /u02
total 64
-rw-r--r-- 1 grid   oinstall     0 Sep 30 15:21 g.txt
drwx------ 2 root   root     65536 Sep 30 15:20 lost+found
-rw-r--r-- 1 oracle oinstall     0 Sep 30 15:21 o.txt

三、删除ACFS系统
                
可以使用acfsutil工具删除acfs:
[root@zcx2 ~]# acfsutil

Usage: acfsutil [-h] command ...   # (Version 11.2.0.1.0.0)

             -h - help
 Command Subcmd Arguments
-------- ------ ----------------------------------------------------------------
    help                                 - display this message
 version                                 - display ACFS version information
    info fs                              - Display all ACFS file systems
    info fs     [<path> ...]             - Display specific ACFS file sys
    info fs     -o <item> <path>         - Display specific file sys item:
    info fs     -o                           freespace,    totalspace,
    info fs     -o                           mountpoints,  volumes,
    info fs     -o                           available,    ismountpoint,
    info fs     -o                           isavailable,  iscorrupt,
    info fs     -o                           isadvm,       diskgroup,
    info fs     -o                           redundancy,   resizeincrement,
    info fs     -o                           stripewidth,  stripecolumns,
    info fs     -o                           primaryvolume
    info file   <path> [<path> ...]      - Display specific file info
    info id     <file-identifier> <mountpoint> -
    info id           Display the pathname associated with the given  
    info id           ACFS file identifier and mountpoint.
    rmfs        <device>                 - Remove unmounted ACFS file sys
    size        [-|+]nnn[K|M|G|T|P] [-d <device>] <path> - Resize file system
registry        [-l]                     - Display registry contents
registry        -l <mountpoint>          - Display a specific mount point
registry        -l <device>              - Display a specific device
registry        -m <device>              - Display a specific mount point associated with a device
registry        -a [-f] [-o <opts>] [-n <nodes>] <device> <mountpoint> - Add a mount point
registry        -d [<mountpoint> | <device>] - Delete a mount point or a device
    tune        AcfsMaxOpenFiles         - Maximum number of open files
    tune                                   (Windows only)
    snap create <snap_name> <mountpoint> - create a file system snapshot
    snap delete <snap_name> <mountpoint> - delete a file system snapshot
 
 1、卸载文件系统
 [root@node3 ~]# umount /u02
[root@node3 ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/asm/asm_vol1-211
                      2.0G  173M  1.9G   9% /u01/app/oracle/acfsmounts/dg2_asm_vol1

2、撤销对acfs系统的注册
 [root@node3 ~]# acfsutil registry -d /u02

3、删除acfs系统
[root@node3 ~]# acfsutil rmfs /dev/asm/asm_vol2-129
 
4、查看asm volume信息
   ASMCMD> volinfo -G dg3  asm_vol2
Diskgroup Name: DG3
         Volume Name: ASM_VOL2
         Volume Device: /dev/asm/asm_vol2-129
         State: ENABLED
         Size (MB): 1024
         Resize Unit (MB): 256
         Redundancy: UNPROT
         Stripe Columns: 4
         Stripe Width (K): 128
         Usage:
         Mountpath:
 
5、禁用asm volume       
 ASMCMD> voldisable -G dg3 asm_vol2
ASMCMD> volinfo -G dg3  asm_vol2
Diskgroup Name: DG3
         Volume Name: ASM_VOL2
         Volume Device: /dev/asm/asm_vol2-129
         State: DISABLED
         Size (MB): 1024
         Resize Unit (MB): 256
         Redundancy: UNPROT
         Stripe Columns: 4
         Stripe Width (K): 128
         Usage:
         Mountpath:

6、删除asm volume
ASMCMD> voldelete -G dg3 asm_vol2
ASMCMD> volinfo -G dg3  asm_vol2
volume asm_vol2 not found in diskgroup dg3

用ASCMCA查看:


----至此,ACFS系统被彻底删除
————————————————
版权声明:本文为CSDN博主「客居天涯」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/lqx0405/java/article/details/48829357

Oracle Study之--ASM文件系统ACFS管理

上一篇:618狂欢结束,来聊聊华为云GaussDB NoSQL的蓬勃张力


下一篇:MySQL添加用户、为用户分配权限