|
|
Archives of the TeradataForum
Message Posted: Thu, 03 Jul 2003 @ 23:08:11 GMT
Subj: | | Re: Exporting 300G and importing it |
|
From: | | Kimana Wanaleiu |
| What is the best tool to export 300G and import it into an empty table? Can you also provide some sample code. | |
If both source and destination are Teradata, heres a Perl solution:
my $ctldbh = DBI->connect('dbi:Teradata:dbc', $username, $password,
{ RaiseError => 0, PrintError => 0, tdat_lsn => 0 });
#
# create EXPORT control session
#
my $fedbh = DBI->connect("dbi:Teradata:otherdbc", $userid, $passwd,
{
PrintError => 0,
RaiseError => 0,
AutoCommit => 1,
tdat_lsn => 0
});
my $total = $ctldbh->func(
{
Utility => 'FASTLOAD',
Sessions => 20,
SQL => 'USING (col1 integer, col2 smallint, col3 byteint, col4 char(20),
col5 varchar(100), col6 float, col7 decimal(2,1),
col8 decimal(4,2), col9 decimal(8,4), col10 float, col11 date,
col12 time, col13 timestamp(0))
INSERT INTO newtable VALUES(:col1, :col2, :col3, :col4, :col5, :col6,
:col7, :col8, :col9, :col10, :col11, :col12, :col13);',
Loopback => 'SELECT * FROM oldtable',
Source => $fedbh,
Checkpoint => 200000,
CheckpointCallback => \&checkpoint,
MP => 1
},
tdat_UtilitySetup);
print $ctldbh->errstr
unless ($total && ($total > 0));
| |