Command Line Interface - Restore

Generate the Command Line Script from the CommCell Console

In order o run the restores from command line, you need an input xml file which contains the parameter values for configuring the restore options. This input xml file can be obtained by generating the script from the CommCell Console and saving it on the computer from where the restore will be performed.

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> | MySQL | <Instance> | <Backup Set>.

  2. Right-click the <Instance> and then click All Tasks | Browse Backup Data.

  3. Click OK.

  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.

  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_as_script2

Perform the Restore

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

    qlogin -cs <commserve name> -u <user name>

  2. Navigate to the location where the .xml file is saved and execute the saved .xml script using the qoperation execute command.

    qoperation execute -af restore.xml -appName 'MySQL' -clientName xxxxx -instanceName xxxxx -destPath 'xxxxx' -sourceItem 'xxxxx' -temporaryStagingLocation '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, log off 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.xml -appName 'MySQL' -clientName client1 -instanceName instance1 -destPath '/etc4' -sourceItem '/etc' -temporaryStagingLocation c:\restores

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

qoperation execute -af restore.xml -appName 'MySQL' -clientName client1 -instanceName instance1 -destPath '/etc4' -sourceItem '/etc' -temporaryStagingLocation c:\restores -toTimeValue 2011-11-28

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

qoperation execute -af restore.xml -appName 'MySQL' -clientName client1 -instanceName instance1 -destPath '/etc4' -sourceItem '/etc' -temporaryStagingLocation c:\restores -toTimeValue '2011-11-28 15:40:00'

Restoring a Specific Database

qoperation execute -af restore.xml -appName 'MySQL' -clientName client1 -instanceName instance1 -destPath '/etc4' -sourceItem' '\db_name' -temporaryStagingLocation c:\restores

Restoring All Databases

qoperation execute -af restore.xml -appName 'MySQL' -clientName client1 -instanceName instance1 -destPath '/etc4' -sourceItem' '/' -temporaryStagingLocation c:\restores

Restoring only data (without logs)

qoperation execute -af restore.xml -appName 'MySQL' -clientName client1 -instanceName instance1 -destPath '/etc4' -sourceItem '/etc' -temporaryStagingLocation c:\restores -mySqlRstOption/data 'true' -mySqlRstOption/log 'false'

Restoring only logs

qoperation execute -af restore.xml -appName 'MySQL' -clientName client1 -instanceName instance1 -destPath '/etc4' -sourceItem '/etc' -temporaryStagingLocation c:\restores -mySqlRstOption/data 'false' -mySqlRstOption/log 'true'

Loading...