Skip to main content

Commvault Restores

Commvault DB Restores


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

Commvault MySQL Level Backup Restore 

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

No DB level backups?

If the client doesn't have MySQL level backups, you can still restore a database, you'll just have to use the same method used for Bacula DB restores.

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

Starting a DB restore in Commvault

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  

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

What to do once the restore has completed

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

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