dbTalk Databases Forums  

how can I copy a huge table to another database?

comp.databases.ms-sqlserver comp.databases.ms-sqlserver


Discuss how can I copy a huge table to another database? in the comp.databases.ms-sqlserver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Hardy
 
Posts: n/a

Default how can I copy a huge table to another database? - 07-27-2011 , 10:57 AM






suppose I have 100M records and we don't like INSERT.

one option is to export to external file and bulk load the file.

is there any better idea? linked server configured here.

Thanks.

Reply With Quote
  #2  
Old   
Bob Barrows
 
Posts: n/a

Default Re: how can I copy a huge table to another database? - 07-27-2011 , 01:27 PM






Hardy wrote:
Quote:
suppose I have 100M records and we don't like INSERT.

one option is to export to external file and bulk load the file.

is there any better idea? linked server configured here.

Thanks.
What version of sql server?

There's always bcp, dts, ssis.
Depending on the version, a dts or ssis package can be generated using the
Import/Export wizard.

Reply With Quote
  #3  
Old   
Fred.
 
Posts: n/a

Default Re: how can I copy a huge table to another database? - 07-27-2011 , 03:45 PM



On Jul 27, 11:57*am, Hardy <wyh... (AT) gmail (DOT) com> wrote:
Quote:
suppose I have 100M records and we don't like INSERT.

one option is to export to external file and bulk load the file.

is there any better idea? linked server configured here.

Thanks.
We have a weekly transfer of about 5M fairly wide records (about 4GB
total with indexes) . We just use an SSIS transfer accepting whatever
the undelying method is. We found that a big saving in dropping
indexes in the target table and rebuilding them aftert the transfer.
In our system this seems to take around 11 minutes over a 100MHZ
network including the index rebuild.

Although the only transfer on your scale I've done was multiple
complete databases via backup, file copy and restore, I found that
setting up a dedicated GHZ link between the servers was well worth the
set-up time. I was able to on the order of 75GB of databases in
around 90 minutes.

Fred.

Reply With Quote
  #4  
Old   
Erland Sommarskog
 
Posts: n/a

Default Re: how can I copy a huge table to another database? - 07-27-2011 , 04:53 PM



Hardy (wyhang (AT) gmail (DOT) com) writes:
Quote:
suppose I have 100M records and we don't like INSERT.

one option is to export to external file and bulk load the file.

is there any better idea? linked server configured here.
Since you mention linked server, I assume that the tables are not
only in different databases, but also linked servers? In that case
I would do BCP (since I don't know SSIS).

If they are on the same server, you should absolute use INSERT if you
are on SQL 2008, since INSERT can be minimally logged on SQL 2008,
provided this is true:

* Database is in simple or bulk-recovery.
* The table is a heap.
* You specify the TABLOCK hint.

Books Online has the full details.


--
Erland Sommarskog, SQL Server MVP, esquel (AT) sommarskog (DOT) se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.