Solved

server to server option in SQL

Posted on 2013-01-30
15
294 Views
Last Modified: 2013-02-18
If you have to write from one server to another (or read for that matter), is

1)Linked Server
2)Import/Export
3)BCP

the only options? anything else?
0
Comment
Question by:25112
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 4
  • 3
  • +2
15 Comments
 
LVL 143

Assisted Solution

by:Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3] earned 56 total points
ID: 38835851
you can add replication to the list.

the choice depends on the needs, the volume etc..
for example, is this for a batch?
must the change be part of a "trigger/transaction"?
how many records to be the written/read ?
etc ...
0
 
LVL 75

Assisted Solution

by:Aneesh Retnakaran
Aneesh Retnakaran earned 167 total points
ID: 38835883
+ Bulk insert
0
 
LVL 78

Assisted Solution

by:arnold
arnold earned 222 total points
ID: 38835921
You can have an external mechanism as well.

What is the goal?
0
Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

 
LVL 5

Author Comment

by:25112
ID: 38835955
the end goal is to do a DELETE or INSERT in 2nd server db from first server, from inside a SP. What would you recommend?

we want to avoid linked server, because there is a linked server already between these 2 servers, and for security reason, management wants only login to be on a linked server between 2 servers.. so we need something other than LS.
0
 
LVL 5

Author Comment

by:25112
ID: 38835962
>>You can have an external mechanism as well.
do you mean ETL like SSIS?
0
 
LVL 75

Assisted Solution

by:Aneesh Retnakaran
Aneesh Retnakaran earned 167 total points
ID: 38836071
if you want to do it within an sp, linked server is the best bet (you can setup SPN for the linked server  or a proxy for best security) ;
other option will be to call 2 sps, first one connect to the first server and executes and then application make another connection to the second server and call the second sp .
0
 
LVL 78

Assisted Solution

by:arnold
arnold earned 222 total points
ID: 38836078
Depending on your programming skills you can create a windows service (vb, c#) that can be run on either or a separate server that will establish a connection into one server and perform transactions while having a second connection to the other database server and perform the transaction it needs.

SSIS is one point.
The issue is more whether you need the two synchronized in real time.  Depending on your need and sql version, database mirroring might be a better option when you can bring up a read only snapshot from the mirrored database.
0
 
LVL 5

Author Comment

by:25112
ID: 38836342
>>other option will be to call 2 sps, first one connect to the first server and executes and then application make another connection to the second server and call the second sp .

you still need a LS with this, right?

is the above in essence the same concept as
"
establish a connection into one server and perform transactions while having a second connection to the other database server and perform the transaction it needs."
0
 
LVL 5

Author Comment

by:25112
ID: 38836344
the 2 dbs are totally different, so mirroring may not be an option.. the proecss we are dealing with is to write or remove a record on the other database, based on some conditions.
0
 
LVL 5

Author Comment

by:25112
ID: 38836347
you can't use bcp for this, can you? (from one sp, write directly into table in another server?)
0
 
LVL 75

Assisted Solution

by:Aneesh Retnakaran
Aneesh Retnakaran earned 167 total points
ID: 38836390
>you still need a LS with this, right?
Nope, you are basically making two seperate connections from the application for calling the two different sps, the issue associated with this will  be it wont be run as one transaction
0
 
LVL 78

Assisted Solution

by:arnold
arnold earned 222 total points
ID: 38836657
An external process either as a service or as a scheduled task is more like what you would need. I.e. it connects into the first to see if there are entries matching the requisite condition, then it does what it needs. either copies the entries from one to the other and deletes, or deletes one from database2.
0
 
LVL 5

Author Comment

by:25112
ID: 38836783
aneeshattingal, thanks

arnold, other than ssis, what are other sql technologies that will come under external processes as you mentioned?
0
 
LVL 69

Assisted Solution

by:Scott Pletcher
Scott Pletcher earned 55 total points
ID: 38837122
Be aware that you can have different callers use different security contexts on the linked server, even though all users are using the same linked server name.

And of course the linked server name doesn't have to bear any relation to the actual server name it links to.  That does make the link more obvious, but in cases where you don't want that, simply pick a different, and non-revealing, name for the linked server:


EXEC sp_addlinkedserver  
   @server='F89C2503DAA5',
   @srvproduct='',
   @provider='SQLNCLI',
   @datasrc='server_name\instance_name'
0
 
LVL 78

Accepted Solution

by:
arnold earned 222 total points
ID: 38837705
The process is outside of sql services/components.
You can use powershell cmndlets, vbscripts, etc. this is a completely separate application that connects to dbserver1 database1 and to dbserver2 database2.
This application performs the queries you deine on each databse without the need to link them.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you find yourself in this situation “I have used SELECT DISTINCT but I’m getting duplicates” then I'm sorry to say you are using the wrong SQL technique as it only does one thing which is: produces whole rows that are unique. If the results you a…
If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question