Skip to main content

Commvault Restores

Commvault Restores

Commvault restore types:

MySQL Restores

File level restores

VPC Restores

====================================================================================

MySQL Restores

There are 2 types of database restore we can look to perform through commvault, depending on the type of backups in use.

If the client has MySQL level backups, see here

If the client only had file-level backups, see here

====================================================================================

MySQL level backups

Starting the restore job

Commgui > Client Servers > Ctrl+F > Search SID > Double Click MySQL > Double Click SID   

Right click > All tasks > browse and restore > Untick Recover > Select Required Date using end time  

Select Required Database from the list > Recover Selected  

Post-restore action

Once the db has been restored onto the server, the use statements need to be removed on the restored files: 

grep -i ^USE DBNAME
sed -i '/^[uU][sS][eE] /d' DBNAME

Replaying bin logs 

cp –a DBNAME DBNAME.sql 

Check disk space before replaying 


mysqlbinlog -v --database="DBNAME" RESTOREPATH/BINFILENAME.* >> RESTOREPATH/DBNAME.sql

 

Replaying bin logs to a certain time: (NOTES NEED TO BE IMPROVED) 

 

https://kb.ukfast.net/MySQL#Bin_Logs 

 

Once the bin logs have been been replayed, we can look to remove the bin logs and older db copy  

------------------------------------------------------------------------------------------------------------------------------------------ 

Restoring a specific table from DB level backups 

------------------------------------------------------------------------------------------------------------------------------------------ 

Identify the line number of the desired table in the dump file: 

grep -in 'dumping data for' dumpfile.sql 

Next, we need to remove the lines before and after the desired table 

sed -i '10611,28206dm2meandemcom.sql 

The 2 numbers here are the line number of the next table (shown in the original grep command) and the final tables line number (also in the dump) 

Next we do the same for the table line numbers before the one we need: 

sed -i '51,10581d' m2meandemcom.sql 

 ====================================================================================

File level database restore

====================================================================================

File Level Restores

====================================================================================

eCloud VPC Restores

------------------------------------------------------------------------------------------------------------------------------------------ 

Commvault VM Level Backup Restore: 

VM in CommGUI > browse and restore > Full Virtual Machine > Select VM > Restore full VM  

 >  Select Restore DataStore, change name to VMID_TICKETNUMBER> Go  

Vmware > search for restore VM (VMID_Ticket)  

Edit settings (along the top)  

Network adapter disable power on connect  

Add disk size of restore  

Power on restore VM  

Add new disk onto server:  

Lsblk - find disk name 

Mkfs /dev/(device name) 

Mount /dev/sdb /mnt 

Move desired files into restore directory  

Unmount disk from server through vSphere  

Open main server in vSphere  

Add disk > existing disk > choose from restore datastore  

Log onto server > expand disk onto fs  

Mkdir /restore_ticketno 

Mount /dev/diskname /restore_ticketno 

Move files off mounted disk onto server 

Umount /dev/diskname  

Once done, 

Vsphere > edit settings > remove disk  

------------------------------------------------------------------------------------------------------------------------------------------ 

Removing Restore 

 

Once the client has finished with the restore, the disk will need to be unmounted from the server and the restore VM can be deleted. 

 

SSH onto client VPC > df –h > check for /restore > umount /restore 

 

Once the disk has been unmounted: 

 

Vmware > Client VM >  Edit Settings > Restore Disk > Remove (X on right side) 

 

Now delete the Restore VM: 

 

Vmware > restore VM > Power Off > Actions > Delete From Disk 

 

------------------------------------------------------------------------------------------------------------------------------------------ 

Attach disk 

Access restored server 

Lsblk - find device name 

Mkfs /dev/(device name) 

Mount /dev/(devicename) /mnt 

 

Main server > edit settings > attach device > existing disk > find disk 

On server: 

Mount /dev/(devicename) /mnt 

Move restored files onto server