pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
problem backup/restore PSQL DB
5+ messages / 3 participants
[nested] [flat]

* problem backup/restore PSQL DB
@ 2006-07-25 00:26  JieJun Xu <jiejun83@gmail.com>
  0 siblings, 1 reply; 5+ messages in thread

From: JieJun Xu @ 2006-07-25 00:26 UTC (permalink / raw)
  To: pgsql-admin

Hi all,
    I am trying to backup a psql database in one system(Debian), and restore
it to another system(ubuntu) which has a fresh installed psql db.  However,
I got the following errors. Can anyone give me some help on solving it. Many
thanks.

-------------
 OME Restore
-------------

    \_ Extracting postgres database ome and checking archive version
/bin/tar  --preserve-permissions --same-owner --directory /tmp -xf
'ome_backup_2006-07-24.tar' OMEmaint omeDB_backup    \_ Checking archive for
OMEIS files
/bin/tar  -tf 'ome_backup_2006-07-24.tar' Files/lastFileID
    \_ Restoring postgress database ome
Checking database
Database ome (version 2.23) was found and it will be overwritten. Continue
? [y/n]: y
su postgres -c '/usr/bin/createuser --adduser --createdb  ome'
createuser: creation of new user failed: ERROR:  user "ome" already exists
su postgres -c '/usr/bin/createdb  -T template0 ome'
CREATE DATABASE
su postgres -c '/usr/bin/pg_restore  -O -d ome
--use-set-session-authorization /tmp/omeDB_backup'
pg_restore: [archiver (db)] could not execute query: ERROR:  user "rajesh"
does not exist

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: problem backup/restore PSQL DB
@ 2006-07-25 00:46  Paul S <plabrh1@gmail.com>
  parent: JieJun Xu <jiejun83@gmail.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Paul S @ 2006-07-25 00:46 UTC (permalink / raw)
  To: pgsql-admin


It looks like it's a user configuration issue.  I have hit user setup issues
while restoring DB's before and generally I find it useful to create the
Users and/or Groups manually on the new server first before restoring the
DB's whenever I hit problems like that.  Try syncing the users manually,
(assuming that there are only a few and that it could be done manually with
some level of ease) and then try restoring again.

-Paul
-- 
View this message in context: http://www.nabble.com/problem-backup-restore-PSQL-DB-tf1995768.html#a5478199
Sent from the PostgreSQL - admin forum at Nabble.com.




^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: problem backup/restore PSQL DB
@ 2006-07-25 08:45  Shoaib Mir <shoaibmir@gmail.com>
  parent: Paul S <plabrh1@gmail.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Shoaib Mir @ 2006-07-25 08:45 UTC (permalink / raw)
  To: pgsql-admin

You can also try using 'pg_dumpall' (
http://www.postgresql.org/docs/8.1/static/app-pg-dumpall.html) that will
take the dump of all the users, groups and databases.

Thanks,

Shoaib Mir
EnterpriseDB

On 7/25/06, Paul S <plabrh1@gmail.com> wrote:
>
>
> It looks like it's a user configuration issue.  I have hit user setup
> issues
> while restoring DB's before and generally I find it useful to create the
> Users and/or Groups manually on the new server first before restoring the
> DB's whenever I hit problems like that.  Try syncing the users manually,
> (assuming that there are only a few and that it could be done manually
> with
> some level of ease) and then try restoring again.
>
> -Paul
> --
> View this message in context:
> http://www.nabble.com/problem-backup-restore-PSQL-DB-tf1995768.html#a5478199
> Sent from the PostgreSQL - admin forum at Nabble.com.
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: if posting/reading through Usenet, please send an appropriate
>        subscribe-nomail command to majordomo@postgresql.org so that your
>        message can get through to the mailing list cleanly
>

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: problem backup/restore PSQL DB
@ 2006-07-25 16:37  JieJun Xu <jiejun83@gmail.com>
  parent: Shoaib Mir <shoaibmir@gmail.com>
  0 siblings, 1 reply; 5+ messages in thread

From: JieJun Xu @ 2006-07-25 16:37 UTC (permalink / raw)
  To: Shoaib Mir <shoaibmir@gmail.com>; +Cc: pgsql-admin

Thanks for helping. My postgresql DB is actually part of the OME system
which stores Image Metadata. The system overview is as following:
http://www.openmicroscopy.org/system-overview/.

So I am actually using the option provided by OME to backup/restore my
system.
http://www.openmicroscopy.org/system-admin/backup_restore.html

Part of the backup code in perl is as following:

    print "    \\_ Backing up postgress database ome\n";
    my $dbConf = $environment->DB_conf();
    my $dbName = 'ome';
    $dbName = $dbConf->{Name} if $dbConf->{Name};

    my $flags = '';
    $flags .= '-h '.$dbConf->{Host}.' ' if $dbConf->{Host};
    $flags .= '-p '.$dbConf->{Port}.' ' if $dbConf->{Port};
    $flags .= '-U '.$dbConf->{User}.' ' if $dbConf->{User};
    $flags .= '-Fc'; # -F (format).
                     # -p: use the plain text SQL script file this should be
the most portable
                     # -c: custom archive suitable for input into pg_restore
    print STDERR "su $postgress_user -c '".$prog_path{'pg_dump'}." $flags -o
$dbName > /tmp/omeDB_backup'\n";

    # backup database and watch output from pg_dump
    foreach (`su $postgress_user -c '$prog_path{'pg_dump'} $flags -o $dbName
> /tmp/omeDB_backup' 2>&1`) {
        print STDERR "\nDatabase Backup Failed: $_" and die if $_ =~
/pg_dump/ or $_ =~ /ERROR/ or $_ =~ /FATAL/;
    }
    # check the size of omeDB_backup
    if (stat("/tmp/omeDB_backup")->size < 1024) {
        print STDERR "\nDatabase Backup Failed: /tmp/omeDB_backup is less
than 1024 bytes in size \n";
        die;
    }
    # log version of backup
    open (FILEOUT, "> /tmp/OMEmaint") or die "Couldn't open OMEmaint for
writing\n";
    print FILEOUT "version=$dbAdmin_version\n";
    close (FILEOUT);

I will try modify the 'pg_dump' to 'pg_dumpall' and see if it works..
But is it even possible to backup one system and restore it in another?  I
just don't want to go into a deadend. Many thanks!!

Jun



On 7/25/06, Shoaib Mir <shoaibmir@gmail.com> wrote:
>
> You can also try using 'pg_dumpall' (
> http://www.postgresql.org/docs/8.1/static/app-pg-dumpall.html) that will
> take the dump of all the users, groups and databases.
>
> Thanks,
>
> Shoaib Mir
> EnterpriseDB
>
>
> On 7/25/06, Paul S <plabrh1@gmail.com> wrote:
> >
> >
> > It looks like it's a user configuration issue.  I have hit user setup
> > issues
> > while restoring DB's before and generally I find it useful to create the
> > Users and/or Groups manually on the new server first before restoring
> > the
> > DB's whenever I hit problems like that.  Try syncing the users manually,
> > (assuming that there are only a few and that it could be done manually
> > with
> > some level of ease) and then try restoring again.
> >
> > -Paul
> > --
> > View this message in context:
> > http://www.nabble.com/problem-backup-restore-PSQL-DB-tf1995768.html#a5478199
> > Sent from the PostgreSQL - admin forum at Nabble.com.
> >
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 1: if posting/reading through Usenet, please send an appropriate
> >        subscribe-nomail command to majordomo@postgresql.org so that your
> >        message can get through to the mailing list cleanly
> >
>
>

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: problem backup/restore PSQL DB
@ 2006-07-25 17:35  Shoaib Mir <shoaibmir@gmail.com>
  parent: JieJun Xu <jiejun83@gmail.com>
  0 siblings, 0 replies; 5+ messages in thread

From: Shoaib Mir @ 2006-07-25 17:35 UTC (permalink / raw)
  To: pgsql-admin

Yes, that is possible to take the backup from one instance and restore that
in another postgresql instance and for that purpose you use pg_dump (for
taking full dump use pg_dumpall) and pg_restore utilities.

Thanks,

Shoaib Mir
EnterpriseDB (www.enterprisedb.com)

On 7/25/06, JieJun Xu <jiejun83@gmail.com> wrote:
>
> Thanks for helping. My postgresql DB is actually part of the OME system
> which stores Image Metadata. The system overview is as following:
> http://www.openmicroscopy.org/system-overview/.
>
> So I am actually using the option provided by OME to backup/restore my
> system.
> http://www.openmicroscopy.org/system-admin/backup_restore.html
>
> Part of the backup code in perl is as following:
>
>     print "    \\_ Backing up postgress database ome\n";
>     my $dbConf = $environment->DB_conf();
>     my $dbName = 'ome';
>     $dbName = $dbConf->{Name} if $dbConf->{Name};
>
>     my $flags = '';
>     $flags .= '-h '.$dbConf->{Host}.' ' if $dbConf->{Host};
>     $flags .= '-p '.$dbConf->{Port}.' ' if $dbConf->{Port};
>     $flags .= '-U '.$dbConf->{User}.' ' if $dbConf->{User};
>     $flags .= '-Fc'; # -F (format).
>                      # -p: use the plain text SQL script file this should
> be the most portable
>                      # -c: custom archive suitable for input into
> pg_restore
>     print STDERR "su $postgress_user -c '".$prog_path{'pg_dump'}." $flags
> -o $dbName > /tmp/omeDB_backup'\n";
>
>     # backup database and watch output from pg_dump
>     foreach (`su $postgress_user -c '$prog_path{'pg_dump'} $flags -o
> $dbName > /tmp/omeDB_backup' 2>&1`) {
>         print STDERR "\nDatabase Backup Failed: $_" and die if $_ =~
> /pg_dump/ or $_ =~ /ERROR/ or $_ =~ /FATAL/;
>     }
>     # check the size of omeDB_backup
>     if (stat("/tmp/omeDB_backup")->size < 1024) {
>         print STDERR "\nDatabase Backup Failed: /tmp/omeDB_backup is less
> than 1024 bytes in size \n";
>         die;
>     }
>     # log version of backup
>     open (FILEOUT, "> /tmp/OMEmaint") or die "Couldn't open OMEmaint for
> writing\n";
>     print FILEOUT "version=$dbAdmin_version\n";
>     close (FILEOUT);
>
> I will try modify the 'pg_dump' to 'pg_dumpall' and see if it works..
> But is it even possible to backup one system and restore it in another?  I
> just don't want to go into a deadend. Many thanks!!
>
> Jun
>
>
>
>
> On 7/25/06, Shoaib Mir <shoaibmir@gmail.com> wrote:
> >
> > You can also try using 'pg_dumpall' (http://www.postgresql.org/docs/8.1/static/app-pg-dumpall.html)
> > that will take the dump of all the users, groups and databases.
> >
> > Thanks,
> >
> > Shoaib Mir
> > EnterpriseDB
> >
> >
> > On 7/25/06, Paul S <plabrh1@gmail.com> wrote:
> > >
> > >
> > > It looks like it's a user configuration issue.  I have hit user setup
> > > issues
> > > while restoring DB's before and generally I find it useful to create
> > > the
> > > Users and/or Groups manually on the new server first before restoring
> > > the
> > > DB's whenever I hit problems like that.  Try syncing the users
> > > manually,
> > > (assuming that there are only a few and that it could be done manually
> > > with
> > > some level of ease) and then try restoring again.
> > >
> > > -Paul
> > > --
> > > View this message in context:
> > > http://www.nabble.com/problem-backup-restore-PSQL-DB-tf1995768.html#a5478199
> > > Sent from the PostgreSQL - admin forum at Nabble.com.
> > >
> > >
> > > ---------------------------(end of
> > > broadcast)---------------------------
> > > TIP 1: if posting/reading through Usenet, please send an appropriate
> > >        subscribe-nomail command to majordomo@postgresql.org so that
> > > your
> > >        message can get through to the mailing list cleanly
> > >
> >
> >
>

^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2006-07-25 17:35 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-07-25 00:26 problem backup/restore PSQL DB JieJun Xu <jiejun83@gmail.com>
2006-07-25 00:46 ` Paul S <plabrh1@gmail.com>
2006-07-25 08:45   ` Shoaib Mir <shoaibmir@gmail.com>
2006-07-25 16:37     ` JieJun Xu <jiejun83@gmail.com>
2006-07-25 17:35       ` Shoaib Mir <shoaibmir@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox