x

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.

more ▼

asked Feb 22, 2010 at 11:30 AM in Default

sukran dere gravatar image

sukran dere
43 2 2 2

(comments are locked)
10|1200 characters needed characters left

2 answers: sort voted first

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.

more ▼

answered Feb 22, 2010 at 12:51 PM

TG gravatar image

TG
1.8k 1 3

(comments are locked)
10|1200 characters needed characters left

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

more ▼

answered Feb 22, 2010 at 06:04 PM

sukran dere gravatar image

sukran dere
43 2 2 2

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

New code box

There's a new way to format code on the site - the red speech bubble logo will automatically format T-SQL for you. The original code box is still there for XML, etc. More details here.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x378
x117
x106

asked: Feb 22, 2010 at 11:30 AM

Seen: 1487 times

Last Updated: Feb 22, 2010 at 11:30 AM