ACFS read-only snapshots, introduced with the first version of ACFS in 11.2.0.1, allow us to create a point-in-time copy of the file system that is always available when the file system is online. The method used to create the copy is called “copy on write” and occurs at the extent level.
When an extent is changed, the “before” copy is saved so that the changes can be recovered. When a recovery is required, any unchanged extents use the “before” copy on the file system, which makes this an extremely space-efficient function that can be used for general purpose and CRS-managed ACFSs.
Snapshots are managed using the acfsutil snap commands, but you should keep in mind that the new features in 11.2.0.2, such as ACFS encryption and ACFS security, cannot be applied to a file system that has a snapshot. Of course, you can delete snapshots if you want to use these features, but planning to use the features before you create snapshots will ensure that you do not need to do this. Let’s go through a simple example of using snapshots with a file from a DBA we’ll call Max.
Max put a couple of ideas for his wife’s anniversary gift in a text file on an ACFS he uses for tracing. He had been updating it and did not worry too much about losing it because he knew he could take snapshots of this file system. The original file looked like this:
[grid]$ cat /u02/app/oracle/diag/myanivlist Date : 17 June Years 11 Gift For Against Diamonds - She'll be happy I am cheap Washing Machine - I'll get clean clothes Only if she forgives me
He created a snapshot like so:
/sbin/acfsutil snap create snap01 /u02/app/oracle/diag/
The snapshot was immediately viewable with the same contents as the original file:
[grid]$ cat /u02/app/oracle/diag/.ACFS/snaps/snap01/myanivlist Date : 17 June Years 11 Gift For Against Diamonds - She'll be happy I am cheap Washing Machine - I'll get clean clothes Only if she forgives me
He later added a couple of new lines:
Go Out for food - She will be happy And expecting a present too.. Black Sabbath CD - I like Ozzy She is not so keen.
The newly edited file had the changes but the snapshot remained the same, so Max created a new snapshot to back up these changes:
/sbin/acfsutil snap create snap02 /u02/app/oracle/diag/
The file /u02/app/oracle/diag/.ACFS/snaps/snap02/myanivlist now has the latest changes, which is good, because Max had to delete the file one day when his wife, who also works for the same company, Trax, accessed the system. Luckily, she did not know about ACFS snapshots, so Max was in the clear despite two copies of the file still being on disk. He eventually bought the diamonds after he received a large bonus for implementing 11g Release 2 Oracle RAC and GI, so he removed all signs of the files:
[grid]$ /sbin/acfsutil snap delete snap01 /u02/app/oracle/diag/ acfsutil snap delete: Snapshot operation is complete. [grid]$ /sbin/acfsutil snap delete snap02 /u02/app/oracle/diag/ acfsutil snap delete: Snapshot operation is complete.
This silly example shows that each snapshot provides a way to go back and view the file at that time. This is particularly useful if you need to take online backups of constantly changing file systems or if you need peace of mind that you can access an old copy of a file from a particular point in time. A snapshot works well, for example, for upgrading a database, because you can take a snapshot of the Oracle Home and create a restore point in the database that ensures you can get back to where you started before the upgrade.
Leave a Reply