Re: Restore backup of database to new database name

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Fri, Jun 26, 2015 at 10:31 AM, sam turnbull <samturnbull73@xxxxxxxxx> wrote:
backup database - Test
User(owner) - A

Restore to  new database - Test1
under new user - B

You can either create your dump file with --no-owner (or -O), or use a binary format and use --no-owner | -O on pg_restore. Then, when you restore you must do it connecting as user B.

Example with pg_restore:

- Dump:

    $ pg_dump -Fc -d Test -f /path/to/test.dump

- Restore:

    $ createuser B
    $ createdb --template=template0 --owner=B Test1
    $ pg_restore --no-owner -U B -d Test1 /path/to/test.dump

And you are done. You might also want to include --no-privileges, but that depends.

Regards,
--
Matheus de Oliveira



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux