Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Cover image for PostgreSQL Backups Simplified with pg_dump
DbVisualizer
DbVisualizer

Posted on

     

PostgreSQL Backups Simplified with pg_dump

pg_dump is an essential tool for creating PostgreSQL backups. This guide highlights key features and examples to streamline your backup process.

SQL Script Backup

pg_dump -U admin -d company -f company_backup.sql
Enter fullscreen modeExit fullscreen mode

Restore using:

psql -d new_company -f company_backup.sql
Enter fullscreen modeExit fullscreen mode

Directory-Format Archive

pg_dump -U admin -d company -F d -f company_backup
Enter fullscreen modeExit fullscreen mode

Produces a directory with.dat.gz files.

Export Data Only

pg_dump -U admin -d company -f company_backup.sql --data-only
Enter fullscreen modeExit fullscreen mode

Export Specific Schemas

pg_dump -U admin -d company -n 'p*' -f company_backup.sql
Enter fullscreen modeExit fullscreen mode

FAQ

Where does pg_dump output?
Outputs to stdout; redirect with>.

Path to pg_dump.exe?
Found inC:\Program Files\PostgreSQL\<version>\bin\pg_dump.exe.

Can pg_dump be run remotely?
Yes, using-h,-U, and-d options with remote access enabled.

pg_dump vs. pg_dumpall?
pg_dump backs up single databases;pg_dumpall backs up all databases on the server.

Conclusion

pg_dump simplifies PostgreSQL backups. For more detailed guidance, read the articleA Complete Guide to pg_dump With Examples, Tips, and Tricks.

Top comments(0)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

DbVisualizer is used for development, analytics, maintenance, and more, by database professionals all over the world. It connects to all popular databases and runs on Win, macOS & Linux.
  • Location
    Nacka, Sweden
  • Joined

More fromDbVisualizer

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp