Re: Dump all the indexes/constraints/roles

From: John R Pierce <pierce(at)hogranch(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Dump all the indexes/constraints/roles
Date: 2016-10-18 04:04:23
Message-ID: 990d5f48-a4a4-3b52-41e0-03e3d4184e0e@hogranch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 10/17/2016 8:32 PM, Patrick B wrote:
> I need to export an entire database to another server, for testing
> purpose.
>
> Is there any way to export all indexes and constraints ?
> Postgres 9.2

on the existing machine, as the postgres user....

pg_dump -Fc -d databasename -f filename.pgdump

then, on the new machine,

createdb newdatabase -o dbownername
pg_restore -d newdatabase filename.pgdump

--
john r pierce, recycling bits in santa cruz

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2016-10-18 04:06:04 Re: Dump all the indexes/constraints/roles
Previous Message Patrick B 2016-10-18 03:32:19 Dump all the indexes/constraints/roles