Article ID: 115268, created on Dec 7, 2012, last review on Jun 17, 2016

  • Applies to:
  • Virtuozzo 6.0
  • Virtuozzo containers for Linux 4.7
  • Virtual Automation 6.0


Virtual Automation uses MySQL database (on Linux) to store task logs, events, and alerts. In some cases, it is necessary to either migrate the data to another machine, or back up and restore the database on the local machine.

This article provides instructions on how to back up and restore a PVA Management Node database.

NOTE: in case of migration the version of a new PVA MN should be the same as the version of the existing installation.


Backup (on source node)

  1. Stop PVA services:

    ~# pvamn stop
  2. Dump tables data only:

    ~# mysqldump --skip-opt VZAgentDB | grep ^INSERT > inserts.sql
  3. Get the list of tables and views:

    ~# echo 'show tables' | mysql VZAgentDB | tail -n +2 > tables.txt
  4. Dump create statements:

    ~# for TABLE in `cat tables.txt` ; do echo "SHOW CREATE TABLE $TABLE" | mysql VZAgentDB | tail -n +2 | sed -e 's/^\w\+\s\+//i; s/\\n/ /g; s/$/;/;'; done > creates.sql
  5. Download attached script for sorting these statements:

    ~# wget
  6. Sort create statements:

    ~# perl creates.sql > sorted_creates.sql
  7. for migration only Pack data into archive:

    ~# tar -cvzf backup_pvamn.tgz sorted_creates.sql inserts.sql
  8. for migration only Copy data to destination server

Restore (on destination node)

  1. Stop MySQL service:

    ~# service mysql stop
  2. Back up all MySQL data:

    ~# tar -cvzf backup_mysql.tgz /var/lib/mysql
  3. Start MySQL service:

    ~# service mysql start
  4. for migration only Unpack data from archive:

    ~# tar -xvzf backup_pvamn.tgz
  5. Stop PVA services:

    ~# pvamn stop
  6. Drop VZAgentDB database:

    ~# mysql -NBe "DROP DATABASE VZAgentDB"
  7. Recreate it:

  8. Restore database structure:

    ~# mysql VZAgentDB < sorted_creates.sql
  9. Restore database contents (it may take a while):

    ~# (echo "SET FOREIGN_KEY_CHECKS=0;" ; cat inserts.sql ) | mysql VZAgentDB
  10. Copy the whole /var/opt/pva/mn/etc/ directory from the old PVA Management Node installation to the new server in order to save previous settings.

  11. Start PVA services:

    ~# pvamn start

Video Instructions

Search Words

pva mn

pva restore


pva management node

migrate pva mn


pva management node database

how to transfer pva database

migrate pva database


2897d76d56d2010f4e3a28f864d69223 319940068c5fa20655215d590b7be29b 0889ab60fa6494de107aa7338c3c38b6 e8e50b42231236b82df27684e7ec0beb d02f9caf3e11b191a38179103495106f 0c05f0c76fec3dd785e9feafce1099a9 0dd5b9380c7d4884d77587f3eb0fa8ef c62e8726973f80975db0531f1ed5c6a2

Email subscription for changes to this article
Save as PDF