Skip to main content

Commvault Restores

Commvault DB Restores

For restoring MySQL data via commvault, we first need to identify the type of backups the client is running.

See here for MySQL level backups

See here for file level backups

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

MySQL Level Backup Restore

Check disk space on client-server to ensure there is enough space on the disk  

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  

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 

 

eCloud VPC Restore


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

File or MySQL Level Backups 

If the VM has File Level or MySQL backups, then specific files can be restored as per the DB and File Level pages.  

https://kb.ukfast.net/ECloud_VPC#Commvault_Restores

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

Commvault VM LevelBackup 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