How to restore a Supabase backup — and roll back bad changes

This page is organized by what went wrong. If a migration just corrupted data and the project has PITR, use PITR. If the whole database needs to go back to last night, use the dashboard restore on Pro, or restore your own dump into a fresh project. If one table needs yesterday’s rows and everything else is fine, restore just that table: it keeps the rest of today’s data, and it is easy to overlook. Two things to know before you press any button: an in-place restore erases everything written after the restore point, and no database restore, Supabase’s or yours, brings back Storage files.

First, always: dump what you have now

Before any restore, take a fresh dump of the current state. A damaged database can usually still be dumped, and it is the only copy of the application data written since your backup. (A --schema=public dump: your tables are in it; Auth users and Storage metadata added since are not.) The restore you are about to run overwrites all of it. Thirty seconds of pg_dump (working command here) lets you recover individual rows from the “bad” state later, and after an incident someone usually asks for exactly that.

Path 1 — dashboard restore (Pro and above)

Dashboard → Database → Backups, pick a day, restore. It runs in place: the project is inaccessible while the restore runs, downtime scales with database size, and you should drop active subscriptions and replication slots first (Realtime’s own slot is handled automatically). Backups are daily, so if a bad deploy at 5 pm sends you back to last night, you lose the day’s writes across every table. That is why the single-table path below exists.

There is also an official option that is easy to miss: on paid plans with physical backups, Supabase can restore a backup, or a PITR point, into a new project instead of in place. Schema, data, roles, and Auth users come across. Storage objects, Edge Functions, and auth configuration do not, so you move those by hand. This is the safer choice when you want to keep the damaged project as evidence, but you then have to point your application at the new project. On the Free plan this dashboard page doesn’t help either way: there are no backups to restore.

Path 2 — PITR, if you bought it

The $100/month-per-project add-on recovers to any second in its retention window: roll back to 14:03:27, right before the migration ran. If you broke something minutes ago and every write since matters, this is the option to use. It covers the database only, it replaces the daily backups rather than adding to them, and, like the daily backups, it restores in place or into a new project on physical-backup projects. For how it works and what it costs, see the PITR explainer. For where it fits and where it doesn’t, see the PITR comparison.

Path 3 — your own dump, into a fresh project

If you have your own backups (from pg_dump, a scheduled workflow, or a backup service), the recovery target is a fresh, empty Supabase project, never the damaged one. (No dump yet? The export guide covers producing one, including the roles and data the CLI leaves out by default, and the manual backup guide is the fastest route to a first file.) Restoring over a half-broken database leaves you with objects from both versions and no way to tell which is which. With a fresh project, the damaged one stays untouched, as evidence and as a fallback. If your schema uses extensions beyond Supabase’s defaults (pgvector, PostGIS), enable them on the target first (Database → Extensions): tables built on those types cannot restore without them. Then:

read -rs PGPASSWORD && export PGPASSWORD   # hidden prompt — nothing in shell history
pg_restore --no-owner --no-privileges \
  --dbname "postgresql://postgres.<target-ref>@<pooler-host>:5432/postgres" \
  backup-2026-08-08.dump
unset PGPASSWORD

A few things to know about this command:

  • --no-owner --no-privileges: the dump records owners and grants for roles that differ between projects. Without these flags the restore fills up with ownership errors.
  • Never --clean against Supabase. Dropping and recreating public silently wipes the default grants for anon and authenticated. The restore looks successful, and then the API answers 401 on everything.
  • --no-privileges leaves out the grants for anon, authenticated and service_role too. Since October 30, 2026 Supabase no longer grants new tables in public to them, so grant what your app needs after the restore. Until you do, its requests get permission denied. Finding and fixing the missing grants has the SQL.
  • One error is expected and harmless: schema "public" already exists. Errors naming your own tables, indexes, or constraints are real findings.

What it doesn’t cover: a --schema=public dump restores your application schema and data. Auth users, secret values, and Edge Functions are not in it. Users have to be re-invited or migrated separately, secrets re-entered, and functions redeployed. Budget for that in your recovery time. If your backups are BackupDrill snapshots, the restore & recovery docs cover the console wizard (a read-only preflight before anything executes) and the CLI path, which also puts Storage files back into the target project and reconciles them key by key. A snapshot with an auth.dump also holds the Auth users, and both paths restore them with the database in one transaction.

Stuck on an error this section does not cover, such as unsupported version in file header or a missing role? The pg_restore guide lists the common ones with their fixes.

Path 4 — a .backup file you downloaded from the dashboard

Two situations hand you a file with a .backup extension rather than one you made: a project still on the older logical backup process, where each backup has a download option, and a Free project past its resume window, where Project Overview offers the last backup plus the Storage objects. It is a plain Postgres dump with a Supabase-specific name. What matters is which format it is in, because that decides the tool, and guessing wrong is the usual reason a restore “does nothing”.

# The download may or may not be gzipped, so look before assuming.
ls -l db_cluster-2026-08-23.backup*

BACKUP_FILE="db_cluster-2026-08-23.backup"
# -k keeps the compressed original, in case the first attempt goes wrong
[ -f "$BACKUP_FILE.gz" ] && gunzip -k "$BACKUP_FILE.gz"

# Then the format question: readable SQL -> psql.  PGDMP -> pg_restore.
file "$BACKUP_FILE"
head -c 8 "$BACKUP_FILE"

If the first bytes are readable SQL, replay it with psql; if it starts with PGDMP, it is a custom-format archive and needs pg_restore with the flags in Path 3. Use a PostgreSQL 17 client either way. An older psql can fail against the Session pooler with a GSSAPI error that looks like a credentials problem but isn’t.

BACKUP_FILE="db_cluster-2026-08-23.backup"

printf 'Target session pooler string: '
read -rs DB_URL
echo

# Redirect rather than pipe: piping through tee would replace psql's
# exit status with tee's, and tee almost always succeeds.
psql --dbname "$DB_URL" --file "$BACKUP_FILE" > restore.log 2>&1
echo "psql exit: $?"
tail -20 restore.log

Expect errors, and expect most of them to be noise. A dashboard backup is a full dump that recreates auth and storage, which a new project already has, and Supabase documents those duplicate-object messages as expected. That is why this command runs without ON_ERROR_STOP, which would abort on the first harmless conflict. A non-zero exit status means something other than those conflicts went wrong: a connection failure or a missing file exits non-zero without printing a single SQL error. The downside is that a real SQL failure looks just like the harmless ones, so also search restore.log for errors naming your own tables, policies or triggers, and count auth.users. Your accounts come in through the same schema whose errors you were told to ignore.

How to restore Supabase Storage files

Supabase’s own restores don’t cover this part. Daily backups, PITR and restoring into a new project all work on the database, and the database only holds metadata about Storage objects. Supabase’s backup docs say it plainly: restoring an old backup does not restore objects you deleted after that backup. A deleted file, or a deleted project, comes back only from a copy of the files you made yourself.

That copy is usually one of three things: the Storage objects a Free project offers for download once it is past its resume window, a sync of your buckets you ran with rclone or a script, or a BackupDrill snapshot, which has a storage/ folder once you have added the project’s Storage S3 keys. Before copying anything into the target project, get three things in place:

  • Buckets with the same names, the same public or private setting, and the same file size and MIME type limits.
  • Storage policies. Access rules for files are RLS policies on storage.objects. A dashboard backup carries them; a dump of the public schema alone does not, so recreate them from your migrations or the old project’s SQL.
  • The same paths. Your tables store each file’s bucket and key, and a file uploaded under a different key is a 404.

A folder of files goes back with the Supabase CLI, but ss:/// resolves to whichever project is currently linked, so link first and check that it worked, or the files end up in a project you did not intend:

supabase login
supabase link --project-ref "abcdefghijklmnop"

# confirm the link points where you think before copying anything
supabase projects list

supabase storage cp ./storage-download "ss:///avatars" -r --experimental

Verified against Supabase CLI 2.109; storage cp is still behind --experimental and its flags have moved before, so check supabase storage cp --help if it argues.

For big buckets, rclone against the target’s Storage S3 endpoint holds up better. One trap: if you restored a full database dump first, the target already has storage.objects rows, the S3 endpoint answers listings from them, and rclone can skip a file that has a row but no bytes behind it. The Storage backup guide has the exact commands and the flag that avoids it.

With a BackupDrill snapshot, backupdrill restore puts the database and the files into a fresh project in one run (command in the restore docs). It rebuilds each bucket with its recorded settings, uploads every file through the target’s Storage API, checks that each one arrived at the right size, and checksums a sample. If the uploads stop after the database is in, run the same command again without --database to retry Storage alone: with it, the run refuses because the target is no longer empty. Files already in the target are compared byte for byte with the snapshot and skipped when they match. Storage policies are still yours to recreate. The console wizard restores the database only and gives you this command for the files.

Check ownership before you switch traffic. Files uploaded with a service key or S3 keys, which is how all three routes above upload, come back with no owner. If your policies compare owner_id with the signed-in user, the usual “users read their own files” rule, your users are locked out of their own files until you set owner_id back from the storage.objects rows in a full database dump, or change those policies to check the file path instead. Sign in as an ordinary user and open a few files to confirm.

One last thing the files and rows do not cover: the new project has its own URL, API keys and JWT secret, so update your environment, re-enter the Auth configuration, and expect existing sessions to be signed out. Any public or signed file URLs your app saved still point at the old project.

Rolling back one table, not the whole database

Often “I need to restore” really means “one table needs to go back”. Restoring the entire database to yesterday to fix orders costs you today’s data in every other table. Custom-format dumps can restore selectively. Bring yesterday’s table up in a scratch Postgres next to production:

SCRATCH_PW="$(openssl rand -hex 16)"

POSTGRES_PASSWORD="$SCRATCH_PW" docker run -d --rm --name rollback-scratch \
  -e POSTGRES_PASSWORD \
  -p 127.0.0.1:55433:5432 \
  postgres:17-alpine

# Wait until it accepts TCP connections
until docker exec rollback-scratch pg_isready -h 127.0.0.1 -U postgres; do sleep 1; done

PGPASSWORD="$SCRATCH_PW" pg_restore --no-owner --no-privileges \
  --table=orders \
  --dbname "postgresql://postgres@127.0.0.1:55433/postgres" \
  backup-2026-08-08.dump

The scratch container holds production rows, and any account on the machine can connect to 127.0.0.1, so it gets a new random password. Keep PGPASSWORD="$SCRATCH_PW" in front of every command that connects to it, rather than in the URL, where the process list would show it.

Now you have yesterday’s orders and production’s, side by side, and the fix becomes a data question instead of a restore question: diff them, decide exactly which rows move, and apply that change to production in a transaction you can inspect first. For a “these rows were deleted, put them back” case that can be as small as a \copy out of the scratch table and a \copy into production. It is slower than the restore button, but it only touches the rows you chose. One caveat: --table restores the table alone, not the types it depends on. If the restore errors on a missing enum or extension type, restore the whole archive into the scratch container instead. The container is throwaway, so a full restore there only costs time. When you are done: docker rm -f rollback-scratch.

What if you have no backup at all?

Without a backup, deleted rows are almost always gone. A committed DELETE in Postgres leaves dead tuples that VACUUM is free to reclaim at any moment, and there is no supported way to read them back through the SQL editor. Recovering rows from raw heap pages is forensic work with no reliable procedure, and the odds get worse with every write the database accepts afterwards.

So before anything else, if the rows matter: stop writing to that table. Take the application offline if you can. Then check, in this order:

  • Do you have PITR after all? If so, it can restore to the second before the delete. Check Project Settings → Add-ons before assuming you do not have it; on a team, somebody may have enabled it. What PITR covers.
  • Is the project on Pro with daily backups? Pick the newest retained backup taken before the delete, which is not always last night’s: if the rows were deleted days ago, the recent backups don’t have them either. Getting at them without overwriting today’s good writes depends on which backup process the project is on. With a downloadable logical backup, or a dump you took yourself, use the scratch-container method above (a downloaded dashboard backup replays with psql the same way). On physical backups, which recent projects use, nothing is downloadable, so use Restore to a New Project from the backups page and copy the rows out of the clone.
  • Does the data exist anywhere else? A local dump from development, a CSV export someone took, Stripe or your analytics warehouse holding the same records, application logs with the payloads. Rebuilding from a second system is tedious, and often the only thing that works.
  • Was the project paused rather than damaged? That is a different problem with much better odds. See the paused-project guide.

If none of those apply, the data is lost. What you can still do is make sure it doesn’t happen again: a scheduled dump costs nothing on any plan, and it takes about fifteen minutes to set up.

Test the restore before you need it

Everything above assumes the backup restores, and that can fail without anyone noticing. A dump taken with the wrong role, a pg_dump with a mismatched version, or a job that half-failed months ago all look like good backups in a bucket until the day you need them. Testing a restore is cheap and mechanical: fifteen minutes by hand in Docker, or automated on a schedule. Automating it is what BackupDrill does, and here is a real drill report showing exactly what gets verified. The manual test needs nothing from us, and doing it once before an incident is better than reading this page during one.

FAQ

How do I roll back my Supabase database?

It depends on how precise the rollback has to be. PITR (the $100/month add-on) restores to any second in its retention window. The Pro plan's daily backups restore in place from the dashboard to last night's state, erasing everything written since. Your own dumps restore into a fresh project with pg_restore, and then you point the app at it. Whichever you use, take a fresh dump of the current state first. Even a damaged database can usually still be dumped, and it holds everything you are about to overwrite.

Can I restore a Supabase backup to a different project?

Yes, in two ways. On paid plans with physical backups, Supabase's Restore to a New Project feature clones a backup or PITR point into a fresh project, including schema, data, roles, and Auth users. Storage objects, Edge Functions, and auth configuration still have to be moved by hand. On every plan, your own pg_dump archives restore into any fresh, empty project with pg_restore. Neither way restores into an existing project that already has data in it.

How do I restore a Supabase .backup file?

Check the format first, because it decides the tool. If the file starts with readable SQL, replay it with psql --dbname "$DB_URL" --file the-file.backup; if it starts with PGDMP it is a custom-format archive and needs pg_restore --no-owner --no-privileges instead. It may also arrive gzipped, so run file on it and gunzip if needed. Use a PostgreSQL 17 client: an older psql can fail against the Session pooler with a GSSAPI error that looks like bad credentials. Errors about auth and storage objects already existing are expected when restoring into a new project; errors naming your own tables are not.

Why does my restored project answer 401 on every API request?

Missing grants. A dump taken or restored with --no-privileges carries no grants, and since October 30, 2026 Supabase no longer grants new tables in public to anon and authenticated by default, so API requests to the restored tables in public get permission denied. Grant your app's roles what they had on the source. BackupDrill snapshots from CLI 2.9.1 or later (hosted backups from November 2026 on) have the SQL in RECOVERY.md. The other common cause is --clean: dropping and recreating the public schema also wipes the schema grants Supabase gives anon and authenticated. Restore into a fresh project without --clean. The expected 'schema "public" already exists' error is harmless; missing grants are not.

I accidentally deleted rows in Supabase — how do I recover them?

Stop writing to that table first. Then check whether the project has PITR, under Project Settings then Add-ons, rather than assuming it doesn't: PITR is the only option that restores to the second before the delete. Without it, a Pro plan's daily backup gets you last night's copy. On the physical backup process that copy cannot be downloaded, so to get at those rows without overwriting production, use Restore to a New Project and copy the rows across. You can restore into a local throwaway container instead if you have a dump you took yourself, or a dashboard backup you were able to download (projects still on the older logical backup process can download backups, and so can a project past its resume window, from Project Overview). Without any of those, a committed DELETE is usually gone for good: Postgres is free to reclaim the dead tuples, and every later write makes it less likely anything readable remains. The realistic fallback is rebuilding the rows from another system that holds the same data.

Does restoring a backup bring back deleted Storage files?

No. A database restore (dashboard, PITR, or pg_restore) only brings back storage.objects, which is metadata. The files themselves live in a separate object store. If they were not backed up separately, the restored database can point at files that no longer exist (all of them, if you restore into a new project): SQL queries look fine, but those download URLs return 404.

Is there a way to restore Supabase Storage buckets?

Only from a copy of the files you made yourself, because Supabase's backups and PITR keep just the metadata. In the target project, create the buckets with the same names and public or private setting, recreate the Storage policies if your dump covered only the public schema, then upload the files to the same paths: the Supabase CLI's storage cp for a local folder, rclone against the project's Storage S3 endpoint for large buckets, or backupdrill restore if the copy is a BackupDrill snapshot.

Sources

  • Supabase docs — Restoring a downloaded dashboard backup
  • Supabase troubleshooting — Restore a project paused past the window
  • Supabase CLI reference — storage cp
  • Supabase docs — Database Backups
  • Supabase docs — Manage PITR usage
  • Supabase — Pricing
  • Supabase docs — Connecting to your database
  • PostgreSQL docs — pg_restore

Facts and prices last verified August 23, 2026 against the sources above. Written by the team behind BackupDrill.

Want scheduled restore tests of your latest backup? Start free. The free plan covers backups for one project, and daily restore drills start on Solo. Or run the open-source CLI yourself.