Restore - perform component level restore
Use this method to perform a component level restore from the backup location.
Complete the following steps:
- Set the backup location to a variable, using the backupLocations command.In the following example, BL6 is set to the sixth backup location in the admin.backupLocations list, with the first located in position [0]:
>>> BL6=admin.backupLocations[5] - Set the comp_restore variable to the list of
ptypeobjecttypes available to restore:>>> comp_restore = BL6.list_restoreable_objectypes('ptype') - Use the restore_all method to perform a component
level restore on the available list of objecttypes:
>>> comp_restore.restore_all()If the data is encrypted, specify a valid password to access the data:>>> comp_restore.restore_all('password')To restore only a single item from the list, use the restore method as follows:>>> comp_restore[0].restore() or >>> comp_restore[0].restore('password')
The following example code shows how you might monitor the status
of the restore job:
>>> import time
>>> bl = admin.backupLocations[5]
>>> print "Restore from Location %s" % bl.name
>>> #print bl
>>> ptypes = bl.list_restoreable_objecttypes('ptype')
>>> for ptype in ptypes:
... if "Guardium" in ptype['name']:
... print "Found Guardium"
... job=ptype.restore('')
... print "job started %s" % str(job)
...
... while job.isStatusTransient():
... time.sleep(15)
... job=job.refresh()
...
... print "Current State of job is: %s\n" % job.state
...
... if job.state == "failed"
... job.download_logs(uncompress=True)
... print "Job failed"
...
job started
Current State of job is: <state>
List the details for a component level item
To
display the details for an item in the component objecttype list,
you can specify the list as follows:
comp_restore[0]Restoring a subset of the component list
After
generating the list of objecttypes to restore, you can delete some
of them and restore the remaining items:
>>> comp_restore = BL6.list_restoreable_objectypes('ptype')
>>> del comp_restore[0]
>>> del comp_restore[1]
>>> comp_restore.restore_all()