Move database from one server to another
bastiaan at basenlily.me
Mon Jul 17 21:36:45 EDT 2017
Two ways about this that I know off.
First option, you can simply include the pg_dump and pg_restore with
your Omnis application and use them as they are. They're command line
tools so. Its basically what PGAdmin does.
Second option, pg_dump isn't really that special, it just selects all
the data in your database and turns them into queries. It just has some
nice options for encrypting/compressing the data. pg_restore in turn is
nothing special either, it just executes whats in the file. There is
nothing in there you couldn't just implement in Omnis. The secret sauce
lies in these functions:
You basically call pg_start_backup which will issue a checkpoint and
ensures that all reads you do from then on relate to that point in time,
ignoring any changes users make while your backup is running. You can
then select and write out all the data you want to backup. Finally when
you are done you call pg_stop_backup
A restore is generally executed on an empty database so its simply a
matter of loading your files and inserting the data.
On 17/7/17 10:46 pm, ADJob wrote:
> Sometimes you have to move a database from one old postgresql server to new postgresql server. I have done this before with PGAdmin using pg_dump and pg_restore.
> My goal is however to do the move from within Omnis. Add new IP and click a button, sort of.
> 1. Can I do pg_dump / pg_restore from within Omnis?
> 2. Any tip how to do this in an other smart way?
> I have done something similar moving a native datafile into a Postgresql server, so I know it is possible. I have a solution, but I am searching for a smarter way.
> Any advice or input appreciated.
> Manage your list subscriptions at http://lists.omnis-dev.com
e-mail: bastiaan at basenlily.me
More information about the omnisdev-en