You need to restore a single database for a Plesk subscription — a customer ran a destructive migration and wants the production table back from last night’s backup. You open the Plesk Backup Manager, pick the target backup, select “databases only” and “single database”, click restore. Plesk reports Unable to restore backup: archive integrity check failed and refuses to continue. The archive is fine. The integrity check is wrong. This runbook covers how to extract the SQL artefacts out of a Plesk backup tarball, restore them directly through mysql or psql, and re-attach the result to the right Plesk subscription so the panel doesn’t complain.
What’s happening
Plesk backups are tarballs structured as *.xml manifests + per-asset .tar files that contain dumps generated by either mysqldump (with --single-transaction) or pg_dump (in custom format). The backup archive itself is a single tar that bundles these. When you run a “Plesk backup”, the panel calls pleskbackup which orchestrates the dumps; restoring through the panel reverses the process via pleskrestore.
The panel-level restore fails for a few specific reasons:
- Plesk version on the destination differs from where the backup was created and the migration adapter doesn’t cover that diff cleanly.
- The destination subscription has database objects with the same names that the panel won’t overwrite without
--ignore-locks. - The backup archive was created across multiple files and one is missing.
- A subscription got renamed since the backup was taken, and the manifest references the old name.
None of these prevent you from extracting the SQL files and running them through mysql or psql directly. The artefacts are intact. Plesk’s restore wrapper is what’s refusing — the database dumps inside the archive are normal SQL.
How to verify
Identify the backup file:
ls -lh /var/lib/psa/dumps/
# or for cloud-backed backups via the backup manager:
plesk bin pleskbackup --backups-list
Inspect the structure of an existing backup tarball without extracting:
tar -tzf /var/lib/psa/dumps/backup_subdomain_240509.tar | head -50
You’ll see entries like:
backup_info.xml
domain1.example.com.tar
domain1.example.com.tar.info.xml
databases/db1_example.dump
databases/db2_example.dump
Confirm the database dump is a real SQL file:
mkdir -p /tmp/plesk-bk-inspect
tar -xzf /var/lib/psa/dumps/backup_subdomain_240509.tar -C /tmp/plesk-bk-inspect
file /tmp/plesk-bk-inspect/databases/db1_example.dump
# Expected: "ASCII text" for MySQL, or "PostgreSQL custom database dump" for PG
head -20 /tmp/plesk-bk-inspect/databases/db1_example.dump
For MySQL you’ll see the familiar -- MySQL dump header. For PostgreSQL it’ll be binary (custom format) or text (if it was dumped with -Fp).
The fix
Two paths: MySQL/MariaDB and PostgreSQL.
MySQL/MariaDB recovery
# Identify the target database and confirm it exists on the destination
plesk db -Ne "SELECT name FROM data_bases WHERE name='db1_example'"
# Find the dump in the extracted backup
DUMP=/tmp/plesk-bk-inspect/databases/db1_example.dump
file "$DUMP"
head -5 "$DUMP"
# If you want to restore IN PLACE (overwriting the current state of the live database),
# take a fresh dump of the live state first as a safety net:
mysqldump --single-transaction --routines --triggers db1_example > /root/safety-net-$(date +%Y%m%d%H%M).sql
# Restore
mysql db1_example < "$DUMP"
If the destination database name differs from what’s in the dump (the dump references db1_example but you want it as db1_example_v2):
# Create the new database
mysql -e "CREATE DATABASE db1_example_v2 CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci"
# Load and rewrite — dump probably has `USE db1_example;` or backtick references
sed 's/\bdb1_example\b/db1_example_v2/g' "$DUMP" | mysql db1_example_v2
If the dump fails halfway with a foreign-key error:
# Restore with FK checks disabled (use only when you trust the dump is internally consistent)
(echo "SET FOREIGN_KEY_CHECKS=0;"; cat "$DUMP"; echo "SET FOREIGN_KEY_CHECKS=1;") | mysql db1_example
After restore, register the database back with Plesk if it was deleted from the panel earlier:
# Tell Plesk about an externally-restored database
plesk bin database --create db1_example -domain example.com -server localhost \
-type mysql -add-user dbu1 -passwd 'GeneratedSecurePassword' \
-manage-mysql-server localhost
Or, if the database still exists in Plesk’s metadata but the underlying data was corrupt, no registration is needed — Plesk only tracks the database existence, not its content.
PostgreSQL recovery
# The dump format
DUMP=/tmp/plesk-bk-inspect/databases/pgdb1.dump
file "$DUMP"
# Three possibilities:
# - "PostgreSQL custom database dump" — restore with pg_restore
# - "ASCII text" containing 'CREATE DATABASE' — restore with psql
# - "POSIX tar archive" — directory-format dump, restore with pg_restore -F d
# Custom format
sudo -u postgres pg_restore --clean --if-exists --no-owner -d pgdb1 "$DUMP"
# Plain SQL
sudo -u postgres psql pgdb1 < "$DUMP"
# Directory format (rare in Plesk backups but possible)
sudo -u postgres pg_restore --clean --if-exists --no-owner -d pgdb1 -F d /path/to/dump-dir/
Same safety-net pattern — take a snapshot of the current state first:
sudo -u postgres pg_dump -Fc pgdb1 > /root/pgdb1-safety-$(date +%Y%m%d%H%M).dump
For role and ownership reattachment — Plesk creates a database user per Plesk subscription and the dump may reference roles that don’t exist on the destination:
# List roles referenced in the dump
pg_restore -l "$DUMP" | grep -i 'owner'
# Create missing roles before restore
sudo -u postgres psql -c "CREATE ROLE missing_role LOGIN PASSWORD 'temp'"
# Or restore without owners (and reset after)
sudo -u postgres pg_restore --clean --no-owner --no-acl -d pgdb1 "$DUMP"
# Then re-grant
sudo -u postgres psql pgdb1 -c "GRANT ALL ON ALL TABLES IN SCHEMA public TO actual_owner"
Single-table restore from a full database dump
If only one table got destroyed and you don’t want to overwrite the entire database, extract just that table:
For MySQL:
# Extract the table CREATE + INSERT statements from a full dump
sed -n '/-- Table structure for table `customers`/,/-- Table structure for table `[a-z]/p' \
/tmp/plesk-bk-inspect/databases/db1_example.dump > /tmp/customers-only.sql
# Inspect the slice
head -30 /tmp/customers-only.sql
tail -30 /tmp/customers-only.sql
# Restore just that table
mysql db1_example < /tmp/customers-only.sql
For PostgreSQL custom-format dumps:
# List tables in the dump
sudo -u postgres pg_restore -l "$DUMP" | grep TABLE
# Pull one out
sudo -u postgres pg_restore -l "$DUMP" | grep 'TABLE.*customers' > /tmp/restore-list.txt
sudo -u postgres pg_restore -L /tmp/restore-list.txt --data-only -d pgdb1 "$DUMP"
Post-restore validation
After any restore, run the customer’s own consistency check if you have one. If not, run a few baseline sanity queries:
# MySQL: row counts per table
mysql -e "SELECT TABLE_NAME, TABLE_ROWS FROM information_schema.TABLES \
WHERE TABLE_SCHEMA='db1_example' ORDER BY TABLE_ROWS DESC LIMIT 20"
# PostgreSQL: same idea
sudo -u postgres psql pgdb1 -c "SELECT relname, n_live_tup FROM pg_stat_user_tables \
ORDER BY n_live_tup DESC LIMIT 20"
# Check for FK violations after a MySQL restore where you disabled FK checks
mysql -e "SHOW ENGINE INNODB STATUS\G" | grep -A2 'LATEST FOREIGN KEY ERROR'
If the application has migrations, run them — Plesk doesn’t know about app-level schema migrations and the dump represents the schema as of when the dump was taken, not necessarily the schema the app expects today.
Re-registering with Plesk Backup Manager
If you want the restored state to appear in Plesk’s backup history, take a fresh Plesk backup right after the restore so the timeline is consistent:
plesk bin pleskbackup --domains-name=example.com --backup-only-database \
--output-file=/var/lib/psa/dumps/post-restore-$(date +%Y%m%d).tar
Stack Harbor designs backup strategies that don’t depend solely on the control-panel UI — pg_dump artefacts, WAL archiving, and snapshot rotation are layered under environment management, with restore drills tested quarterly. For a Plesk fleet whose backup story currently is “press the button and hope”, contact our team to scope a tested backup tier.