Skip to content

Restoring only a database from a JetBackup snapshot

How to restore one database from a JetBackup snapshot — to a temp database first, then merge into the live DB — without overwriting the rest of the account.

A WordPress plugin trashed the wp_options table. The site is broken; the home directory is fine; the rest of the database is fine. A full restore would overwrite the customer’s product edits from this morning. The right operation is a database restore, not an account restore — and even then, a careful one that compares the snapshot to the current state before overwriting.

What’s happening

JetBackup stores database dumps in the snapshot’s databases/ section as separate .sql files. The restore UI offers two modes: overwrite the live database in place, or restore to a different name (typically <original>_restored). The second mode is almost always the right choice — it lets you compare and merge selectively rather than overwriting.

How to verify

Confirm the snapshot has the database and verify what’s there:

jetbackup5api -F getRestorePoints -D '{"account":"<user>"}'
jetbackup5api -F snapshotContents -D '{"snapshot_id":"<id>","section":"databases"}'
mysql -e "SHOW DATABASES" | grep <user>
mysql <db> -e "SHOW TABLES"

The database list should include the target database. If you only see <user>_main but not <user>_wp, the snapshot wasn’t capturing that DB.

The fix

  1. Restore to a parallel database name. WHM > JetBackup 5 > Restore > Databases. Pick the snapshot, target database <user>_wp, restore as <user>_wp_restored (rename in the restore options).
  2. Verify the restore: mysql <user>_wp_restored -e "SELECT COUNT(*) FROM wp_options". Row counts and a sample of the data confirm the restore is consistent.
  3. Compare live and restored. For the broken wp_options table: mysql -e "SELECT option_id, option_name FROM <user>_wp_restored.wp_options WHERE option_name IN ('siteurl','home','active_plugins')". Confirm the snapshot has good values.
  4. Merge selectively. The two paths: (a) copy the entire fixed table over (DROP TABLE <user>_wp.wp_options; CREATE TABLE <user>_wp.wp_options AS SELECT * FROM <user>_wp_restored.wp_options), or (b) UPDATE individual rows. Path (a) is faster but loses concurrent changes; path (b) preserves concurrent changes but is more careful.
  5. Drop the temp database when done: DROP DATABASE <user>_wp_restored. Keep the table out of the active set so it doesn’t show up in future cPanel database listings.

Stack Harbor handles database-level restores under environment management when granularity matters.