Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to trigger between 2 servers ?

Posted on 2004-09-28
8
Medium Priority
?
670 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
  • 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
 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

 

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

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

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

One of the most important things in an application is the query performance. This article intends to give you good tips to improve the performance of your queries.
Creating a Cordova application which allow user to save to/load from his Dropbox account the application database.
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…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

876 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