From: | Patrick FICHE <Patrick(dot)FICHE(at)AQSACOM(dot)COM> |
---|---|
To: | "'fs(at)snes(dot)edu'" <fs(at)snes(dot)edu> |
Cc: | "'pgsql-general(at)postgresql(dot)org'" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: MS-server <-> Ppostgresql |
Date: | 2002-11-21 14:09:45 |
Message-ID: | 85058ADF852DD5118FD50002A528A5B609BF9B@SERVEUR |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
I think that's indeed a good solution...
Here are some ideas to help you.
First use bcp to extract info from MSSQLSERVER
bcp table1 out c:\_tmp\table1.txt -c -k -S. -U sa -P
The -k is important to be able to get back NULL values....
Then copy this file on Linux and apply the following tcl script :
tablelist.txt contains your path to table1.txt file and more files for
multi-table migration....
tclconvert.txt
******************************************************
set file [open tablelist.txt r]
set flist [read -nonewline $file]
close $file
set flist [split $flist \n]
foreach f $flist {
set file [open $f r]
set data [read -nonewline $file]
close $file
regsub -all "\t\t" $data "\t_NULL_\t" data
regsub -all "\t\n" $data "\t_NULL_\n" data
regsub -all {\\} $data {\\\\} data
set file [open $f w]
puts $file $data
puts $file
close $file
}
*******************************************************
run the command
tclsh tclconvert.txt
Then import the resulting file in postgresql using COPY command
COPY table1 FROM 'table1.txt' with null as '_NULL_';"
If you are interested in, I will send you my complete migration script...
You will have to adapt them but they will give you an idea of how to do it.
-----Original Message-----
From: pgsql-general-owner(at)postgresql(dot)org
[mailto:pgsql-general-owner(at)postgresql(dot)org]On Behalf Of Hegyvari
Krisztian
Sent: Thursday, November 21, 2002 2:19 PM
To: fs(at)snes(dot)edu
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: [GENERAL] MS-server <-> Ppostgresql
Just an idea: we recently migrated a bigger database from BTrieve to Oracle,
through intermediate text files. Can't you do something similar? Exporting
on one side and importing on the other. That worked better for us than
copying on a record by record basis.
Regards,
Hegyvari Krisztian
>>> Francois Sauterey <fs(at)snes(dot)edu> 11/21/02 01:35pm >>>
Apology for my so poop english... and my cross-postage.
I plan to extract/copy about 120.000 lines from a MS SQL 7 server database
(on a NT machione) to a postresql database on a Linux machine
(debian/woody).
But what a pity : I obtain (after so many tests, so many compilation with
so many different options) a copy of about 1200 lines/minute ;~{
And horror, I plan to make the same thing whith a 3.000.000 lines database.
Any idea ?
Best regards
---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)
---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)
From | Date | Subject | |
---|---|---|---|
Next Message | Ian Barwick | 2002-11-21 14:11:26 | Re: [SQL] psql on FreeBSD 4.7-RELEASE-p2 and greek (iso8859-7) chars |
Previous Message | Williams, Travis L, NPONS | 2002-11-21 14:04:03 | Re: tcpip connections.. |