Solved

server to server option in SQL

Posted on 2013-01-30
15
288 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
  • 6
  • 4
  • 3
  • +2
15 Comments
 
LVL 142

Assisted Solution

by:Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3] earned 56 total points
Comment Utility
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
Comment Utility
+ Bulk insert
0
 
LVL 76

Assisted Solution

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

What is the goal?
0
 
LVL 5

Author Comment

by:25112
Comment Utility
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
Comment Utility
>>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
Comment Utility
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 76

Assisted Solution

by:arnold
arnold earned 222 total points
Comment Utility
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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 5

Author Comment

by:25112
Comment Utility
>>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
Comment Utility
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
Comment Utility
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
Comment Utility
>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 76

Assisted Solution

by:arnold
arnold earned 222 total points
Comment Utility
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
Comment Utility
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:ScottPletcher
ScottPletcher earned 55 total points
Comment Utility
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 76

Accepted Solution

by:
arnold earned 222 total points
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

744 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now