Showing posts with label linked. Show all posts
Showing posts with label linked. Show all posts

Friday, February 24, 2012

Database Mail and Linked Servers

We have a stored procedure that executes sp_send_dbmail with an @.query parameter. The @. query executes a stored procedures that has a linked server query in it. The linked server is SQL 2000. The login/user used by the link is valid and running the sproc by itself will return the expected results but it fails with the following error if run by the sp_send_dbmail sproc:

Warning: Null value is eliminated by an aggregate or other SET operation.

Msg 14661, Level 16, State 1, Procedure sp_send_dbmail, Line 476

Query execution failed: OLE DB provider "SQLNCLI" for linked server "Link_Server" returned message "Communication link failure".

HResult 0x2746, Level 16, State 1

TCP Provider: An existing connection was forcibly closed by the remote host.

HResult 0x4818, Level 14, State 1

Login failed for user 'EPC'.

Msg 0, Level 11, State 0, Line 0

A severe error occurred on the current command. The results, if any, should be discarded.

Any help will be greatly appreciated.

What selection are you using under the security option for the Linked Server setup in SQL Server Management?|||use logins' current security conttext. The user id and password are the same on both servers.|||

I started to get the same message as you, the first part that is: (I'm not using linked servers). So I don't know if this will help you or not.

Warning: Null value is eliminated by an aggregate or other SET operation.

Msg 14661, Level 16, State 1, Procedure sp_send_dbmail, Line 476

This site was helpful to me.

http://forums.databasejournal.com/archive/index.php/t-42981.html

Apparently, the problem is with the SET QUOTED_IDENTIFIER. I applied his logic to my script and now it seems to be working. I also needed to stop and start dbmail to release the queue. I don't know why but it gets clogged. I have begun to put the stop and start near the beginning of all my scripts.

--These two lines will release any emails "clogged" in SS queue

EXEC msdb.dbo.sysmail_stop_sp;

EXEC msdb.dbo.sysmail_start_sp;

--new logic begin

SETQUOTED_IDENTIFIEROFF

set @.myqry ='SET QUOTED_IDENTIFIER ON '

set @.myqry = @.myqry +char(13)

--new logic end

set @.myqry = @.myqry

+'

SELECT * FROM PPI_Reporting.DBRS.HpSyncCompareInvDate'

EXECUTE msdb.dbo.sp_send_dbmail @.profile_name=@.profile, @.recipients=@.recipients, @.importance='Normal'

,@.subject=@.subject, @.body=@.body

,@.query=@.myqry

GO

|||I don't know how it affects the login failure but it is a linked server afterall The sproc currently set nocount and ansi_warnings so we'll give quoted_identifiers a try. Thanks for the suggestion.|||

I'm sorry, but my solution only worked for about 10 times yesterday and then no longer works. I was excited to see it work after adding the SET QUOTED_IDENTIFIER statement so I posted here.

So I am back to square one. Let us know if you find a solution.

-Doug

|||See this http://sqlserver-qa.net/blogs/tools/archive/2007/04/20/tcp-provider-an-existing-connection-was-forcibly-closed-by-the-remote-host.aspx is any help.|||I appreciate the responses but none of them quite fit the issue. We found a workaround and have the sprocs running now. Rather than returning the output of the called sproc to the calling sproc, the data is inserted in a table and the calling sproc now queries the table.

Tuesday, February 14, 2012

Database Link supported with Oracle 9i?

I'm getting ready to link my SQL Server 2000 database to my legacy Oracle 9i
database via linked server and I was wondering if Microsoft supported such a
configuration.
tks
kmcclare@.hotmail.com
Yes, you can access Oracle from SQL Server via a linked server, provided you
have the required oracle drives (SQL*Net I believe) installed on the SQL
Server box. SQL Server Books Online has examples. See sp_addlinkedserver and
sp_addlinkedsrvlogin in SQL Server Books Online.
HTH,
Vyas, MVP (SQL Server)
http://vyaskn.tripod.com/
Is .NET important for a database professional?
http://vyaskn.tripod.com/poll.htm
"Ken McClaren" <kmcclare@.hotmail.com> wrote in message
news:e$FC1CmbEHA.904@.TK2MSFTNGP09.phx.gbl...
I'm getting ready to link my SQL Server 2000 database to my legacy Oracle 9i
database via linked server and I was wondering if Microsoft supported such a
configuration.
tks
kmcclare@.hotmail.com
|||These KB articles might help you incase you run into any issues.
Q280106 HOW TO: Set Up and Troubleshoot a Linked Server to Oracle in SQL
Q259959 INFO: Steps to Debug Connectivity Issues to an Oracle Server
Cheers,
Vikram Jayaram
Microsoft, SQL Server
This posting is provided "AS IS" with no warranties, and confers no rights.
Subscribe to MSDN & use http://msdn.microsoft.com/newsgroups.
|||I've had a number of problems upgrading from 8i to 9i and in the end
I've stayed with the 8i client on the sql server and that works
perfectly. I'm sure I read somewhere that 9i hasn't been fully tested by
MS, although I might have dreamt that!
g.
http://www.sqlskunkworks.com
*** Sent via Developersdex http://www.codecomments.com ***
Don't just participate in USENET...get rewarded for it!

Database Link supported with Oracle 9i?

I'm getting ready to link my SQL Server 2000 database to my legacy Oracle 9i
database via linked server and I was wondering if Microsoft supported such a
configuration.
tks
kmcclare@.hotmail.comYes, you can access Oracle from SQL Server via a linked server, provided you
have the required oracle drives (SQL*Net I believe) installed on the SQL
Server box. SQL Server Books Online has examples. See sp_addlinkedserver and
sp_addlinkedsrvlogin in SQL Server Books Online.
--
HTH,
Vyas, MVP (SQL Server)
http://vyaskn.tripod.com/
Is .NET important for a database professional?
http://vyaskn.tripod.com/poll.htm
"Ken McClaren" <kmcclare@.hotmail.com> wrote in message
news:e$FC1CmbEHA.904@.TK2MSFTNGP09.phx.gbl...
I'm getting ready to link my SQL Server 2000 database to my legacy Oracle 9i
database via linked server and I was wondering if Microsoft supported such a
configuration.
tks
kmcclare@.hotmail.com|||These KB articles might help you incase you run into any issues.
Q280106 HOW TO: Set Up and Troubleshoot a Linked Server to Oracle in SQL
Q259959 INFO: Steps to Debug Connectivity Issues to an Oracle Server
Cheers,
Vikram Jayaram
Microsoft, SQL Server
This posting is provided "AS IS" with no warranties, and confers no rights.
Subscribe to MSDN & use http://msdn.microsoft.com/newsgroups.|||I've had a number of problems upgrading from 8i to 9i and in the end
I've stayed with the 8i client on the sql server and that works
perfectly. I'm sure I read somewhere that 9i hasn't been fully tested by
MS, although I might have dreamt that!
g.
http://www.sqlskunkworks.com
*** Sent via Developersdex http://www.codecomments.com ***
Don't just participate in USENET...get rewarded for it!