Command Line Restore - UNIX and Linux File Systems

Perform the Restore Operation

You can perform a restore operation from the command line. However, to perform a restore operation with additional options, go to the CommCell Console to perform the restore.

To perform a restore operation from the command line, you need an input XML file that contains the parameter values to configure the options for the restore operation. This input xml file can be obtained using one of the following ways:

  • Download the input xml file template, and then save the file on the computer from where the restore will be performed.

Generate the input xml file from the CommCell Console by using the Save as Script option, and then save the file on the computer from where the restore will be performed.

  1. Download the restore_template.xml file and save it on the computer from where the command will be executed.

  2. From Command prompt, navigate to <Software_Installation_Directory>/Base and run the following command:

    qoperation execute -af restore_template.xml -appName 'File System' -clientName xxxxx -backupsetName xxxxx -destPath 'xxxxx' -sourceItem 'xxxxx'

    Note: If the sourceItem parameter contains a directory path, verify the path is valid before you run the command.

  3. Verify the status of the job using the following command:

    qlist job –j JOBID
  4. Once the job completes, logout from the CommServe using the qlogout command.

    qlogout [-cs <commserve host name>] [-all] [-tf <tokenfile>] [-tk <token>] [-h]

Examples

Restoring from a Current Backup

qoperation execute -af restore_template.xml -appName 'File System' -clientName client1 -backupsetName backupset1 -destPath '/etc4' -sourceItem '/etc'

Restoring Files to a Point-in-Time (Date)

qoperation execute -af restore_template.xml -appName 'File System' -clientName client1 -backupsetName backupset1 -destPath '/etc4' -sourceItem '/etc' -toTimeValue 2011-11-28

Restoring Files to a Point-in-Time (Date and Time)

qoperation execute -af restore_template.xml -appName 'File System' -clientName client1 -backupsetName backupset1 -destPath '/etc4' -sourceItem '/etc' -toTimeValue 2011-11-28 15:40:00

Restoring by Jobs

qoperation execute -af restore_by_job_template.xml -associations/clientName client1 -associations/backupsetName backupset1 -destClient/clientName client1 -jobids 52 -sourceItem 2:52 -striplevel 1

where:

  • jobids is the backup job ID

  • sourceItem is the CommCell ID and the backup job ID separated by a colon (':'). By default, the CommCell ID is 2.

  • Optional: striplevel is the number of folder levels to exclude from the source path.

    For example, if you have a directory structure (source path) as /a/b/c and you select strip level 2, the data will be restored from folder c, while folders a and b are excluded. Ensure that the strip level is always less than the source path level.

Generate the Command Line Script from the CommCell Console

In addition to the parameter values provided in the template xml file, if you want to include additional options for the restore, you can do so by selecting the required options from the CommCell Console and generate the command line xml script for the restore operation.

Follow the steps given below to generate a script which you can use to perform a restore from the command line interface:

  1. From the CommCell Browser, navigate to Client Computers | <Client> | File System.

  2. Right-click the <Backup Set> and click All Tasks | Browse and Restore.

  3. Click View Content.

  4. In the right pane of the Browse window, select the data that you want to restore and click Recover All Selected.

  5. Select the required restore options which you want to execute using the script.

  6. Click Save as Script.

    imagesklzzwxh:0040estoreklzzwxh:0041inuxklzzwxh:0042ave_script.png

  7. Enter the location to save the script along with the file name and extension. For example, "C:\scripts\myscript.bat" on Windows and "/usr/scripts/myscript.sh" on UNIX. Alternatively, you can also click Browse and navigate to the location.

    The script will be saved as a .xml file and .bat/.sh file.

    If a file with the same name already exists in the specified location, both the .xml and .bat/.sh files will be overwritten.

  8. Enter the username and password for the user account which you want to use to perform the restore.

    By default, the user account which you have used to login to CommCell console is used for performing the restore. However, if the user account does not have access to application and database, click Use a different account.

  9. Click OK.

    save_script2

Find Data

The following command is available for finding backed up data.

qlist backupfiles
Description

This command performs a search operation on backed up files and saves the results to a file. The type of operation is defined in the opType attribute in the XML request file:

  • Find: Performs a recursive search and returns a list of files and folders. Specify recursion by using asterisks in the path attribute as shown: <paths path="/etc/data/**/*"/>.

  • Browse: Performs a search on one directory and returns a list of files and folders in that directory. (The Browse operation is not recursive.)

  • Versions: Lists all of the versions of a single file.

In case of an error, an error code and description are displayed as: "backupfiles: Error errorcode: errordescription"

Usage
qlist backupfiles -af <path_to_input_XML_file> -dpath <path_to_output_XML_file> [-tf <tokenfile>] [-tk <token>] [-example] [-h]
Options

-af

XML file that contains the request

-dpath

Destination path and file name for the XML output file

-tf

Reads token from a file

-tk

Token string

-example

Sample "find" and "browse" XML requests

-h

Displays help

Diagnostics

Possible exit status values are:

0 - Successful completion.

1 - CLI usage failures, due to the use of an unsupported option or missing argument.

2 - Any other failure.

Examples
  • For the default subclient, finds all of the files and folders in the /etc/data directory and its subdirectories.

    qlist backupfiles -af /dir1/input_find.xml -dpath /dir1/results.xml

    XML example for the Find operation:

    <databrowse_BrowseRequest opType="Find">
       <entity _type_="0" appName="File System" backupsetName="defaultBackupSet" clientName="vmcs100_cn" subclientName="default"/>
       <paging pageSize="4294967295" skipNode="0"/>
       <mode mode="2"/>
       <paths path="/etc/data/**/*"/>
     </databrowse_BrowseRequest>
  • For the default subclient, browses the files and folders in the /etc directory.

    qlist backupfiles -af /dir1/input_browse.xml -dpath /dir1/results.xml

    XML example for the Browse operation:

    <databrowse_BrowseRequest opType="Browse">
       <entity _type_="0" appName="File System" backupsetName="defaultBackupSet" clientName="vmcs100_cn" subclientName="default"/>
       <mode mode="2"/>
       <paging pageSize="4294967295" skipNode="0"/>
       <paths path="/etc"/>
       <timeRange fromTime="0" toTime="1331280338"/>
     </databrowse_BrowseRequest>
  • For the default subclient, lists the versions available for the fileversion.txt file.

    qlist backupfiles -af /dir1/input_version.xml -dpath /dir1/results.xml

    XML example for the Versions operation:

    <databrowse_BrowseRequest opType="Versions">
       <entity _type_="0"appName="File System" backupsetName="defaultBackupSet" clientName="vmcs100_cn" subclientName="default"/>
       <mode mode="2"/>
       <paths path="/fileversion.txt"/>
       <options restoreIndex="true"/>
         <timeRange>
         <fromTime>2016-01-01 00:00:00</fromTime>
         <toTime>2017-01-01 00:00:00</toTime>
       </timeRange>
     </databrowse_BrowseRequest>

Loading...