oracle acfs 基本知识。
今天是2014-03-13,学习一下acfs基本知识。
oracle acfs 简介:
Oracle Automatic Storage Management Cluster File System (Oracle ACFS) is a multi-platform, scalable file system, and storage management technology that extends Oracle Automatic Storage Management (Oracle ASM) functionality to support customer files maintained
outside of Oracle Database. Oracle ACFS supports many database and application files, including executables, database trace files, database alert logs, application reports, BFILEs, and configuration files. Other supported files are video, audio, text, images,
engineering drawings, and other general-purpose application file data.
一、创建acfs文件系统:
1)创建acfs文件系统的前提要求是:
数据库版本为11G R2,已经安装了gi和asm实例且存在磁盘组,磁盘组的属性compatible.asm 是11.2之上,另外compatible.advm为11.2之上
2)创建逻辑卷
在创建acfs文件系统之前需要先创建动态卷(advm),注意在创建动态卷之前必须要加载acfs 文件系统驱动,否则会报错。如果启动acfs volume driver需要使用root权限进行启动。启动之后即可创建卷组。
eg:
SQL> alter diskgroup datagroup2 add volume acfsvol0 size 512M; alter diskgroup datagroup2 add volume acfsvol0 size 512M * ERROR at line 1: ORA-15032: not all alterations performed ORA-15477: cannot communicate with the volume driver SQL> exit Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production With the Automatic Storage Management option -bash-4.1$ cd $ORACLE_HOME -bash-4.1$ cd bin/ -bash-4.1$ ./acfsload start ACFS-9130: Root access required [root@oracle-one ~]# /ginf/grid/product/11.2.0/grid_1/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-9154: Loading ‘oracleoks.ko‘ driver. ACFS-9154: Loading ‘oracleadvm.ko‘ driver. ACFS-9154: Loading ‘oracleacfs.ko‘ driver. ACFS-9327: Verifying ADVM/ACFS devices. ACFS-9156: Detecting control device ‘/dev/asm/.asm_ctl_spec‘. ACFS-9156: Detecting control device ‘/dev/ofsctl‘. ACFS-9322: completed [root@oracle-one ~]# -bash-4.1$ sqlplus / as sysasm SQL*Plus: Release 11.2.0.4.0 Production on Thu Mar 13 15:05:24 2014 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 Automatic Storage Management option SQL> alter diskgroup datagroup2 add volume acfsvol0 size 512M; Diskgroup altered. SQL> exit Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production With the Automatic Storage Management option -bash-4.1$ asmcmd -p ASMCMD [+] > volcreate -G datagroup2 -s 512M acfsvol1 ASMCMD [+] > volinfo -G datagroup2 -a Diskgroup Name: DATAGROUP2 Volume Name: ACFSVOL0 Volume Device: /dev/asm/acfsvol0-142 State: ENABLED Size (MB): 512 Resize Unit (MB): 32 Redundancy: MIRROR Stripe Columns: 4 Stripe Width (K): 128 Usage: Mountpath: Volume Name: ACFSVOL1 Volume Device: /dev/asm/acfsvol1-142 State: ENABLED Size (MB): 512 Resize Unit (MB): 32 Redundancy: MIRROR Stripe Columns: 4 Stripe Width (K): 128 Usage: Mountpath: ASMCMD [+] >
查看卷组信息:
SQL> set linesize 200 SQL> col volume_device for a50 SQL> col volume_name for a40 SQL> select volume_name,size_mb,state,volume_device from v$asm_volume; VOLUME_NAME SIZE_MB STATE VOLUME_DEVICE ---------------------------------------- ---------- -------- -------------------------------------------------- ACFSVOL1 512 ENABLED /dev/asm/acfsvol1-142 ACFSVOL0 512 ENABLED /dev/asm/acfsvol0-142 SQL>
3)格式化文件系统为acfs
eg:
[root@oracle-one ~]# /sbin/mkfs -t acfs -n acfsvol0 /dev/asm/acfsvol0-142 mkfs.acfs: version = 11.2.0.4.0 mkfs.acfs: on-disk version = 39.0 mkfs.acfs: volume = /dev/asm/acfsvol0-142 mkfs.acfs: volume size = 536870912 mkfs.acfs: Format complete. [root@oracle-one ~]# /sbin/mkfs -t acfs -n acfsvol1 /dev/asm/acfsvol1-142 mkfs.acfs: version = 11.2.0.4.0 mkfs.acfs: on-disk version = 39.0 mkfs.acfs: volume = /dev/asm/acfsvol1-142 mkfs.acfs: volume size = 536870912 mkfs.acfs: Format complete. [root@oracle-one ~]#
4)注册acfs文件系统信息;
[root@oracle-one ~]# mkdir -p /ginf/grid/acfs acfssystem/ acfsvolume/ [root@oracle-one ~]# mkdir -p /ginf/grid/acfssystem/acfsvol0 You have new mail in /var/spool/mail/root [root@oracle-one ~]# mkdir -p /ginf/grid/acfssystem/acfsvol1 [root@oracle-one ~]# /sbin/acfsutil registry -a -f /dev/asm/acfsvol0-142 /ginf/grid/acfssystem/acfsvol0 acfsutil registry: mount point /ginf/grid/acfssystem/acfsvol0 successfully added to Oracle Registry [root@oracle-one ~]# /sbin/acfsutil registry -a -f /dev/asm/acfsvol1-142 /ginf/grid/acfssystem/acfsvol1 acfsutil registry: mount point /ginf/grid/acfssystem/acfsvol1 successfully added to Oracle Registry [root@oracle-one ~]#
5)挂在acfs文件信息:
[root@oracle-one ~]# mount.acfs -o all [root@oracle-one ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/vg_oracleone-lv_root 5.0G 3.9G 876M 82% / tmpfs 1.0G 83M 942M 9% /dev/shm /dev/sda1 485M 55M 405M 12% /boot /dev/mapper/vg_oracleone-LogVol02 5.0G 2.2G 2.6G 46% /home /dev/mapper/vg_oracleone-LogVol03 13G 7.0G 4.8G 60% /opt /dev/sdf1 5.0G 139M 4.6G 3% /tmp /dev/sdg1 16G 4.3G 11G 29% /ginf /dev/asm/acfsvol0-142 512M 40M 473M 8% /ginf/grid/acfssystem/acfsvol0 /dev/asm/acfsvol1-142 512M 40M 473M 8% /ginf/grid/acfssystem/acfsvol1 [root@oracle-one ~]#
至此acfs文件系统创建完成。
二)动态扩展acfs文件系统。
acfs可以支持卷组的动态扩展类似aix的chfs -a size=xx directory,只要磁盘组有足够的空间就可进行动态扩展。
eg:
-bash-4.1$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.4.0 Production on Thu Mar 13 15:23:53 2014 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 Automatic Storage Management option SQL> col volume_device for a50 SQL> col volume_name for a40 SQL> set linesize 200 SQL> select volume_name,size_mb,state,volume_device from v$asm_volume; VOLUME_NAME SIZE_MB STATE VOLUME_DEVICE ---------------------------------------- ---------- -------- -------------------------------------------------- ACFSVOL1 512 ENABLED /dev/asm/acfsvol1-142 ACFSVOL0 512 ENABLED /dev/asm/acfsvol0-142 SQL> select name ,state,type,total_mb,free_mb from v$asm_diskgroup; NAME STATE TYPE TOTAL_MB FREE_MB ------------------------------ ----------- ------ ---------- ---------- DATAGROUP1 MOUNTED NORMAL 16376 9758 DATAGROUP2 MOUNTED NORMAL 8188 5946 DATAGROUP3 MOUNTED NORMAL 4076 3966 SQL> exit Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production With the Automatic Storage Management option -bash-4.1$ exit [root@oracle-one ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/vg_oracleone-lv_root 5.0G 3.9G 876M 82% / tmpfs 1.0G 83M 942M 9% /dev/shm /dev/sda1 485M 55M 405M 12% /boot /dev/mapper/vg_oracleone-LogVol02 5.0G 2.2G 2.6G 46% /home /dev/mapper/vg_oracleone-LogVol03 13G 7.0G 4.8G 60% /opt /dev/sdf1 5.0G 139M 4.6G 3% /tmp /dev/sdg1 16G 4.3G 11G 29% /ginf /dev/asm/acfsvol0-142 512M 40M 473M 8% /ginf/grid/acfssystem/acfsvol0 /dev/asm/acfsvol1-142 512M 40M 473M 8% /ginf/grid/acfssystem/acfsvol1 [root@oracle-one ~]# acfsutil size +512m /ginf/grid/acfssystem/acfsvol0 acfsutil size: new file system size: 1073741824 (1024MB) [root@oracle-one ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/vg_oracleone-lv_root 5.0G 3.9G 876M 82% / tmpfs 1.0G 83M 942M 9% /dev/shm /dev/sda1 485M 55M 405M 12% /boot /dev/mapper/vg_oracleone-LogVol02 5.0G 2.2G 2.6G 46% /home /dev/mapper/vg_oracleone-LogVol03 13G 7.0G 4.8G 60% /opt /dev/sdf1 5.0G 139M 4.6G 3% /tmp /dev/sdg1 16G 4.3G 11G 29% /ginf /dev/asm/acfsvol0-142 1.0G 41M 984M 4% /ginf/grid/acfssystem/acfsvol0 /dev/asm/acfsvol1-142 512M 40M 473M 8% /ginf/grid/acfssystem/acfsvol1 [root@oracle-one ~]#
另外还可以动态缩小:
eg:
[root@oracle-one ~]# acfsutil size -512M /ginf/grid/acfssystem/acfsvol0 acfsutil size: new file system size: 536870912 (512MB) [root@oracle-one ~]# [root@oracle-one ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/vg_oracleone-lv_root 5.0G 3.9G 876M 82% / tmpfs 1.0G 83M 942M 9% /dev/shm /dev/sda1 485M 55M 405M 12% /boot /dev/mapper/vg_oracleone-LogVol02 5.0G 2.2G 2.6G 46% /home /dev/mapper/vg_oracleone-LogVol03 13G 7.0G 4.8G 60% /opt /dev/sdf1 5.0G 139M 4.6G 3% /tmp /dev/sdg1 16G 4.3G 11G 29% /ginf /dev/asm/acfsvol0-142 512M 41M 472M 8% /ginf/grid/acfssystem/acfsvol0 /dev/asm/acfsvol1-142 512M 40M 473M 8% /ginf/grid/acfssystem/acfsvol1 [root@oracle-one ~]#
三)查看acfs文件系统信息:
可以通过v$asm_diskgroup,v$asm_volume,v$asm_acfsvolume进行信息查看
SQL> col vol_label for a20 SQL> col fs_name for a40 SQL> select * from v$asm_acfsvolumes; FS_NAME VOL_DEVICE VOL_LABEL PRIMA TOTAL_MB FREE_MB ---------------------------------------- ---------------------------------------- -------------------- ----- ---------- ---------- /ginf/grid/acfssystem/acfsvol0 /dev/asm/acfsvol0-142 acfsvol0 TRUE 512 471.742188 /ginf/grid/acfssystem/acfsvol1 /dev/asm/acfsvol1-142 acfsvol1 TRUE 512 472.742188 SQL>
通过asmcmd查看:
ASMCMD [+] > volinfo -G datagroup2 -a Diskgroup Name: DATAGROUP2 Volume Name: ACFSVOL0 Volume Device: /dev/asm/acfsvol0-142 State: ENABLED Size (MB): 512 Resize Unit (MB): 32 Redundancy: MIRROR Stripe Columns: 4 Stripe Width (K): 128 Usage: ACFS Mountpath: /ginf/grid/acfssystem/acfsvol0 Volume Name: ACFSVOL1 Volume Device: /dev/asm/acfsvol1-142 State: ENABLED Size (MB): 512 Resize Unit (MB): 32 Redundancy: MIRROR Stripe Columns: 4 Stripe Width (K): 128 Usage: ACFS Mountpath: /ginf/grid/acfssystem/acfsvol1 ASMCMD [+] > ASMCMD [+] > lsdg State Type Rebal Sector Block AU Total_MB Free_MB Req_mir_free_MB Usable_file_MB Offline_disks Voting_files Name MOUNTED NORMAL N 512 4096 1048576 16376 9758 4094 2832 0 N DATAGROUP1/ MOUNTED NORMAL N 512 4096 1048576 8188 5946 0 2973 0 N DATAGROUP2/ MOUNTED NORMAL N 512 4096 1048576 4076 3966 1019 1473 0 N DATAGROUP3/ ASMCMD [+] >
另外还有一个与acfs文件系统交互的命令acfsutl
eg:
[root@oracle-one ~]# acfsutil info fs /ginf/grid/acfssystem/acfsvol0 ACFS Version: 11.2.0.4.0 flags: MountPoint,Available mount time: Thu Mar 13 15:15:52 2014 volumes: 1 total size: 536870912 total free: 494657536 primary volume: /dev/asm/acfsvol0-142 label: acfsvol0 flags: Primary,Available,ADVM on-disk version: 39.0 allocation unit: 4096 major, minor: 251, 72707 size: 536870912 free: 494657536 ADVM diskgroup DATAGROUP2 ADVM resize increment: 33554432 ADVM redundancy: mirror ADVM stripe columns: 4 ADVM stripe width: 131072 compatible.advm: 11.2.0.0.0 number of snapshots: 0 snapshot space usage: 0 replication status: DISABLED /ginf/grid/acfssystem/acfsvol1 ACFS Version: 11.2.0.4.0 flags: MountPoint,Available mount time: Thu Mar 13 15:15:53 2014 volumes: 1 total size: 536870912 total free: 495706112 primary volume: /dev/asm/acfsvol1-142 label: acfsvol1 flags: Primary,Available,ADVM on-disk version: 39.0 allocation unit: 4096 major, minor: 251, 72706 size: 536870912 free: 495706112 ADVM diskgroup DATAGROUP2 ADVM resize increment: 33554432 ADVM redundancy: mirror ADVM stripe columns: 4 ADVM stripe width: 131072 number of snapshots: 0 snapshot space usage: 0 replication status: DISABLED [root@oracle-one ~]#
四)创建文件系统快照保护。
其实创建快照就是类似cp的过程。eg:
root@oracle-one acfsvol0]# dd if=/dev/zero of=./test.log bs=100M count=1; 1+0 records in 1+0 records out 104857600 bytes (105 MB) copied, 0.28981 s, 362 MB/s [root@oracle-one acfsvol0]# ls -l total 107584 drwx------ 2 root root 65536 Mar 13 15:15 lost+found -rw-r--r-- 1 root root 104857600 Mar 13 15:35 test.log [root@oracle-one acfsvol0]# pwd /ginf/grid/acfssystem/acfsvol0 [root@oracle-one acfsvol0]# acfsutil snap create acfsvol0_bak /ginf/grid/acfssystem/acfsvol0 acfsutil snap create: Snapshot operation is complete. [root@oracle-one acfsvol0]# cd .ACFS [root@oracle-one .ACFS]# ls repl snaps [root@oracle-one .ACFS]# cd snaps/ [root@oracle-one snaps]# pwd /ginf/grid/acfssystem/acfsvol0/.ACFS/snaps [root@oracle-one snaps]# ls -l total 4 drwxr-xr-x 4 root root 4096 Mar 13 15:36 acfsvol0_bak [root@oracle-one snaps]# cd acfsvol0_bak/ [root@oracle-one acfsvol0_bak]# ls -l ls: cannot access lost+found: Permission denied total 107520 d????????? ? ? ? ? ? lost+found -rw-r--r-- 1 root root 104857600 Mar 13 15:35 test.log [root@oracle-one acfsvol0_bak]# pwd /ginf/grid/acfssystem/acfsvol0/.ACFS/snaps/acfsvol0_bak [root@oracle-one acfsvol0_bak]# ls -h ls: cannot access lost+found: Permission denied lost+found test.log [root@oracle-one acfsvol0_bak]#
删除acfs文件系统快照
eg:
[root@oracle-one snaps]# ls acfsvol0_bak [root@oracle-one snaps]# acfsutil snap delete acfsvol0_bak /ginf/grid/acfssystem/acfsvol0 acfsutil snap delete: Snapshot operation is complete. [root@oracle-one snaps]# ls [root@oracle-one snaps]#
五)卸载acfs文件系统:
1、取消acfs文件系统的注册
[root@oracle-one snaps]# acfsutil registry -d /ginf/grid/acfssystem/acfsvol0 acfsutil registry: successfully removed ACFS mount point /ginf/grid/acfssystem/acfsvol0 from Oracle Registry [root@oracle-one snaps]# acfsutil registry -d /ginf/grid/acfssystem/acfsvol1 acfsutil registry: successfully removed ACFS mount point /ginf/grid/acfssystem/acfsvol1 from Oracle Registry [root@oracle-one snaps]#
2、卸载acfs卷
[root@oracle-one ~]# umount -t acfs -a
[root@oracle-one ~]#
如果卸载单个卷umount -t acfs /directory
3、删除acfs
eg:
[root@oracle-one ~]# acfsutil rmfs /dev/asm/acfsvol0-142
[root@oracle-one ~]# acfsutil rmfs /dev/asm/acfsvol1-142
[root@oracle-one ~]#
4、disable 卷组并 删除卷组:
eg:
-bash-4.1$ asmcmd voldisable -G datagroup2 -a
-bash-4.1$ asmcmd voldelete -G datagroup2 acfsvol0
-bash-4.1$ asmcmd voldelete -G datagroup2 acfsvol1
-bash-4.1$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Thu Mar 13 15:44:50 2014
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 Automatic Storage Management option
SQL> select * from v$asm_volume;
no rows selected
SQL> select * from v$asm_acfsvolumes;
no rows selected
SQL>
that‘s all!
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。