X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id D3118D1DD26 for ; Wed, 18 Feb 2004 13:17:43 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 09101-03 for ; Wed, 18 Feb 2004 09:17:44 -0400 (AST) Received: from news.hub.org (news.hub.org [200.46.204.72]) by svr1.postgresql.org (Postfix) with ESMTP id 7737BD1DCD9 for ; Wed, 18 Feb 2004 09:17:41 -0400 (AST) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.12.9/8.12.9) with ESMTP id i1IDHe1Y085476 for ; Wed, 18 Feb 2004 13:17:40 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.12.9/8.12.9/Submit) id i1ID5fPX083424 for pgsql-admin@postgresql.org; Wed, 18 Feb 2004 13:05:41 GMT X-Abuse-Report: abuse@teranews.com Message-ID: Date: Wed, 18 Feb 2004 12:54:23 GMT Lines: 47 From: Jeff Boes X-Newsgroups: comp.databases.postgresql.admin Subject: Re: HELP - need way to restore only blobs Organization: Mur Consulting References: <1077046844.5869.25.camel@localhost.localdomain> X-Newsreader: Forte Agent 1.93/32.576 English (American) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: pgsql-admin@postgresql.org X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200402/267 X-Sequence-Number: 12441 At some point in time, wlittle@securitylending.com (Warren Little) wrote: >I migrated my database from 7.3 to 7.4 this weekend using the pg_dumpall >tool which I now realize does not capture blobs. > >I now need to move only the blob data to the 7.4 database. >The problem with redoing the dump with pg_dump -b is the database is now >in production and writing over the top of changes to the database is not >exceptable. The blob data is very static so if there was some way to >copy the physical files from disk and modify some records in the system >tables to properly locate the blob records that would be best. Another >option I was looking at was to restore the archived database with the >blobs intact and then restore the production version over the top >without destroying the blob data. In a similar situation, we wrote a script that constructs "\lo_export" commands to dump each large object to a file. The file name for each contains the information needed to reconstruct the object at the other end. For instance, if you have a table like this: CREATE TABLE foobar (primary_id INTEGER PRIMARY KEY, large_obj OID, ...) you'd want a series of commands that look like this: \lo_export .dmp Then, given a directory full of such files, you construct another series of commands that look like this: \lo_import .dmp UPDATE foobar SET large_obj = WHERE primary_id = ; The trick is capturing the output of the \lo_import command and parsing it to get the large object OID after it is created. I don't know if I have permission to post or email the script, but if you contact me offline I should know by then. jboes at n/e/x/c/e/r/p/t/d/o/t/c/o/m -- ~~~~~~~~~~~~~~~~| Genius may have its limitations, but stupidity is not Jeff Boes | thus handicapped. jboes@qtm.net | --Elbert Hubbard (1856-1915), American author