Solved

How to trigger between 2 servers ?

Posted on 2004-09-28
8
634 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
Database Solutions Engineer FAQs

In this series, we will discuss common questions received as a database Solutions Engineer at Percona. In this role, we speak with a wide array of MySQL and MongoDB users responsible for both extremely large and complex environments to smaller single-server environments.

 

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 250 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

Database Solutions Engineer FAQs

In this series, we will discuss common questions received as a database Solutions Engineer at Percona. In this role, we speak with a wide array of MySQL and MongoDB users responsible for both extremely large and complex environments to smaller single-server environments.

Question has a verified solution.

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

Your data is at risk. Probably more today that at any other time in history. There are simply more people with more access to the Web with bad intentions.
In this blog post, we’ll look at how ClickHouse performs in a general analytical workload using the star schema benchmark test.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…

623 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