Vin*_*vel 5 sql-server database-mail sql-server-2014
我已经在 INSTANCE1 和 INSTANCE2 中配置了数据库邮件。每当我尝试使用以下代码发送邮件时,我都会在 INSTANCE1 中得到“邮件排队”的输出。
EXEC msdb.dbo.sp_send_dbmail
@profile_name = 'Vinesh',
@recipients = 'VineshSenthilvel@gmail.com',
@body = 'The stored procedure finished successfully.',
@subject = 'Automated Success Message - Default' ;
Run Code Online (Sandbox Code Playgroud)
但是邮件没有发送到我的邮箱。我尝试在 INSTANCE2 中执行上述查询,邮件已送达。我已经验证数据库邮件配置在这两个实例中似乎都是完美的。
我可以在数据库邮件日志中找到数据库邮件进程正在关闭。还发现了下面提到的错误。
1) Exception Information
===================
Exception Type: Microsoft.SqlServer.Management.SqlIMail.Server.Common.BaseException
Message: The Transaction not longer valid.
Data: System.Collections.ListDictionaryInternal
TargetSite: Void ValidateConnectionAndTransaction()
HelpLink: NULL
Source: DatabaseMailEngine
StackTrace Information
===================
at Microsoft.SqlServer.Management.SqlIMail.Server.DataAccess.ConnectionManager.ValidateConnectionAndTransaction()
at Microsoft.SqlServer.Management.SqlIMail.Server.DataAccess.ConnectionManager.RollbackTransaction()
at Microsoft.SqlServer.Management.SqlIMail.IMailProcess.QueueItemProcesser.GetDataFromQueue(DataAccessAdapter da, Int32 lifetimeMinimumSec)
at Microsoft.SqlServer.Management.SqlIMail.IMailProcess.QueueItemProcesser.ProcessQueueItems(String dbName, String dbServerName, Int32 lifetimeMinimumSec, LogLevel loggingLevel, Byte[] encryptionKey, Int32 connectionTimeout)
Run Code Online (Sandbox Code Playgroud)
有什么解决办法吗?提前致谢。
小智 2
我遇到了同样的问题,我按照以下步骤解决了该问题。
EXEC msdb.dbo.sysmail_help_queue_sp
并检查长度是否> 0,然后删除队列项目。
使用以下查询删除队列项目:
DECLARE @GETDATE datetime
SET @GETDATE = GETDATE()
EXECUTE msdb.dbo.sysmail_delete_mailitems_sp
@sent_before = @GETDATE;
GO
Run Code Online (Sandbox Code Playgroud)EXEC msdb.dbo.sysmail_start_sp
,启动该过程并检查。
归档时间: |
|
查看次数: |
3971 次 |
最近记录: |