Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 Copy Data from ServerA to ServerB

Author  Topic 

khalik
Constraint Violating Yak Guru

443 Posts

Posted - 2012-01-12 : 09:59:52
I am loading huge Data from ServerA to ServerB. Planing is LinkedServer

insert into table select * from linkedserver.owner.table and every thing is done in Begin & END Transaction

My concern is the Transaction time and log.

I have other option of using BCP, in this i have to move the file and access the files.

I cannot use SSIS can some one suggest a better way to copy data by SQL or Pl SQL block.


========================================
Project Manager who loves to code.
===============
Ask to your self before u ask someone

X002548
Not Just a Number

15586 Posts

Posted - 2012-01-12 : 11:37:33
I would use bcp in native format and copy the file to the other server then bcp the data into the base table or a staging table



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2012-01-12 : 12:41:30
Don't do it in a transaction. If you need a transaction get all the data to #TempTables locally, and then process it into local tables within a transaction.

If you need to be sure the source data is a snapshot (i.e. cannot change DURING the "pull" to your server) then that's more tricky.

If its a one=off then perhaps BACKUP the database on the Remote, copy the Backup File to local, and then RESTORE to a temporary database and go from there ...
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2012-01-12 : 13:38:55
quote:
Originally posted by Kristen
If its a one=off




BIGGEST Lie in the b'dness

Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2012-01-12 : 13:44:12
Brett: I've told you a million times not to exaggerate!
Go to Top of Page

Sachin.Nand

2937 Posts

Posted - 2012-01-13 : 04:22:54
Maybe you can enable DTC service and the use distributed transaction in the query.Something like this

Begin distributed transaction

Insert Query



After Monday and Tuesday even the calendar says W T F ....
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2012-01-13 : 05:19:10
Yeah you probably could, but I wonder if its a good idea? depends on the circumstances of course ... but in my experience it tends to tie up all sorts of things, and such between-server actions take a while (unless you have stupendous infrastructure - we certainly don't!), and tend therefore to have undesirable consequences. Quick to program, annoying for the users ...

But I'd appreciate your views, maybe I'm being over-sensitive for my users?!!
Go to Top of Page

Sachin.Nand

2937 Posts

Posted - 2012-01-15 : 04:54:49
After I relooked at the OP's requirement I would rather say that setting up a local transaction would suffice since the OP is not trying to insert data into a remote server from the local server.So no need to use DTC at the first place.

Also I would rather disagree with backup and restore solution.The biggest DB that I work with is about 2 TB having one table of 25 GB.So would be kind of impractical in my enviroment to do a backup and restore.

After Monday and Tuesday even the calendar says W T F ....
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2012-01-15 : 08:23:10
quote:
Originally posted by Sachin.Nand

Also I would rather disagree with backup and restore solution.The biggest DB that I work with is about 2 TB having one table of 25 GB.So would be kind of impractical in my enviroment to do a backup and restore.



Yeah, massive database may well not work well with Backup / Restore ... but ... having said that, if you had poor quality COMMs between the servers doing:

SELECT *
INTO MyLocalTable
FROM MyRemote_25GB_Table

might KILL the remote system and the COMMs link ...
Go to Top of Page
   

- Advertisement -