Today is. Learn the basic acfs knowledge.
Oracle acfs introduction:
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 databases 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.
1. Create an acfs File System:
1) the prerequisites for creating an acfs file system are:
The database version is 11G R2. gi and asm instances have been installed and a disk group exists. The attribute compatible. asm of the disk group is above 11.2, and compatible. advm is above 11.2.
2) create a logical volume
Before creating an acfs file system, you must first create a dynamic volume (advm). Note that you must load the acfs file system driver before creating a dynamic volume; otherwise, an error is reported. If you want to start acfs volume driver, you must use the root permission to start it. You can create a volume group after it is started.
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 performedORA-15477: cannot communicate with the volume driverSQL> exitDisconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Automatic Storage Management option-bash-4.1$ cd $ORACLE_HOME-bash-4.1$ cd bin/-bash-4.1$ ./acfsload startACFS-9130: Root access required[root@oracle-one ~]# /ginf/grid/product/11.2.0/grid_1/bin/acfsload startACFS-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 sysasmSQL*Plus: Release 11.2.0.4.0 Production on Thu Mar 13 15:05:24 2014Copyright (c) 1982, 2013, Oracle. All rights reserved.Connected to:Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Automatic Storage Management optionSQL> alter diskgroup datagroup2 add volume acfsvol0 size 512M;Diskgroup altered.SQL> exitDisconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Automatic Storage Management option-bash-4.1$ asmcmd -pASMCMD [+] > volcreate -G datagroup2 -s 512M acfsvol1 ASMCMD [+] > volinfo -G datagroup2 -aDiskgroup 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 [+] >
View the volume group information:
SQL> set linesize 200SQL> col volume_device for a50SQL> col volume_name for a40SQL> 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-142ACFSVOL0 512 ENABLED /dev/asm/acfsvol0-142SQL>
3) format the file system as acfs.
Eg:
[root@oracle-one ~]# /sbin/mkfs -t acfs -n acfsvol0 /dev/asm/acfsvol0-142 mkfs.acfs: version = 11.2.0.4.0mkfs.acfs: on-disk version = 39.0mkfs.acfs: volume = /dev/asm/acfsvol0-142mkfs.acfs: volume size = 536870912mkfs.acfs: Format complete.[root@oracle-one ~]# /sbin/mkfs -t acfs -n acfsvol1 /dev/asm/acfsvol1-142 mkfs.acfs: version = 11.2.0.4.0mkfs.acfs: on-disk version = 39.0mkfs.acfs: volume = /dev/asm/acfsvol1-142mkfs.acfs: volume size = 536870912mkfs.acfs: Format complete.[root@oracle-one ~]#
4) Register acfs file system information;
[root@oracle-one ~]# mkdir -p /ginf/grid/acfsacfssystem/ acfsvolume/ [root@oracle-one ~]# mkdir -p /ginf/grid/acfssystem/acfsvol0You 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/acfsvol0acfsutil 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/acfsvol1acfsutil registry: mount point /ginf/grid/acfssystem/acfsvol1 successfully added to Oracle Registry[root@oracle-one ~]#
5) Information of the acfs file:
[root@oracle-one ~]# mount.acfs -o all[root@oracle-one ~]# df -hFilesystem 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 ~]#
Now the acfs file system has been created.
2) dynamically expand the acfs file system.
Acfs supports dynamic expansion of volume groups, similar to chfs-a size = xx directory of aix. dynamic expansion can be performed as long as the disk group has enough space.
Eg:
-bash-4.1$ sqlplus / as sysdbaSQL*Plus: Release 11.2.0.4.0 Production on Thu Mar 13 15:23:53 2014Copyright (c) 1982, 2013, Oracle. All rights reserved.Connected to:Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Automatic Storage Management optionSQL> col volume_device for a50SQL> col volume_name for a40SQL> set linesize 200SQL> 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-142ACFSVOL0 512 ENABLED /dev/asm/acfsvol0-142SQL> select name ,state,type,total_mb,free_mb from v$asm_diskgroup;NAME STATE TYPE TOTAL_MB FREE_MB------------------------------ ----------- ------ ---------- ----------DATAGROUP1 MOUNTED NORMAL 16376 9758DATAGROUP2 MOUNTED NORMAL 8188 5946DATAGROUP3 MOUNTED NORMAL 4076 3966SQL> exitDisconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Automatic Storage Management option-bash-4.1$ exit[root@oracle-one ~]# df -hFilesystem 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/acfsvol0acfsutil size: new file system size: 1073741824 (1024MB)[root@oracle-one ~]# df -hFilesystem 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 ~]#
It can also be dynamically reduced:
Eg:
[root@oracle-one ~]# acfsutil size -512M /ginf/grid/acfssystem/acfsvol0acfsutil size: new file system size: 536870912 (512MB)[root@oracle-one ~]# [root@oracle-one ~]# df -hFilesystem 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 ~]#
3) view acfs file system information:
You can view the information through v $ asm_diskgroup, v $ asm_volume, v $ asm_acfsvolume.
SQL> col vol_label for a20SQL> col fs_name for a40SQL> 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.742188SQL>
View through asmcmd:
ASMCMD [+] > volinfo -G datagroup2 -aDiskgroup 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 [+] > lsdgState Type Rebal Sector Block AU Total_MB Free_MB Req_mir_free_MB Usable_file_MB Offline_disks Voting_files NameMOUNTED 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 [+] >
There is also a command to interact with acfs File System 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 ~]#
4) create a file system snapshot protection.
In fact, creating a snapshot is similar to the cp process. Eg:
root@oracle-one acfsvol0]# dd if=/dev/zero of=./test.log bs=100M count=1;1+0 records in1+0 records out104857600 bytes (105 MB) copied, 0.28981 s, 362 MB/s[root@oracle-one acfsvol0]# ls -ltotal 107584drwx------ 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/acfsvol0acfsutil snap create: Snapshot operation is complete.[root@oracle-one acfsvol0]# cd .ACFS[root@oracle-one .ACFS]# lsrepl snaps[root@oracle-one .ACFS]# cd snaps/[root@oracle-one snaps]# pwd/ginf/grid/acfssystem/acfsvol0/.ACFS/snaps[root@oracle-one snaps]# ls -ltotal 4drwxr-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 -lls: cannot access lost+found: Permission deniedtotal 107520d????????? ? ? ? ? ? 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 -hls: cannot access lost+found: Permission deniedlost+found test.log[root@oracle-one acfsvol0_bak]#
Delete acfs File System snapshots
Eg:
[root@oracle-one snaps]# lsacfsvol0_bak[root@oracle-one snaps]# acfsutil snap delete acfsvol0_bak /ginf/grid/acfssystem/acfsvol0acfsutil snap delete: Snapshot operation is complete.[root@oracle-one snaps]# ls[root@oracle-one snaps]#
5) uninstall the acfs File System:
1. cancel registration of acfs File System
[root@oracle-one snaps]# acfsutil registry -d /ginf/grid/acfssystem/acfsvol0acfsutil registry: successfully removed ACFS mount point /ginf/grid/acfssystem/acfsvol0 from Oracle Registry[root@oracle-one snaps]# acfsutil registry -d /ginf/grid/acfssystem/acfsvol1acfsutil registry: successfully removed ACFS mount point /ginf/grid/acfssystem/acfsvol1 from Oracle Registry[root@oracle-one snaps]#
2. Uninstall acfs volumes
[Root @ oracle-one ~] # Umount-t acfs-
[Root @ oracle-one ~] #
If you detach a single volume umount-t acfs/directory
3. Delete 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 the volume group and delete it:
Eg:
-Bash-4.1 $ asmcmd voldisable-G route roup2-
-Bash-4.1 $ asmcmd voldelete-G role roup2 acfsvol0
-Bash-4.1 $ asmcmd voldelete-G role roup2 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,201 3, Oracle. All rights reserved.
Connected:
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!