6.2.8.11 snapshotfile

Create snapshots.

Purpose

The snapshotfile command creates a snapshot of a file or group of files.

Syntax

snapshotfile source1 target1 [ sourceN targetN ]... [ --exclude exclude-spec ]...

Command Options

The options for the snapshotfile command are:

  • source1-N: Specifies the name of the file or files that are the snapshot source.

  • target1-N: Specifies the name of the file or files that are the snapshot destination.

  • --exclude: Specifies the name of the file or files that are excluded from the snapshot operation.

Usage Notes

Note the following information when using this command:

  • You can use a wildcard (*) in the source to specify multiple source files, in which case the corresponding target must also contain a matching wildcard.

  • All files in a snapshot operation must be in the same vault, otherwise and error is returned.

  • Multiple source and target pairs are permitted. In this case, the source file specifications are considered in order, and only the first match is used.

  • Files specified using the --exclude option are excluded from the snapshot operation. Such exclusions apply across all of the source and target pairs.

  • If you specify a null (empty) string as a target value, no snapshots are created for the corresponding source. Specifying a null target is an alternative method of excluding files from the snapshot operation.

    The source and null target is considered in order along with all other source and target pairs, and only the first match is used.

  • All snapshots created in the same operation are point-in-time consistent.

Examples

Example 6-105 Snapshot a File

This example shows creating a snapshot. The source file @MYDATA/file-1 is and the snapshot is @MYDATA/snap-file-1.

@> snapshotfile @MYDATA/file-1 @MYDATA/snap-file-1

Example 6-106 Snapshot a Group of Files

This example shows creating snapshots for a group of files using a wildcard. Assuming the existence of files named @MYDATA/file1, @MYDATA/file2, and so on, the example creates a snapshot of @MYDATA/file1 named @MYDATA/snap-dir/file1, @MYDATA/file2 named @MYDATA/snap-dir/file2, and so on.

@> snapshotfile @MYDATA/file* @MYDATA/snap-dir/file*

Example 6-107 Snapshot Multiple File Groups

This example shows creating snapshots for multiple groups of files using wildcards. The source file groups are @MYDATA/a* and @MYDATA/b*, with the resulting snapshots located under @MYDATA/snap/.

@> snapshotfile @MYDATA/a* @MYDATA/snap/a* @MYDATA/b* @MYDATA/snap/b*

Example 6-108 Ordering Significance

These examples show the significance of the order in which the source and target pairs are specified.

In the first command, the snapshots for files matching @MYDATA/a* are created in @MYDATA/snap/a, and the snapshots for the other files are created in @MYDATA/snap/other.

@> snapshotfile @MYDATA/a* @MYDATA/snap/a/a* @MYDATA/* @MYDATA/snap/other/*

In the following command, all of the snapshots are created in @MYDATA/snap/other because all of the files match @MYDATA/*. In this case, the second source and target pair is never used.

@> snapshotfile @MYDATA/* @MYDATA/snap/other/* @MYDATA/a* @MYDATA/snap/a/a*

Example 6-109 Snapshot a Group of Files with Exclusions

The following examples show how to snapshot files in @MYDATA, except for those matching with @MYDATA/a* or @MYDATA/b*.

@> snapshotfile @MYDATA/* @MYDATA/snap/* --exclude @MYDATA/a* --exclude @MYDATA/b*
@> snapshotfile @MYDATA/a* "" @MYDATA/b* "" @MYDATA/* @MYDATA/snap/*

Example 6-110 Invalid Commands

The following examples show invalid commands. The first and second commands are invalid because multiple vaults are referenced. The final command is invalid because the snapshot destination does not contain a wildcard to match the source specification.

@> snapshotfile @MYDATA/a* @MYDATABACKUP/a*
@> snapshotfile @MYDATA/a* @MYDATA/snap/a* @VAULT2/a* @VAULT2/snap/a*
@> snapshotfile @MYDATA/withwc* @MYDATA/snap/withoutwc