Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: Importing SQL 7.0 tables

Re: Importing SQL 7.0 tables

From: <Jared.Still_at_radisys.com>
Date: Thu, 14 Feb 2002 09:29:09 -0800
Message-ID: <F001.0040FEE6.20020214090325@fatcity.com>

If you know the table names already, this Perl script will dump the tables into CSV format for you. From there you can build SQL*Loader scripts to load the data.

For anyone wondering why I didn't just suggest using the Oracle utilities for migrating from SQL Server to Oracle, it doesn't always work, especially
when the SQL Server database has not been managed properly.

Jared


use DBI;

my $dbh = DBI->connect("dbi:ADO:SERVER NAME HERE","sa",SA PASSWORD HERE'); die "could not connect to rsysweb\n" unless $dbh;

my @tables = qw{

        dtproperties EVENTS AdminLevel CATEGORIES CONTACTS ...
};

foreach my $table ( @tables ) {

        print "Table: $table\n";
        my $filename = lc($table) . '.dmp';
        open(FILE, ">$filename") || die "could not create $filename - 
$!\n";
        my $sql = "select * from $table";
        my $sth = $dbh->prepare($sql);
        $sth->execute;
        print FILE join('|', @{$sth->{NAME_uc}}), "\n";
        while ( my $ary = $sth->fetchrow_arrayref ) {
                print FILE '<<<' , join('|', @{$ary} ),">>>\n";
        }
 
        close FILE;

}

$dbh->disconnect;

"Ferry Situmorang" <binsar_at_kalimantan.ptpn13.com> Sent by: root_at_fatcity.com
02/13/02 08:58 PM
Please respond to ORACLE-L  

        To:     Multiple recipients of list ORACLE-L <ORACLE-L_at_fatcity.com>
        cc: 
        Subject:        Importing SQL 7.0 tables


I need to import into Oracle my SQL 7.0 tables. How could I complete this?

Thanks,

Ferry Situmorang:
Using Oracle 8.1.7 Designer 6i R4
PT Perkebunan Nusantara XIII (Persero)
Pontianak-Indonesia
http://www.ptpn13.com

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Ferry Situmorang
  INET: binsar_at_kalimantan.ptpn13.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: 
  INET: Jared.Still_at_radisys.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Thu Feb 14 2002 - 11:29:09 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US