Re: sybase->postgresql

From: "Jim C(dot) Nasby" <jim(at)nasby(dot)net>
To: Josh Berkus <josh(at)agliodbs(dot)com>
Cc: Ashish Mahabal <aam(at)astro(dot)caltech(dot)edu>, pgsql-general(at)postgresql(dot)org
Subject: Re: sybase->postgresql
Date: 2004-02-11 18:16:34
Message-ID: 20040211181634.GD32360@nasby.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

You can also use sybase's BCP for some tables, if you know that there's
nothing that needs to be quoted. When I migrated stats.distributed.net
from sybase to pgsql I used both tactics; I bcp'd every table I could,
then used a perl script to copy from sybase to pgsql for tables that had
embedded tabs, linefeeds, etc.

The code I used for our migration is at
http://cvs.distributed.net/viewcvs.cgi/stats-sql/postgresql/. move.pl is
the perl script I used. Since I used BCP for all the really big tables I
just had the perl script insert directly into pgsql, but you could
always have it produce a file that copy could deal with as Josh
mentioned (in fact, you wouldn't even need to write to a file; copy can
read from stdin. This would save time if the amount of downtime for the
migration matters to you.)

On Wed, Feb 11, 2004 at 09:04:14AM -0800, Josh Berkus wrote:
> Ashish,
>
> > postgresql you said (I saw this on a list):
> > > Also, if you have a *running* Sybase database, conversion is a lot
> > > easier ... you can use Perl::DBI to read directly from sybase to a COPY
> > > file, and then load the COPY file into Postgres.
> >
> > I am brand new to postgres and do have a running sybase which I wish to
> > convert. I have used perl's DBlib. However, I am not sure how to get the
> > output to copy. I will also be sending the question to postgres lists, but
> > thought I would send it to you too in case you are able to suggest
> > something.
>
> Easiest way? Use perl to pull from Sybase and build a COPY-formatted file.
> Then have perl log into postgres and load the file. Seems awkward, but it's
> actually *much* faster than other methods. We do this for a 1GB Sybase
> database for one client on a nightly basis; takes about 40 minutes.
>
> --
> Josh Berkus
> Aglio Database Solutions
> San Francisco
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>

--
Jim C. Nasby, Database Consultant jim(at)nasby(dot)net
Member: Triangle Fraternity, Sports Car Club of America
Give your computer some brain candy! www.distributed.net Team #1828

Windows: "Where do you want to go today?"
Linux: "Where do you want to go tomorrow?"
FreeBSD: "Are you guys coming, or what?"

In response to

Browse pgsql-general by date

  From Date Subject
Next Message scott.marlowe 2004-02-11 18:19:51 Re: pl/pythonu
Previous Message Josh Berkus 2004-02-11 18:10:47 Re: sybase->postgresql