Best Practical’s RT – recovering specific tickets from backups

I needed to recover a particular, old and already shredded, RT ticket from a backup to web interface.

I’ve restored the database to a separate server and run those commands to get INSERT statements for two tickets i was interested in – 69187, 100112:

mysqldump rt2019 -w "Id in (69187,100112)" --no-create-info --skip-extended-insert --hex-blob Tickets |grep INSERT > recovery.sql
mysqldump rt2019 -w "ObjectId in (69187,100112) AND ObjectType='RT::Ticket'" --no-create-info --skip-extended-insert --hex-blob Transactions |grep INSERT  >> recovery.sql
mysqldump rt2019 -w "TransactionId in (SELECT id FROM Transactions WHERE ObjectId IN (69187,100112) AND ObjectType='RT::Ticket')" --no-create-info --skip-extended-insert --skip-lock-tables --hex-blob Attachments |grep INSERT  >> recovery.sql
mysqldump rt2019 -w "ObjectId IN (69187,100112) AND ObjectType='RT::Ticket'" --no-create-info --skip-extended-insert --skip-lock-tables --hex-blob ObjectCustomFieldValues |grep INSERT >> recovery.sql

To be on the safe side – always recover to a test instance of RT and not a live environment!

Leave a Reply

Your email address will not be published. Required fields are marked *

(Spamcheck Enabled)