9.5 Restoring an Individual Element from Backup

If you mistakenly delete an element with rmelem, you can restore it from a backup copy, using the procedure presented in this section.

NOTE: This procedure cannot be used to recover an element in a UCM (component) VOB.

Removing a directory element does not remove the file elements cataloged within it; file elements exist independently of directory elements. In many cases, deleting a directory element causes the files within it to be transferred to the VOB's lost+found directory. Look there first if you've accidentally removed a directory element.

This is the procedure for restoring a single element from a backup of a non-UCM VOB:

  1. Unregister the VOB whose element has been deleted.

  2. Restore the most recent backup of the VOB storage directory to a temporary location on the ClearCase LT server.

  3. Register the restored backup.

  4. Create a temporary VOB to hold the element you need to restore. Because the VOB and the restored backup cannot both be active at the same time, this temporary VOB serves as a staging point to which the element you're recovering can be copied.

  5. Use cleartool relocate to relocate the element from the backup VOB to the temporary VOB.

  6. Unregister the backup VOB.

  7. Re-register the original VOB.

  8. Use cleartool relocate to relocate the element from the temporary VOB to the original VOB.

  9. Delete the backup VOB and the temporary VOB.

As an example, suppose that file element util.c is deleted from directory \proj\src. The VOB-tag is \proj, and the VOB storage directory is c:\vobstore\proj.vbs on the local host. Here's how the VOB owner can restore the element from a backup copy.

NOTE: The procedure described here restores the element to the version of its directory that is selected by the view in which the procedure takes place. It does not restore the element to earlier versions of the directory.

  1. Remove the VOB-tag and registry entries. These entries prevent use of an old version of the same VOB.

  2. cleartool rmtag -vob \proj
    cleartool unregister -vob \\sol\vobstore\proj.vbs

  3. (UNIX server only) Terminate the VOB's server processes. Search the process table for the vob_server and vobrpc_server processes that manage that VOB. Use ps -ax or ps -ef, and search for /vobstore/proj.vbs; use kill(1) to terminate any such processes. (Only the root user can kill a vobrpc_server process.)

  4. Restore the VOB storage directory from the backup to a temporary location. Because this is a temporary copy that only one client will need to access for a brief period, you may want to follow the procedures for a simple manual VOB restore as described in Restoring a VOB from Backup Without vob_restore.

  5. Register the backup VOB. Use cleartool commands like the following:

  6. cleartool register -vob \\sol\users\tmp\proj.vbs
    cleartool mktag -vob -tag \oldproj \\sol\users\tmp\proj.vbs

  7. Create a new, temporary VOB. Because the original VOB and the backup VOB cannot be active at the same time, you need this temporary VOB to hold a copy of the element you're recovering. Later, you can unregister the backup, register the original VOB, and copy the element from the temporary VOB to the original VOB. Unless the element is very large, this temporary VOB does not need much disk space.

  8. cleartool mkvob -nc -tag \tmpvob \\sol\users\tmp\tmpvob.vbs
    Created versioned object base.
    .
    .

  9. Relocate the element from the backup VOB to the temporary VOB. Use the cleartool relocate command to relocate the element into the temporary VOB. Create the data file in the old VOB and run clearimport in the temporary VOB. In this example, Z: is the root of a view that uses the default config spec.

  10. z:\> cd oldproj\src
    z:\oldproj\src> cleartool relocate util.c \tmpvob

  11. Unregister the backup VOB. You can use these cleartool commands to unregister the VOB.

  12. cd \
    cleartool rmtag -vob \oldproj
    cleartool unregister -vob \\sol\users\tmp\proj.vbs

  13. (UNIX server only) Terminate the backup VOB's server processes. This is similar to Step #3 of this procedure. This time, search the process table for a vob_server and/or vobrpc_server invoked with /usr/tmp/proj.vbs.

  14. Re-register the original VOB. You can use these cleartool commands to re-register the VOB.

  15. cleartool register -vob \\sol\vobstore\proj.vbs
    cleartool mktag -vob -tag \proj \\sol\vobstore\proj.vbs

    NOTE: If you are registering a UCM project VOB, you must use the -ucmproject option with the register command.

  16. Relocate the element from the backup VOB to the temporary VOB. Use the cleartool relocate command program as in Step #8 to relocate the element from the temporary VOB to the original VOB.

  17. z:\> cd \tmpvob
    z:\tmpvob> cleartool relocate util.c \proj\src

  18. Clean Up. Unregister the temporary VOB. Remove the temporary VOB and the backup VOB. Use the VOB storage node for the VOB in the ClearCase Administration Console or the rmvob command, which removes the VOB's registry entries and terminates all of its server processes.

  19. cleartool rmvob c:\users\tmp\tmpvob.vbs
    Remove versioned object base "c:\users\tmp\tmpvob.vbs"[no] yes
    Removed versioned object base "c:\users\tmp\tmpvob.vbs".

    cleartool rmvob c:\users\tmp\oldproj.vbs
    Remove versioned object base "c:\users\tmp\oldproj.vbs"[no] yes
    Removed versioned object base "c:\users\tmp\oldproj.vbs".