Thread: Migrating data from DB2 zOS to PostgreSQL

Migrating data from DB2 zOS to PostgreSQL

From
Swapnil Vaze
Date:
Hello,

We need some help on how we can migrate data from DB2 zOS database to postgres database.

Are there any utilities present? Any thoughts how we should approach?

--
Thanks & Regards,
Swapnil Vaze

Re: Migrating data from DB2 zOS to PostgreSQL

From
Julien Rouhaud
Date:
On Tue, Dec 06, 2016 at 11:06:12AM +0530, Swapnil Vaze wrote:
> Hello,
>

Hello

> We need some help on how we can migrate data from DB2 zOS database to
> postgres database.
>
> Are there any utilities present? Any thoughts how we should approach?

You can use this utility: https://github.com/dalibo/db2topg

The README should provide all needed informations.

--
Julien Rouhaud
http://dalibo.com - http://dalibo.org


Re: Migrating data from DB2 zOS to PostgreSQL

From
Swapnil Vaze
Date:

Hello Julien,

We created DDLs from DB2 zOS system and tried to run script in below format:

 ./db2topg.pl -f sql1.txt -o testdir

It throws below error:

I don't understand <CREATE TABLE "A90DVDT"."DLR_FAM_MRKTSHR_FY_END"
> at ./db2topg.pl line 880, <IN> line 24.

For testing we used file with below content:

cat sql1.txt
-- This CLP file was created using DB2LOOK Version "10.5"
-- Timestamp: Tue Dec  6 04:14:28 CST 2016
-- Database Name: DB239
-- Database Manager Version: DB2 Version 11.1.0
-- Database Codepage: 1208


------------------------------------------------
-- DDL Statements for Table "A90DVDT"."DLR_FAM_MRKTSHR_FY_END"
------------------------------------------------

CREATE TABLE "A90DVDT"."DLR_FAM_MRKTSHR_FY_END"
                (
                 "DEALER_ID"  CHAR(6)  NOT NULL ,
                 "MKTSHR_MONTH"  DATE NOT NULL ,
                 "L12_DP_DLR_IN_AOR"  DECIMAL(15,6) ,
                 "L12_DP_DLR_OUT_AOR"  DECIMAL(15,6) ,
                 "L12_DP_DLR_SHARE"  DECIMAL(8,5) ,
                 "L12_SA_DLR_SHARE"  DECIMAL(8,5) ,
                 "L12_CA_DLR_SHARE"  DECIMAL(8,5) ,
                 "L12_U90_DLR_IN_AOR"  DECIMAL(15,6) ,
                 "L12_U90_DLR_OUT_AOR"  DECIMAL(15,6) ,
                 "L12_U90_DLR_SHARE"  DECIMAL(8,5)
                );

Thanks,
Swapnil


On Tue, Dec 6, 2016 at 12:23 PM, Julien Rouhaud <julien.rouhaud@dalibo.com> wrote:
On Tue, Dec 06, 2016 at 11:06:12AM +0530, Swapnil Vaze wrote:
> Hello,
>

Hello

> We need some help on how we can migrate data from DB2 zOS database to
> postgres database.
>
> Are there any utilities present? Any thoughts how we should approach?

You can use this utility: https://github.com/dalibo/db2topg

The README should provide all needed informations.

--
Julien Rouhaud
http://dalibo.com - http://dalibo.org



--
Thanks & Regards,
Swapnil Vaze

Re: Migrating data from DB2 zOS to PostgreSQL

From
Sameer Kumar
Date:


On Tue, 6 Dec 2016, 9:27 p.m. Swapnil Vaze, <swapvaze28@gmail.com> wrote:

Hello Julien,

We created DDLs from DB2 zOS system and tried to run script in below format:

 ./db2topg.pl -f sql1.txt -o testdir

It throws below error:

I don't understand <CREATE TABLE "A90DVDT"."DLR_FAM_MRKTSHR_FY_END"
> at ./db2topg.pl line 880, <IN> line 24.

For testing we used file with below content:

cat sql1.txt
-- This CLP file was created using DB2LOOK Version "10.5"
-- Timestamp: Tue Dec  6 04:14:28 CST 2016
-- Database Name: DB239
-- Database Manager Version: DB2 Version 11.1.0
-- Database Codepage: 1208


------------------------------------------------
-- DDL Statements for Table "A90DVDT"."DLR_FAM_MRKTSHR_FY_END"
------------------------------------------------

CREATE TABLE "A90DVDT"."DLR_FAM_MRKTSHR_FY_END"
                (
                 "DEALER_ID"  CHAR(6)  NOT NULL ,
                 "MKTSHR_MONTH"  DATE NOT NULL ,
                 "L12_DP_DLR_IN_AOR"  DECIMAL(15,6) ,
                 "L12_DP_DLR_OUT_AOR"  DECIMAL(15,6) ,
                 "L12_DP_DLR_SHARE"  DECIMAL(8,5) ,
                 "L12_SA_DLR_SHARE"  DECIMAL(8,5) ,
                 "L12_CA_DLR_SHARE"  DECIMAL(8,5) ,
                 "L12_U90_DLR_IN_AOR"  DECIMAL(15,6) ,
                 "L12_U90_DLR_OUT_AOR"  DECIMAL(15,6) ,
                 "L12_U90_DLR_SHARE"  DECIMAL(8,5)
                );

I will strongly recommend removing the quotes around table name and column names. Else you may have challenges porting application to PG. As PG by default refers to object names in small case unless you out quotes around them.

So after migration a statement like 

Select * from DLR_FAM_MRKTSHR_FY_END; 

would fail.

Also about the error, see what is before this create table statement. Make sure there is a semi colon to terminate the statement before the CREATE table.

How are you running it? psql?


Thanks,
Swapnil


On Tue, Dec 6, 2016 at 12:23 PM, Julien Rouhaud <julien.rouhaud@dalibo.com> wrote:
On Tue, Dec 06, 2016 at 11:06:12AM +0530, Swapnil Vaze wrote:
> Hello,
>

Hello

> We need some help on how we can migrate data from DB2 zOS database to
> postgres database.
>
> Are there any utilities present? Any thoughts how we should approach?

You can use this utility: https://github.com/dalibo/db2topg

The README should provide all needed informations.

--
Julien Rouhaud
http://dalibo.com - http://dalibo.org



--
Thanks & Regards,
Swapnil Vaze
--

-- 

Best Regards,

Sameer Kumar | DB Solution Architect

ASHNIK PTE. LTD.

101 Cecil Street, #11-11 Tong Eng Building, Singapore 069533

T: +65 6438 3504 | www.ashnik.com

Skype: sameer.ashnik |   T: +65 8110 0350


www.ashnik.com

Re: Migrating data from DB2 zOS to PostgreSQL

From
Marc Cousin
Date:
Please, file these as issues on github (i'm the author). It will be much
easier to solve your problems.

Regards

On 06/12/2016 11:42, Sameer Kumar wrote:
>
>
> On Tue, 6 Dec 2016, 9:27 p.m. Swapnil Vaze, <swapvaze28@gmail.com
> <mailto:swapvaze28@gmail.com>> wrote:
>
>
>     Hello Julien,
>
>     We created DDLs from DB2 zOS system and tried to run script in below
>     format:
>
>      ./db2topg.pl <http://db2topg.pl> -f sql1.txt -o testdir
>
>     It throws below error:
>
>     I don't understand <CREATE TABLE "A90DVDT"."DLR_FAM_MRKTSHR_FY_END"
>     > at ./db2topg.pl <http://db2topg.pl> line 880, <IN> line 24.
>
>     For testing we used file with below content:
>
>     cat sql1.txt
>     -- This CLP file was created using DB2LOOK Version "10.5"
>     -- Timestamp: Tue Dec  6 04:14:28 CST 2016
>     -- Database Name: DB239
>     -- Database Manager Version: DB2 Version 11.1.0
>     -- Database Codepage: 1208
>
>
>     ------------------------------------------------
>     -- DDL Statements for Table "A90DVDT"."DLR_FAM_MRKTSHR_FY_END"
>     ------------------------------------------------
>
>     CREATE TABLE "A90DVDT"."DLR_FAM_MRKTSHR_FY_END"
>                     (
>                      "DEALER_ID"  CHAR(6)  NOT NULL ,
>                      "MKTSHR_MONTH"  DATE NOT NULL ,
>                      "L12_DP_DLR_IN_AOR"  DECIMAL(15,6) ,
>                      "L12_DP_DLR_OUT_AOR"  DECIMAL(15,6) ,
>                      "L12_DP_DLR_SHARE"  DECIMAL(8,5) ,
>                      "L12_SA_DLR_SHARE"  DECIMAL(8,5) ,
>                      "L12_CA_DLR_SHARE"  DECIMAL(8,5) ,
>                      "L12_U90_DLR_IN_AOR"  DECIMAL(15,6) ,
>                      "L12_U90_DLR_OUT_AOR"  DECIMAL(15,6) ,
>                      "L12_U90_DLR_SHARE"  DECIMAL(8,5)
>                     );
>
>
> I will strongly recommend removing the quotes around table name and
> column names. Else you may have challenges porting application to PG. As
> PG by default refers to object names in small case unless you out quotes
> around them.
>
> So after migration a statement like
>
> Select * from DLR_FAM_MRKTSHR_FY_END;
>
> would fail.
>
> Also about the error, see what is before this create table statement.
> Make sure there is a semi colon to terminate the statement before the
> CREATE table.
>
> How are you running it? psql?
>
>
>     Thanks,
>     Swapnil
>
>
>     On Tue, Dec 6, 2016 at 12:23 PM, Julien Rouhaud
>     <julien.rouhaud@dalibo.com <mailto:julien.rouhaud@dalibo.com>> wrote:
>
>         On Tue, Dec 06, 2016 at 11:06:12AM +0530, Swapnil Vaze wrote:
>         > Hello,
>         >
>
>         Hello
>
>         > We need some help on how we can migrate data from DB2 zOS database to
>         > postgres database.
>         >
>         > Are there any utilities present? Any thoughts how we should approach?
>
>         You can use this utility: https://github.com/dalibo/db2topg
>
>         The README should provide all needed informations.
>
>         --
>         Julien Rouhaud
>         http://dalibo.com - http://dalibo.org
>
>
>
>
>     --
>     Thanks & Regards,
>     Swapnil Vaze
>
> --
>
> --
>
> Best Regards,
>
> *Sameer Kumar | DB Solution Architect*
>
> *ASHNIK PTE. LTD.*
>
> 101 Cecil Street, #11-11 Tong Eng Building, Singapore 069533
>
> T: +65 6438 3504 | www.ashnik.com <http://www.ashnik.com/>
>
> Skype: sameer.ashnik |   T: +65 8110 0350
>
>
> **
>
> www.ashnik.com <http://www.ashnik.com/>​
>



Re: Migrating data from DB2 zOS to PostgreSQL

From
Date:
<span style=3D"font-family:Verdana; color:#000000; font-size:10=
pt;">We have recently done something similar - Converting Informix zLi=
nux to Postgres x86_64.Short answer - We used unloads to put out=
 csv files, wrote some python programs to cleanup data, thenimpo=
rted them into our Postgres instance ...<span=
 style=3D"font-size: 8pt;">Ben Dunca=
n - Business Network Solutions, Inc. 336 Elton Road  Jackson MS, 39212"=
Never attribute to malice, that which can be adequately explained by stupid=
ity"- Hanlon's Razor=0A<blockquote =
id=3D"replyBlockquote" webmail=3D"1" style=3D"border-left: 2px solid blue; =
margin-left: 8px; padding-left: 8px; font-size:10pt; color:black; font-fami=
ly:verdana;">=0A=0A-------- Original Message ---=
-----=0ASubject: [GENERAL] Migrating data from DB2 zOS to PostgreSQL<br=
>=0AFrom: Swapnil Vaze <swapvaze=
28@gmail.com>=0ADate: Mon, December 05, 2016 11:36 pm=0ATo: =
pgsql-general@postgresql.or=
g=0A=0AHello,We need some =
help on how we can migrate data from DB2 zOS database to postgres database.=
Are there any utilities present? Any =
thoughts how we should approach?-- <div class=3D"g=
mail_signature" data-smartmail=3D"gmail_signature">Thanks & Regard=
s, Swapnil Vaze  =0A=0A</blockquot=
e>