scribase
How-to

Export a Supabase database with pg_dump

The short version: use the Supabase CLI, which runs pg_dump with the right exclusions, against the direct connection or the session pooler on port 5432. Never the transaction pooler on 6543.

Last checked October 8, 2026.

Pick the right connection string

Supabase recommends the direct connection for pg_dump, backup, restore and replication. The shared pooler is IPv4-only, which is why the session pooler on 5432 is the usual choice from a laptop or CI runner without IPv6.

From the Connect dialog in the Supabase dashboard
ConnectionHost and portUserUse it for pg_dump?
Directdb.<ref>.supabase.co:5432postgresYes, if your network has IPv6 (or you have the IPv4 add-on)
Session pooleraws-0-<region>.pooler.supabase.com:5432postgres.<ref>Yes, works on IPv4 networks
Transaction pooleraws-0-<region>.pooler.supabase.com:6543postgres.<ref>No, it does not keep session state

Sources: Supabase: Connect to your database, Supabase: Backup and restore using the CLI

Recommended: supabase db dump (three files)

The CLI runs pg_dump in a container with the matching version and skips the schemas Supabase manages, so the files restore cleanly into another Supabase-compatible project.

Supabase's documented backup commandssh
export DB_URL="postgresql://postgres.<ref>:<password>@aws-0-<region>.pooler.supabase.com:5432/postgres"

supabase db dump --db-url "$DB_URL" -f roles.sql --role-only
supabase db dump --db-url "$DB_URL" -f schema.sql
supabase db dump --db-url "$DB_URL" -f data.sql --use-copy --data-only \
  -x "storage.buckets_vectors" -x "storage.vector_indexes"
Restore. session_replication_role = replica disables triggers during the load so columns are not encrypted twice.sh
psql --single-transaction --variable ON_ERROR_STOP=1 \
  --file roles.sql --file schema.sql \
  --command 'SET session_replication_role = replica' \
  --file data.sql --dbname "$TARGET_DB_URL"

Sources: Supabase: Backup and restore using the CLI

Plain pg_dump (when you do not want the CLI)

A single custom-format archive is handy for a local copy or a non-Supabase Postgres. Your pg_dump major version must be at least the server's; check the server with select version(); and the client with pg_dump --version.

  • "server version mismatch": install a newer client (for example brew install postgresql@17) and call that pg_dump explicitly.
  • "prepared statement ... already exists" or a hang: you are on port 6543. Switch to 5432.
  • "Tenant or user not found": on the pooler the user must be postgres.<ref>, not postgres.
  • "Network is unreachable" on db.<ref>.supabase.co: that host is IPv6. Use the session pooler string instead.
  • Storage files are not in the dump. Database backups only hold their metadata; copy buckets separately.
sh
pg_dump "$DB_URL" -Fc -v --no-owner --no-privileges \
  --schema=public -f supabase-public.dump

# restore into any Postgres
pg_restore -v --no-owner --no-privileges -d "$TARGET_DB_URL" supabase-public.dump

Sources: Supabase: Connect to your database, Supabase: Database backups

If the project is paused

A paused project refuses connections, so pg_dump cannot reach it. Resume it in the dashboard, or download the backup file from the paused project page.

Sources: Supabase: Project pausing

Moving the dump to Scribase

Scribase imports a Supabase project straight from the same connection string: schema, grants, auth users with their password hashes, data, RLS policies and Storage objects, ending with row counts and checksums per table. Your supabase-js code keeps working with a new URL and key.

Each project is $25 a month, flat, and has an export button that produces the schema, data, auth users and storage in one bundle. Direct psql connections into Scribase are not open yet, so the importer is the way in today.

sh
scribase import supabase --project-ref <ref> \
  --org acme --project app --env production \
  --connection-string "$DB_URL" --dry-run

Sources: Scribase pricing

FAQ

Questions people ask

Why does pg_dump fail on port 6543?

Port 6543 is the transaction pooler. It hands each transaction to any server connection, so the session settings and snapshot pg_dump relies on are not kept. Use port 5432 (session pooler or direct).

Does a Supabase pg_dump include auth users?

The auth schema is part of the database, so a full dump includes auth.users with password hashes. supabase db dump skips Supabase-managed schemas by default; the importer on Scribase copies auth users explicitly.

Does Supabase back up my Free project for me?

Daily downloadable backups start on Pro (7 days). Supabase recommends Free users export regularly with supabase db dump and keep the files off-site.

How do I export Supabase Storage files?

Storage objects are not in database dumps. Use supabase storage cp per bucket, or the Scribase importer with the service_role key, which copies buckets and objects.