Обсуждение: Possible to dump/load a database from within psql?

Поиск
Список
Период
Сортировка

Possible to dump/load a database from within psql?

От
Brian Cardarella
Дата:
Is it possible, and if so how, to dump and then load a database to/from a file from within a psql connection?

----------------------
Brian Cardarella
CEO of DockYard
Visit us: http://dockyard.com
Call us: (855) DOCK-YRD
Follow me on Twitter: http://twitter.com/bcardarella
Follow us on Twitter: http://twitter.com/DockYard

Re: Possible to dump/load a database from within psql?

От
Raymond O'Donnell
Дата:
On 25/01/2016 10:16, Brian Cardarella wrote:
> Is it possible, and if so how, to dump and then load a database to/from
> a file from within a psql connection?

You can use the COPY command to do a table at a time, but you'll get
just the data - you won't get permissions etc.

Ray.

--
Raymond O'Donnell :: Galway :: Ireland
rod@iol.ie


Re: Possible to dump/load a database from within psql?

От
"Joshua D. Drake"
Дата:
On 01/25/2016 02:16 AM, Brian Cardarella wrote:
> Is it possible, and if so how, to dump and then load a database to/from
> a file from within a psql connection?

pg_dump -h $host -U $user $database|psql -U $user -h $host $database

http://www.postgresql.org/docs/9.5/static/app-pgdump.html

Sincerely,

JD


--
Command Prompt, Inc.                  http://the.postgres.company/
                      +1-503-667-4564
PostgreSQL Centered full stack support, consulting and development.