question

sukran dere avatar image
sukran dere asked

Unable to write trigger between linked servers

In SQL SERVER 2005 I tried this:

  • EXEC sp_addlinkedserver 'SAMPLESERVER', 'Oracle', 'MSDAORA', 'SAMPLESERVER'
  • EXEC sp_addlinkedsrvlogin 'SAMPLESERVER', 'FALSE', NULL, 'user_name', 'password'

Then I connected to remote server. So that I can do insert, update, delete, select to remote server. There is no problem for this issue. The connection is normal.

When I use update, delete, insert commands in a trigger, trigger created successfully. But for example; after inserting to a SQL SERVER table, trigger gives error. error is:

OLE DB provider "MSDAORA" for linked server "SAMPLESERVER" returned message "ORA-01041:internal error. hostdef extension doesn"t exist

my trigger is :

  • ALTER TRIGGER [SAMPLETRIGGER] ON

  • SQLSERVERTABLE AFTER UPDATE AS

  • BEGIN

  • INSERT INTO SAMPLESERVER..USERNAME.ORACLETABLE

  • VALUES(3,123, 'XX', 111, 'XX', GETDATE(), NULL, NULL,NULL,NULL)

  • END

NOTE: the insert code runs successfully without trigger.

oracletriggerlinked-server
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

TG avatar image
TG answered

This forum is for MS Sql Server only. Try posting your question on a forum for Oracle - like dbforums.com

For sql server you wouldn't want to put a linked server call inside a trigger for various reasons. Sounds like replication would be a better sql server solution in this case.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

sukran dere avatar image
sukran dere answered

thanks a lot for your advice, I will try sql server replication.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.