Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gjKm6-0000cj-KE for pgsql-general@arkaria.postgresql.org; Tue, 15 Jan 2019 09:12:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gjKm5-0002tD-0S for pgsql-general@arkaria.postgresql.org; Tue, 15 Jan 2019 09:12:45 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gjKm4-0002t6-OF for pgsql-general@lists.postgresql.org; Tue, 15 Jan 2019 09:12:44 +0000 Received: from hermes.gatewaynet.com ([193.92.121.98]) by magus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gjKlx-0001ZZ-Uy for pgsql-general@lists.postgresql.org; Tue, 15 Jan 2019 09:12:44 +0000 Received: from smadev.internal.net (pc131.internal.net [10.9.200.131]) by hermes.gatewaynet.com (8.14.3/8.14.3/Debian-9.4) with ESMTP id x0F9CTfo011300 for ; Tue, 15 Jan 2019 11:12:35 +0200 Received: from smadev.internal.net (smadev [10.9.200.131]) by smadev.internal.net (8.15.2/8.15.2) with ESMTP id x0F9CT5I077290 for ; Tue, 15 Jan 2019 11:12:29 +0200 (EET) (envelope-from achill@matrix.gatewaynet.com) Subject: Re: Oracke BLOB to Postgres BYTEA using ora2pg To: pgsql-general@lists.postgresql.org References: <7d53972a39254292be7243d8fd06d53f@cewexch402.ad.cetin> From: Achilleas Mantzios Message-ID: Date: Tue, 15 Jan 2019 11:12:29 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:60.0) Gecko/20100101 Thunderbird/60.3.2 MIME-Version: 1.0 In-Reply-To: <7d53972a39254292be7243d8fd06d53f@cewexch402.ad.cetin> Content-Type: multipart/alternative; boundary="------------031B23679B363E6FE3D70E0A" Content-Language: en-US X-Virus-Scanned: clamav-milter 0.98.7 at hermes X-Virus-Status: Clean X-Spam-Status: No, score=-27.9 required=5.0 tests=ALL_TRUSTED,DYN_HAM_COORD, DYN_HAM_IT,DYN_HAM_NAUTICAL,HTML_MESSAGE,TW_XX autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on hermes.gatewaynet.com List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------031B23679B363E6FE3D70E0A Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Dobro jutro On 15/1/19 10:39 π.μ., Mihalidesová Jana wrote: > > Hi, > > We try to migrate from oracle to postgres using ora2pg but we hit some weird behavior of bytea. Or it’s just our ignorance. > > Table migration were ok, but we are not able to read bytea data. What we did wrong. > Assuming your data are jpeg images,  try smth like : psql -c "copy (select encode(serializable_value,'hex') from alf_node_properties_zaloha where serializable_value is not null LIMIT 1) to stdout" | xxd -p -r > foo.jpg then use some program (gwenview) to see the image. If you want to dump all images (assuming again we are dealing with images here), then loop over each row and do the same as above. But it is essential that you know what those values represent. Are they pdf docs? images? binaries? octet-streams? > Thank you for your help, > > -- Achilleas Mantzios IT DEV Lead IT DEPT Dynacom Tankers Mgmt --------------031B23679B363E6FE3D70E0A Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit
Dobro jutro

On 15/1/19 10:39 π.μ., Mihalidesová Jana wrote:

Hi,

 

We try to migrate from oracle to postgres using ora2pg but we hit some weird behavior of bytea. Or it’s just our ignorance.

Table migration were ok, but we are not able to read bytea data. What we did wrong.

 


Assuming your data are jpeg images,  try smth like :
psql -c "copy (select encode(serializable_value,'hex') from alf_node_properties_zaloha where serializable_value is not null LIMIT 1) to stdout" | xxd -p -r > foo.jpg

then use some program (gwenview) to see the image.

If you want to dump all images (assuming again we are dealing with images here), then loop over each row and do the same as above.

But it is essential that you know what those values represent. Are they pdf docs? images? binaries? octet-streams?

Thank you for your help,



-- 
Achilleas Mantzios
IT DEV Lead
IT DEPT
Dynacom Tankers Mgmt
--------------031B23679B363E6FE3D70E0A--