Forrest logo
back to context overview

pg_dump

List of commands for pg_dump:

  • pg_dump:tldr:4119a pg_dump: Dump a database into a custom-format archive file.
    $ pg_dump -Fc ${db_name} > ${output_file-dump}
    try on your machine
    explain this command
  • pg_dump:tldr:4a411 pg_dump: Same as above, customize host and port.
    $ pg_dump -h ${host} -p ${port} ${db_name} > ${output_file-sql}
    try on your machine
    explain this command
  • pg_dump:tldr:cd40f pg_dump: Dump database into an SQL-script file.
    $ pg_dump ${db_name} > ${output_file-sql}
    try on your machine
    explain this command
  • pg_dump:tldr:e06f3 pg_dump: Dump only database data into an SQL-script file.
    $ pg_dump -a ${db_name} > ${path-to-output_file-sql}
    try on your machine
    explain this command
  • pg_dump:tldr:f6d1d pg_dump: Dump only schema (data definitions) into an SQL-script file.
    $ pg_dump -s ${db_name} > ${path-to-output_file-sql}
    try on your machine
    explain this command
  • pg_dump:tldr:fd1a3 pg_dump: Same as above, customize username.
    $ pg_dump -U ${username} ${db_name} > ${output_file-sql}
    try on your machine
    explain this command
back to context overview