[Top][All Lists]

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

Re: [Gnumed-devel] Restoring a database under Debian

From: Busser, Jim
Subject: Re: [Gnumed-devel] Restoring a database under Debian
Date: Sat, 24 Jan 2015 05:22:44 +0000

On 2015-01-23, at 5:01 PM, Jim Busser <address@hidden> wrote:

> However when I tried to restore from this inside Debian VM, the following 
> problems ...
> - the roles file that I was presented to edit was empty, and
> - the script failed, claiming the database.sql file did not exist
> despite that following the failure I could (as root) both see them and verify 
> that roles.sql is NOT empty.

i think I have solved it … (??)

>From the /tmp/ directory wherein the untarred backup files were sitting, I was 
>able to finish the restore beginning where the restore script failed … 

However even if the restore script would be adjusted to assign ownership of the 
untarred directory (and not just the sql) to postgres, I have the impression 
that the inability to read and edit the roles-sql file occurred upstream of any 
need for postgres to have any permissions.

# =========================

# declare appropriate variables

# declare a few more, derived from where the script failed

# THIS SOLVED MY PROBLEM - grant ownership of the backup directory itself to 
cd ../
chown -c postgres:postgres $BACKUP

# now return to the previous directory …

# … and re-run steps that the restore script had been unable to successfully 

# edit roles -- uncomment the wanted ones
nano ${BACKUP}-roles.sql

# in case the following commands had not been earlier applied …
# make SQL readable and assign ownership to postgres
chmod -c +r *.sql
chown -c postgres *.sql

# set log for restoring roles, and restore roles
sudo -u postgres psql -e -E -p ${GM_PORT} -f ${BACKUP}-roles.sql &> ${LOG}
chmod 0666 ${LOG}

# set log for restoring database, and restore database
sudo -u postgres psql -p ${GM_PORT} -f ${BACKUP}-database.sql &> ${LOG}
chmod 0666 ${LOG}

#sanity check … is the very rough size of this database anything like what we 
sudo -u postgres psql -p 5433 -d gnumed_v20 -U gm-dbo -c 'SELECT 

--> returns 298 MB … yes !! (the sql file from which it was created was 283 Mb)

I think I am happy!

But I had trouble to open a gnumed client 1.5.2 from tarball in Debian … the 
subject of my next post.

-- Jim

reply via email to

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