X-Original-To: pgsql-admin-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id B13379FA666 for ; Tue, 25 Jul 2006 14:35:47 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 70913-09 for ; Tue, 25 Jul 2006 14:35:37 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from py-out-1112.google.com (py-out-1112.google.com [64.233.166.176]) by postgresql.org (Postfix) with ESMTP id 747139FA65C for ; Tue, 25 Jul 2006 14:35:37 -0300 (ADT) Received: by py-out-1112.google.com with SMTP id b36so2477990pyb for ; Tue, 25 Jul 2006 10:35:36 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=Ra4NTeE+VNSd1yopN5PukuJ29DTQczS1tHcI5iQeXCkqcyKKNgY+WPQi5caPgJruy4laMe6YKsOuWbhlO3nHoZTufbKScM48azTpMzKVXLNhgH/Md2PChHC+i6jRj7h5TdSjg2yj0kzfacaBBN7EOgUQs02UnOU1Z+wVqzSp35g= Received: by 10.35.100.6 with SMTP id c6mr9798533pym; Tue, 25 Jul 2006 10:35:35 -0700 (PDT) Received: by 10.35.61.12 with HTTP; Tue, 25 Jul 2006 10:35:35 -0700 (PDT) Message-ID: Date: Tue, 25 Jul 2006 22:35:35 +0500 From: "Shoaib Mir" To: pgsql-admin@postgresql.org Subject: Re: problem backup/restore PSQL DB In-Reply-To: <75c69f690607250937m7c5c2f59o631d3b3f919f3f13@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_111157_12051951.1153848935332" References: <75c69f690607241726r1a640b2excab3439485cdff63@mail.gmail.com> <5478199.post@talk.nabble.com> <75c69f690607250937m7c5c2f59o631d3b3f919f3f13@mail.gmail.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.374 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, HTML_50_60, HTML_MESSAGE, SPF_PASS X-Spam-Level: X-Archive-Number: 200607/208 X-Sequence-Number: 22454 ------=_Part_111157_12051951.1153848935332 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline 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 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 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 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 > > > > > > > > ------=_Part_111157_12051951.1153848935332 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline 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



------=_Part_111157_12051951.1153848935332--