Symantec logo

Creating a snapshot mirror of a volume or volume set used
by the database

With Database FlashSnap, you can mirror the volumes used by the database to a separate set of disks, and those mirrors can be used to create a snapshot of the database. These snapshot volumes can be split and placed in a separate disk group. This snapshot disk group can be imported on a separate host, which shares the same storage with the primary host. The snapshot volumes can be resynchronized periodically with the primary volumes to get recent changes of the datafiles. If the primary datafiles become corrupted, you can quickly restore them from the snapshot volumes. Snapshot volumes can be used for a variety of purposes, including backup and recovery, and creating a clone database.

You must create snapshot mirrors for all of the volumes used by the database datafiles before you can create a snapshot of the database. This section describes the procedure used to create snapshot mirrors of volumes.

Use the vxsnap CLI command to create a snapshot mirror or synchronize a snapshot mirror.

Prerequisites 

  • You must be logged in as superuser (root).
  • The disk group must be version 110 or later. For more information on disk group versions, see the vxdg(1M) online manual page.
  • Be sure that a data change object (DCO) and a DCO log volume are associated with the volume for which you are creating the snapshot.
  • Persistent FastResync must be enabled on the existing database volumes and disks must be assigned for the snapshot volumes. FastResync optimizes mirror resynchronization by tracking updates to stored data that have been missed by a mirror. When a snapshot mirror is reattached to its primary volumes, only the updates that were missed need to be re-applied to resynchronize it. FastResync increases the efficiency of the volume snapshot mechanism to better support operations such as backup and decision support. For detailed information about FastResync, see the VERITAS Volume Manager Administrator's Guide.
  • Snapshot mirrors and their associated DCO logs should be on different disks than the original mirror plexes, and should be configured correctly for creating snapshots by the system administrator.
  • When creating a snapshot mirror, create the snapshot on a separate controller and separate disks from the primary volume.
  • Allocate separate volumes for archive logs.
  • Do not place any datafiles, including control files, in the $ORACLE_HOME/dbs directory.

Usage Notes 

  • Create a separate disk group for Oracle database-related files.
  • Do not share volumes between Oracle database files and other software.
  • ORACLE_HOME cannot be included in the snapshot mirror.
  • Resynchronization speed varies based on the amount of data changed in both the primary and snapshot volumes during the break-off time.
  • Do not share any disks between the original mirror and the snapshot mirror.
  • Snapshot mirrors for datafiles and archive logs should be created so that they do not share any disks with the data of the original volumes. If they are not created in this way, the VxVM disk group cannot be split and, as a result, Database FlashSnap will not work.

      Note   Database FlashSnap commands support third-mirror break-off snapshots only. The snapshot mirror must be in the Snapdone state.



  Caution   The procedure given in this section is for existing volumes without existing snapshot plexes or associated snapshot volumes.


 To create a snapshot mirror of a volume or volume set


  Note   In the following procedure, volume_name is the name of either a volume or a volume set.


  1. To prepare the volume for being snapshot, use the vxsnap prepare command:

    # vxsnap -g diskgroup prepare volume \

    alloc="storage_attribute ..."


      Note   The vxsnap prepare command automatically creates a DCO and DCO volumes and associates them with the volume, and enables Persistent FastResync on the volume. Persistent FastResync is also set automatically on any snapshots that are generated from a volume on which this feature is enabled.
    For enabling persistent FastResync on a volume in VxVM 5.0, either from the command line or from within a script, use the vxsnap prepare command as described above.


  2. To verify that FastResync is enabled on the volume, use the vxprint command:

# vxprint -g diskgroup -F%fastresync volume_name

This returns on if FastResync is on. Otherwise, it returns off.

  1. To verify that a DCO and DCO log volume are attached to the volume, use the vxprint command:

# vxprint -g diskgroup -F%hasdcolog volume_name

This returns on if a DCO and DCO log volume are attached to the volume. Otherwise, it returns off.

  1. Create a mirror of a volume:

# vxsnap -g diskgroup addmir volume_name alloc= diskname

There is no option for creating multiple mirrors at the same time. Only one mirror can be created at a time.

  1. List the available mirrors:

# vxprint -g diskgroup -F%name -e"pl_v_name in \"volume_name\""


  Note   The following two steps enable database FlashSnap to locate the correct mirror plexes when creating snapshots.


  1. Set the dbed_flashsnap for the data plex you want to use for breaking off the mirror. You can choose any tag name you like, but it needs to match the tag name specified in the snapplan.

# vxedit -g diskgroup set putil2=dbed_flashsnap plex_name

  1. Verify that the dbed_flashsnap tag has been set to the desired data plex:

# vxprint -g diskgroup -F%name -e"pl_v_name in \"volume_name\"
\ && p2 in \"dbed_flashsnap\""

If you require a backup of the data in the snapshot, use an appropriate utility or operating system command to copy the contents of the snapshot to tape or to some other backup medium.

This example shows the steps involved in creating a snapshot mirror for the volume data_vol belonging to the disk group PRODdg.

  1. Prepare the volume data_vol for mirroring:

    # vxsnap -g PRODdg prepare data_vol alloc=PRODdg01

  2. Verify that FastResync is enabled:

    # vxprint -g PRODdg -F%fastresync data_vol

    on

  3. Verify that a DCO and a DCO log are attached to the volume:

    # vxprint -g PRODdg -F%hasdcolog data_vol

    on

  4. Create a snapshot mirror of data_vol:

    # vxsnap -g PRODdg addmir data_vol alloc=PRODdg02

  5. List the data plexes:

    # vxprint -g PRODdg -F%name -e"pl_v_name in \"data_vol\""

    data_vol-01

    data_vol-02


      Note   Choose the plex that is in the SNAPDONE state. Use the vxprint -g diskgroup command to identify the plex that is in the SNAPDONE state.


  6. Decide which data plex you want to use and set the dbed_flashsnap tag for it:

    # vxedit -g PRODdg set putil2=dbed_flashsnap data_vol-02

  7. Verify that the dbed_flashsnap tag has been set to the desired data plex, data_vol-02:

    # vxprint -g PRODdg -F%name -e"pl_v_name in \"data_vol\" \
    && p2 in \"dbed_flashsnap\""

    data_vol-02

  8. To verify that the snapshot volume was created successfully, use the vxprint -g <dg> command as follows:

    # vxprint -g PRODdg

TY NAME ASSOC KSTATE LENGTH PLOFFS STATE TUTIL0 PUTIL0

dg PRODdg PRODdg - - - - - -

dm PRODdg01 c1t2d0s2 - 35358848 - - - -

dm PRODdg02 c1t3d0s2 - 17674896 - - - -

dm PRODdg03 c1t1d0s2 - 17674896 - - - -

v data_vol fsgen ENABLED 4194304 - ACTIVE - -

pl data_vol-01 data_vol ENABLED 4194304 - ACTIVE - -

sd PRODdg03-01 data_vol-01 ENABLED 4194304 0 - - -

pl data_vol-02 data_vol ENABLED 4194304 - SNAPDONE - -

sd PRODdg02-01 data_vol-02 ENABLED 4194304 0 - - -

dc data_vol_dco data_vol - - - - - -

v data_vol_dcl gen ENABLED 560 - ACTIVE - -

pl data_vol_dcl-01 data_vol_dcl ENABLED 560 - ACTIVE - -

sd PRODdg01-01 data_vol_dcl-01 ENABLED 560 0 - - -

pl data_vol_dcl-02 data_vol_dcl DISABLED 560 - DCOSNP - -

sd PRODdg02-02 data_vol_dcl-02 ENABLED 560 0 - - -

Identify that the specified plex is in the SNAPDONE state. In this example, it is data_vol-02.

The snapshot mirror is now ready to be used.