Tuesday, April 18, 2017

Backup & Restore MySQL Stored Procedures and Triggers

There are two ways to backup MySQL routine procedures and triggers. Either it could be with data and tables or  without data and tables.

Backup:

DB Host: 172.16.16.29
DB Name: reportdb
DB Username: root
DB User Pass: abc123

Backup stored procedures with data and tables:
==================================
# mysqldump -h 172.16.16.29  -u root -p --routines reportdb > reportdb_proc_with_data_table.sql
When prompted, enter root password

Backup only Stored Procedures and Triggers:
=================================
# mysqldump -h 172.16.16.29 -u root -p  --routines --no-create-info --no-data --no-create-db --skip-opt reportdb > reportdb_routine_proc.sql
When prompted, enter root password

Restore:
mysql -u root -p reportdb  < reportdb_proc_with_data_table.sql
When prompted, enter root password
or

mysql -u root -p reportdb  < reportdb_routine_proc.sql
When prompted, enter root password

Restore Archived Log into VMware Aria Operations for Logs (formerly known as vRealize Log Insight - vRLI)

As we cannot keep all logs in searchable space in vRLI production system due to performance and slowness issue, it is always recommended to ...