This tutorial shows you how to create and manage the ASM Cluster File System (ACFS).
Approximately 1 hour
This tutorial covers the following topics:
Overview | ||
Scenario | ||
Prerequisites | ||
Creating an ACFS file system | ||
Summary | ||
Related information |
Place the cursor over this icon to load and view all the screenshots for this tutorial. (Caution: This action loads all screenshots simultaneously, so response time may be slow depending on your Internet connection.)
Note: Alternatively, you can place the cursor over each individual icon in the following steps to load and view only the screenshot associated with that step.
This tutorial covers how configure and manage the ASM Cluster File System In Oracle 11 Release 2 using the supplied utilities
The focus of this tutorial includes: creating ASM dynamic volumes, managing the ACFS, and using the snapshot feature. The supported utilities are demonstrated
An Oracle Database 11g Release 2 database installation already exists. Oracle Grid Infrastructure has been installed, and an ASM instance configured.
Before starting this tutorial, you should:
1. | Have completed OBE Installing Grid Infrastructure for a Standalone Server through the topic "Configure EM Database Control to manage ASM" This tutorial assumes the following conditions that are included in the OBE referenced above::
|
|
2. | Download and unzip the acfs.zip file into your working directory which contains the files needed to perform this tutorial.
|
Oracle ASM Cluster file system (ACFS) is new in Oracle 11g Release 2. ACFS is intended as a general files system accessible by the standard OS utilities, ACFS can be used in either a single server of a cluster environment. Create the ACFS by creating the ASM dynamic volume and mounting that volume to the OS. Prior to using the ACFS file system four drivers must be loaded. On Linux they are: oracleasm, the ASM module; oracleadvm, the ASM dynamic volume manager module; oracleoks, the kernel services module; and oracleacfs, the ASM file system module. These modules are loaded during installation, but are not part of the Oracle Restart
In this topic you will use multiple tools to perform the operations.
Managing ASM volumes | ||
Mounting the ACFS | ||
Using EM to Create a Volume and Mount an ACFS |
1. | Open a terminal window, and become the root OS user. Use the su - root command
|
2. | As the root user, determine if the required modules are loaded. They are oracleasm, oracleadvm, oracleoks, and oracleacfs. The following command shows all the modules known to the OS. lsmod
|
3. | Reboot the server . Use the command reboot
|
4. | Open a terminal window, and become the root OS user. Use the su - root command
|
5. | As the root user, determine if the require modules are loaded. the following command shows all the modules known to the OS. Notice only the oracleasm module is loaded, even though the ASM instance has been restarted automatically by Oracle Restart. lsmod
|
6. | Manually load the modules required for ACFS, with the command: /u01/app/grid/product/11.2.0/grid/bin/acfsload start -s |
7. | Configure a initialization script to load the ACFS modules at startup. In the /etc/init.d directory, create a file called acfsload with your editor of choice. gedit /etc/init.d/acfsload The file will contain the runlevel configuration, and the acfsload command. Place in the file the following lines #!/bin/sh # chkconfig: 2345 30 21
Save the file and exit the editor.
|
8. | Change the permissions on the acfsload script to allow it to be executed by root with the command: chmod u+x /etc/init.d/acfsload
|
9. | Create links in the rc2.d, rc3.d, rc4.d, and rc5.d runlevel directories. Use the chkconfig command to add and confirm the configuration. chkconfig --add acfsload chkconfig --list acfsload
|
10. | Reboot to confirm that the ACFS drivers load. reboot
|
11. | Open a terminal window, and become the root OS user. Use the su - root command
|
12. | As the root user, determine if the required modules are loaded. the following command shows all the module known to the OS. lsmod
exit |
1. | In a terminal window, as the oracle OS user. Set the environment for the +ASM instance with the oraenv script. Enter +ASM when prompted for the ORACLE_SID. . oraenv
|
2. | Using SQL*Plus connect as sysasm to create a ASM volume using the command sqlplus / as sysasm SQL> ALTER DISKGROUP data ADD VOLUME volume1 SIZE 400M;
|
3. |
Using SQL* Plus view the properties of the ASM volume SQL> SET PAGESIZE 100 SQL> SELECT * FROM V$ASM_VOLUME; SQL> EXIT
|
4. | Using the ASMCMD utility create a ASM volume of 100MB with the following commands: asmcmd ASMCMD> volcreate -G DATA -s 100M volume2
|
5. | View the properties of the ASM volumes notice the volume sizes. Use ASMCMD command: ASMCMD> volinfo -a ASMCMD> exit
|
6. | Remove the ASM Volume, VOLUME2, use the ASMCMD command in command line mode. asmcmd voldelete -d DATA volume2
|
1. | In a terminal window as the oracle OS user, create a set of directories to use as mount points. Create the mount points under the ORACLE_BASE/acfsdata directory. For this exercise create three directories:orabin, images, misc with the following commands. mkdir -p /u01/app/oracle/acfsdata/orabin mkdir -p /u01/app/oracle/acfsdata/images mkdir -p /u01/app/oracle/acfsdata/misc
|
2. | As the root user, create the ACFS filesystem on the ASM volume1to mount point /u01/app/oracle/acfsdata/orabin using OS commands. The device name is found in the output of the volinfo command show previously. Note; the extension of the volume name, '-##' that is contained in the prior screenshot. su - root mkfs -t acfs -b 4k /dev/asm/volume1-###
|
3. | As the root user, mount the acfs filesystem with the OS command mount -t acfs /dev/asm/volume1-<###> /u01/app/oracle/acfsdata/orabin
|
4. | Verify that the volume has been mounted with the OS command df -h
|
5. | The Oracle ACFS mount registry is supported for Oracle Restart configurations, but cannot automatically mount Oracle ACFS registered file systems. However, all Oracle ACFS file systems listed in the Oracle ACFS Mount Registry can be mounted with a single mount command. (The ACFS mount registry is supported for cluster configurations and automatically mounts ACFS volumes to the cluster wide mount points) Register the ACFS volume1 with he ACFS mount registry to enable the automount workaround with the following command. Note Change the volume name extension to match the previous commands. acfsutil registry -a /dev/asm/volume1-<###> /u01/app/oracle/acfsdata/orabin
exit Note: After reboot or ASM restart the ACFS volume registered in the ACFS mount registry can be mounted with a single command executed by the root user: mount –t acfs –o all none none
|
To use EM to Create a Volume and Mount the ACFS, perform the following steps:
1. | Open a terminal window, as the oracle OS user. Set the environment for the orcl instance with the oraenv script. Enter orcl when prompted for the ORACLE_SID. . oraenv
|
2. | Start EM database control with the command: emctl start dbconsole
|
3. | Access EM database control in your browser with the URL https://localhost:1158/em, and then login:
|
4. | On the database home page, in the General section click the ASM link: +ASM.example.com
|
5. | On the Automatic Storage Management: +ASM.example.com page click the ASM Cluster File System tab.
|
6. | On the Automatic Storage Management Login page, enter:
|
7. | On the ASM Cluster File System page, click Create
|
8. | On the Create ASM Cluster File System page, click Create ASM Volume.
|
9. | On the Create ASM volume page, create a volume:
Click OK.
|
10. | On the ASM Cluster File System page, give the volume a label.
|
11. | On the ASM Cluster File System Host Credentials: host01.example.com page, enter username and password for the ASM instance administrator
|
12. | On the Automatic Storage Management: +ASM.example.com page, you will see a confirmation message.
|
13. | On the Mount ASM Cluster File System: /dev/asm/volume3-<##> page, enter the mount point.
|
14. | On the Show Command page, the command to mount the ACFS filesystem is shown. Since this command must be run as the root, open a terminal window and become the root user. Paste the command that is shown into the root window and execute it. The command is: /bin/mount -t acfs -rw /dev/asm/volume3-<##> /u01/app/oracle/acfsdata/images The root window will look like this:
Exit the root window On the Show Command page, click Return On the Mount ASM Cluster File System: /dev/asm/volume3-<##> page, click Return
|
15. | On the Automatic Storage Management: +ASM.example.com page, view the mounted filesystems. You should see two mounted filesystems.
|
In this topic you use the ACFS file system. You create files in the file systems you have created. As a general purpose file system all the file system OS commands are available for use. In this exercise you will move a part of the ORACLE_HOME directory into an ACFS file system. ACFS does not support any part of Grid Infrastructure home directory in an ACFS, and does not support the / (root) directory in ACFS.
You will use ACFS advanced features such as snapshots and dynamic volume resize.
Using OS commands with ACFS file system |
To resize an ASM volume, perform the following steps:
In this topic, add a disk to the ASM diskgroup and then increase the size of the VOLUME1 ASM volume.
1. | Use EM database control. Navigate to the Database home page. Click Database tab.
On the Home page, click the +ASM.example.com link.
|
2. | On the Automatic Storage Management: +ASM.example.com page click the Disk Groups tab.
|
3. | On the Disk Groups tab, click the DATA disk group link. Click Add
|
4. | On the Add Disks page, select the disk with the Path ORCL:DATA4. Click Ok.
|
5. | Notice that the Used (%) is not balanced initially.
After a minute or so, click the Refresh button in your browser to check if the disk groups were rebalanced.
On this page click the breadcrumb at the top left of the page to return to the Automatic Storage Management: +ASM.example.com page.
|
6. | On the Automatic Storage Management: +ASM.example.com page click the ASM Cluster File System tab.
|
7.. | On the ASM Cluster File System tab,
|
8 | On the Resize ASM Cluster File System: /u01/app/oracle/acfsdata/orabin page, change the size of the volume to 800 MB. Click OK.
|
9. | On the ASM Cluster File System Host Credentials: host01.example.com page, enter username and password for the ASM instance administrator
|
10. | On the Automatic Storage Management: +ASM.example.com page, Notice that the size of volume at the mount /u01/app/oracle/acsfdata/orabin is now 1 GB in size. The ASM volume manager allocates space in 256MB increments. |
1. | The ACFS volumes were mounted by root and owned by root. To allow general use by other OS users change the permissions to allow anyone to read, write and execute the images directory. change the permissions so that the orabin directory is owned by oracle:oinstall with the permissions 755. Use the following commands: su - root chmod 777 /u01/app/oracle/acfsdata/images chown oracle:oinstall /u01/app/oracle/acfsdata/orabin chmod 755 /u01/app/oracle/acfsdata/orabin exit
|
2. | Open a terminal window as the OS user named oracle. Copy a file into the IMAGES ACFS volume. change directory to the images directory and list the contents cp /home/oracle/wkdir/acfs/images.zip /u01/app/oracle/acfsdata/images ls /u01/app/oracle/acfsdata/images
|
3. | Change directory to the images volume and extract the files from the zip file. cd /u01/app/oracle/acfsdata/images unzip images.zip
|
4. | View an image file, and then close it. The Firefox browser will open a gif file.
|
5. | As the root user, copy the /u01/app/oracle/product/11.2.0/dbhome_1/bin directory to the ACSF /u0/app/oracle/acfsdata/orabin directory.
su - root cd /u01/app/oracle/product/11.2.0/dbhome_1 pwd cp -rp bin/* /u01/app/oracle/acfsdata/orabin exit
|
6. | In a terminal window as the oracle OS user, with the environment set to the orcl instance, stop EM database control with . oraenv emctl stop dbconsole |
7. | Shutdown the orcl instance use srvctl stop database -d orcl
|
8. | Move the $ORACLE_HOME/bin directory mv $ORACLE_HOME/bin $ORACLE_HOME/bin.org
|
9. | Create a symbolic link from the original ORACLE_HOME/bin to the ACFS orabin directory. ln -s /u01/app/oracle/acfsdata/orabin $ORACLE_HOME/bin
|
10. | Attempt to use SQL*Plus from the ACFS orabin directory
which sqlplus sqlplus / as sysdba SQL> startup SQL> exit
|
11. | Start EM database control with the command: emctl start dbconsole |
Creating an ACFS Snapshot | |
ACFS snapshots may be managed with either acfsutil utility or Enterprise Manager. Both methods are shown in this topic.
1. | Using EM database control, navigate to the Automatic Storage Management: +ASM.example.com page and the ASM Cluster File System tab.
|
2. | On the Create Snapshot on ASM Cluster File System: /u01/app/oracle/acfsdata/images page
|
3. | On the ASM Cluster File System Host Credentials: host01.example.com page, enter username and password for the ASM instance administrator
|
4. | On the Automatic Storage Management: +ASM.example.com page, Notice that the number of snapshots is 1 for the /u01/app/oracle/acfsdata/images filesystem.
|
5. | In a terminal window as the oracle user, delete the file asm.gif from the /u01/app/oracle/acfsdata/images directory. rm /u01/app/oracle/acfsdata/images/gridInstall/asm.gif
|
6. | In a terminal window become the root user and view the commands available in the acfsutil utility. su - root acfsutil -h
|
7. | Create another snapshot in the /u01/app/oracle/acfsdata/images file system. Use the acfsutil command: acfsutil snap create snapshot_2 /u01/app/oracle/acfsdata/images |
8. | View the snapshots with OS commands: Each snapshot contains all the files that were in the original filesystem at the time the snapshot was created. though to conserve space on the block that have been changed from the original are recorded in the snapshot. The snapshot contains the original block the filesystem holds the changes. ls -l /u01/app/oracle/acfsdata/images/.ACFS/snaps
exit
|
To Restore from a Snapshot, perform the following steps:
First, restore the file using OS commands, and then Use EM to find the file in the snapshots.
1. | In a terminal window as the oracle OS user, you discover the asm.gif file is missing. cd /u01/app/oracle/acfsdata/images ls gridInstall/asm.gif
|
2. | Check the snapshots to determine if the file asm.gif can be restored ls .ACFS/snaps/*/gridInstall/asm.gif
|
3. | Copy the asm.gif from snapshot_1 to the original location. cp .ACFS/snaps/snapshot_1/gridInstall/asm.gif gridInstall/asm.gif
|
4. | View the asm.gif file with the browser. Enter the URL file:///u01/app/oracle/acfsdata/images/gridInstall/asm.gif
|
5. | Using EM database control search snapshot_2 for the asm.gif file. Using EM database control, navigate to the Automatic Storage Management: +ASM.example.com page and the ASM Cluster File System tab, Click the snapshots link (shows the number of snapshots for this filesystem ) for the /u01/app/oracle/acfsdata/images filesystem. Enter the host credentials if asked.
|
6. | On the ASM Cluster File System: /u01/app/oracle/acfsdata/images page: Snapshots tab, click Snapshot_2
|
7. | On the Search and List: Directory page,
|
8. | The file was not found. Search snapshot_1.
On the Search and List: Directory page,
Now that the file has been found it can be restored using OS commands. |
To return the OBE environment to the same state it was in at the beginning of this exercise, perform the following steps:
1. | Close all windows. Open one terminal window and as the root user execute the following command: su - root /home/oracle/wkdir/acfs/cleanup.sh
|
2. | If you wish to replay this OBE, reboot and return to the first topic. If you are finished with this OBE, continue to the cleanup section of the OBE Install Grid Infrastructure for a Single Server, to finish the cleanup of the OBE environment
|
In this lesson, you learned how to:
Create an ACFS filesystem | ||
Manage ACFS volumes and mount points | ||
Create and manage ACFS snapshots |
To learn more about ASM and Grid installation you can refer to:
Additional OBEs on the OTN Web site. |
Place the cursor over this icon to hide all screenshots.