Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to trigger between 2 servers ?

Posted on 2004-09-28
8
Medium Priority
?
656 Views
Last Modified: 2008-02-01
Hi,

I have 2 different physical servers, "Server A" & "Server B" (Referred as ip address).
Upon insertion of new record in "Table A" at "Server A" i would also like to "auto insert" the same record to "Table B" at "Server B".

Below is my trigger script, wat is wrong with it ?

CREATE TRIGGER TriggerInsert
ON TableA
FOR INSERT
AS
  insert into "IPAddressOfServerB".DatabaseNameOfServerB..TableB(...) select ... FROM Inserted

When i run this SQL returns me : Could not find server (ip address) in sysservers. Execute sp_addlinkedserver to add the server to sysservers ...

I have also tried adding this :

exec sp_addlinkedserver
   @server = 'IPAddressOfServerB',
   @provider = 'MSDASQL',
   @provstr = 'DRIVER={SQL Server};SERVER=IPAddressOfServerB;UID=XXX;PWD=XXX;'

After that SQL returns me another msg : User does not have permission to perform this action.

Can anyone advise. Thanks

0
Comment
Question by:olyrrah
[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
  • 4
  • 4
8 Comments
 
LVL 11

Expert Comment

by:ram2098
ID: 12168732
You need to more configuration settings for this.. Right Click on the Linked Server from Enterprise Manager and then add the userid information there...

See the following link..it will suggest you how to setup this information.

http://www.databasejournal.com/features/mssql/article.php/3116011

0
 
LVL 11

Expert Comment

by:ram2098
ID: 12168753
As the above article says,

You can try adding this user information using..

EXEC sp_addlinkedsrvlogin 'TEST1', 'false', 'userLocal', 'userRemote', 'remotePassword'
0
 

Author Comment

by:olyrrah
ID: 12176764
Thanks for the feedback, I have followed the instruction to setup linked server on Server A and i can successfully do a select query on the table from Server B but the problem is i still cannot trigger the insert, the operation hang when i do so ... pls advise.

Fyi, I have done the followings :

1. At Server A add a linked server.
Linked Server : (Server B IP Address)
Server Type : SQL Server
Security : Be made using this security context. I use one of the account from database B

2. Created a trigger at Server A

CREATE TRIGGER TriggerInsert
ON TableA
FOR INSERT
AS
  insert into "ServerBIPAddress".DatabaseB.dbo.TableB(...) select ...FROM Inserted

3. Tested a query from Server A query analyzer

select * from "ServerBIPAddress".DatabaseB.dbo.TableB

The query works fine and it returns me the result immediately.

The final thing that i tried is to insert a record in TableA (at Server A) and the operation went forever with no record being inserted

0
Survive A High-Traffic Event with Percona

Your application or website rely on your database to deliver information about products and services to your customers. You can’t afford to have your database lose performance, lose availability or become unresponsive – even for just a few minutes.

 

Author Comment

by:olyrrah
ID: 12176779
I have also tried the statement at Server A :

insert into "ServerBIPAddress".DatabaseB.dbo.TableB(...) values(...) and it also turns out correctly with a record being inserted into the table at Server B
0
 
LVL 11

Expert Comment

by:ram2098
ID: 12176804
Which operating system you are using? I have seen this problem with Windows 2003.
0
 

Author Comment

by:olyrrah
ID: 12176818
Server A is win2k but Server B is 2003 ... so its something to do with the server compatibility ? Btw is there anything wrong with the procedures i have taken ?
0
 
LVL 11

Accepted Solution

by:
ram2098 earned 750 total points
ID: 12176825
I haven't seen any issue with the existing one...

But, fix the issue from Windows 2003 side as well...

Please look at the following link.... (sorry...I have tried both windows 2003 and both windows 2000 before..but not tried the combination..not sure whether it really resolves this issue). You have to take care of the following instructions anyway.

http://dvhome.co.uk/blog/archive/2004/03/22/205.aspx
0
 

Author Comment

by:olyrrah
ID: 12187301
Thanks for the solution, though i didnt really take the last step as i really short of time analyzing the problem so i just use a scheduled dts for that and it does the same objective just that without immediately. Maybe next time ... when i have the opportunity to have 2 server with the same os :)
0

Featured Post

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

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

Recently, Microsoft released a best-practice guide for securing Active Directory. It's a whopping 300+ pages long. Those of us tasked with securing our company’s databases and systems would, ideally, have time to devote to learning the ins and outs…
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

715 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