gnumed-devel
[Top][All Lists]
Advanced

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

Re: [Gnumed-devel] BACKUP / RESTORE


From: Karsten Hilbert
Subject: Re: [Gnumed-devel] BACKUP / RESTORE
Date: Tue, 28 Oct 2008 13:09:07 +0100
User-agent: Mutt/1.5.18 (2008-05-17)

On Mon, Oct 27, 2008 at 11:02:52PM -0200, Rogerio Luz wrote:

> No good ... it doesn´t fail anywhere
It does.

> casa-deb:/home/rogerio/Desktop# sh gm-restore_database.sh
> /home/rogerio/Desktop/backup-gnumed_v9-GNUmed_Team-casa-deb-2008-10-15-21-19-03-data_only.tar

You are trying to restore a data-only backup. For that you
need, of course, an existing, properly bootstrapped, empty
database. Which is what the script complains about. It first
checks whether the backup creates the database:

> head: não foi possível abrir
> `backup-gnumed_v9-GNUmed_Team-casa-deb-2008-10-15-21-19-03-data_only-database.sql'
> para leitura: Arquivo ou diretório não encontrado

This fails because the data-only backup does not contain the
file to create the database so it aborts the restore:

> ==> Checking for existence of target database  ...
>     ERROR: Backup does not create target database. Aborting.

To restore a data-only backup you need an existing database
with the proper schema. This can be created with the
bootstrapper. That new database must then be emptied of test
data created by the bootstrapper. To help with this we have
the server/bootstrap/gmDBPruningDMLGenerator.py script which
is used like this:

"""GNUmed database pruning DML generator.

This script generates DML for pruning database tables
before restoring backups.

Theory of operation:

The script reads a plaintext format database backup of the
--data-only variety as generated by pg_dump and creates the
approprated DML commands to prune the tables which are
inserted into by the backup.

It is useful to pre-process the dump with:

        cut -f -5 -d " " data-only-dump.sql | grep -E "^(SET)|(INSERT)"

to weed out superfluous cruft.
"""

After pruning the database you will have to run the
data-only dump through psql to restore it.

> What are these "roles"
They are the database accounts in use with PostgreSQL such
as gm-dbo and any-doc.

> and what should I type in the editor it opens???
You need to delete or comment out those PostgreSQL roles
which do not have anything to do with GNUmed. This is due to
a limitation of the PostgreSQL backup command pg_dumpall
which cannot fulfill the request "dump only those roles
needed for database X" -- mainly because this request is
ill-defined - PostgreSQL cannot know which roles are
"needed" to access a particular database. In reality only
the local admin or user can now. The script even tries to
give some advice:

> ==> Adjusting GNUmed roles ...
> 
>    You will now be shown the roles backup file.
>    Please edit it to only include the roles you need for GNUmed.
> 
>    Remember that in PostgreSQL scripts the comment marker is "--".

Karsten
-- 
GPG key ID E4071346 @ wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD  4537 78B9 A9F9 E407 1346




reply via email to

[Prev in Thread] Current Thread [Next in Thread]