Re: Copy & Re-copy of DB

From: Benedict Holland <benedict(dot)m(dot)holland(at)gmail(dot)com>
To: sivapostgres(at)yahoo(dot)com
Cc: pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>, "Ray O'Donnell" <ray(at)rodonnell(dot)ie>
Subject: Re: Copy & Re-copy of DB
Date: 2021-01-21 13:57:26
Message-ID: CAD+mzoxQThkn80hf-PAaf+Aajd4p+qbHbFLxQ2-CnQrOGHG_sg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Pg_dump and pg_restore are what you want. They create sql files that you
pass around.

But seriously, if you have two servers running, replicate one or have your
application point to a server address that you can direct via dns to
whatever active one you want. Postgres makes replication simple. There are
a lot of solutions for your problem but the 1:1 solution to copy over a
single file and load it is pg_dump and pg_restore.

Thanks,
Ben

On Thu, Jan 21, 2021, 8:53 AM sivapostgres(at)yahoo(dot)com <sivapostgres(at)yahoo(dot)com>
wrote:

> create database is to create a new database. If we switch to new
> database, we need to change the new databasename in the program(s) that
> access this database.
>
> Is there any way to overwrite the data ?
>
>
> On Thursday, 21 January, 2021, 07:12:19 pm IST, Ray O'Donnell <
> ray(at)rodonnell(dot)ie> wrote:
>
>
> On 21/01/2021 13:13, sivapostgres(at)yahoo(dot)com wrote:
>
> > Hello,
> >
> > I'm from SQL Server now developing my current project using PG.
> >
> > In our earlier project(s), we used to copy the database from one server
> > to another, work in another server, and re-copy it in the original
> > server. All happened easily with just transferring the two files (mdf
> > & ldf) to our required server.
> >
> > Want to replicate the same in PG. Is there any way to accomplish the
> > same in PG ?
>
>
> create database <new-db-name> template <old-db-name>
>
> Would that do the job? You could also use pg_dump.
>
> Ray.
>
>
> --
> Raymond O'Donnell // Galway // Ireland
> ray(at)rodonnell(dot)ie
>
>
>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Márcio Antônio Sepp 2021-01-21 17:52:37 Error while running restore
Previous Message sivapostgres@yahoo.com 2021-01-21 13:52:35 Re: Copy & Re-copy of DB