Database mail issue "Message: The read on the database failed"
来源:互联网 发布:php前景 知乎 编辑:程序博客网 时间:2024/04/28 02:53
今天遇到一个很棘手的问题:database mail无法启动。database mail服务在windows中对应的进程名是DatabaseMail.exe。
使用sysmail_start_sp启动database mail后很快自动shut down. 错误是:
Exception Type: Microsoft.SqlServer.Management.SqlIMail.Server.Common.BaseException
Message: The read on the database failed. Reason: The error description is 'Whitespace is not allowed at this location.'.
Data: System.Collections.ListDictionaryInternal
TargetSite: Microsoft.SqlServer.Management.SqlIMail.Server.Objects.QueueItem GetQueueItemFromCommand(System.Data.SqlClient.SqlCommand)
HelpLink: NULL
Source: DatabaseMailEngine
Google了一会儿,有人说是因为已发送的mail中的一些字段非法导致的(例如邮件接收者为空)。一旦启动database mail,它会自动尝试再次发送email,然后由于失败shut down。解决方法是使用sysmail_delete_mailitems_sp删除在系统表sysmail_allitems中保存的未发送的邮件。
我将该表中发送失败的邮件删除后,问题依旧。尽管如此,从报错来看'Whitespace is not allowed at this location.'确实可能是由于某个邮件有问题导致的,但该邮件并不在sysmail_allitems中。应该有另外一个queue保存发送的邮件。另外我发现该系统表中的数据明显少,有一些发送成功的mail并没有被记录在该表中。从而进一步肯定有另外的mail queue存在。
于是使用profiler跟踪数据库在发送邮件时的动作。找到了如下的报错:
2014-06-05 21:37:28.61 spid25s An error occurred in Service Broker internal activation while trying to scan the user queue 'msdb.dbo.ExternalMailQueue' for its status. Error: 1222, State: 56. Lock request time out period exceeded. This is an informational message only. No user action is required.
ExternalMailQueue很可疑。
Google了ExternalMailQueue后找到以下网页:
http://blogs.msdn.com/b/sqlserverfaq/archive/2010/03/18/database-mail-failing-with-the-service-queue-externalmailqueue-is-currently-disabled-message.aspx
大家自己看吧,解决方法就是删除该queue中的数据。
- Database mail issue "Message: The read on the database failed"
- Fixed the issue: alias database /etc/mail/aliases.db out of date
- solution:Failed to update database "XXX.MDF" because the database is read-only.
- The database cluster initialisation failed
- postgreps:The database cluster initialisation failed
- SQL Server 2014 Installation Error - Wait on the Database Engine Recovery Handle Failed
- MyEclipse: The Table cannot be found on the database
- The Table cannot be found on the database解决方法
- MyEclipse Error: The Table cannot be found on the database
- MyEclipse Error: The Table cannot be found on the database
- Issue: Server principal is not able to access the database under the current security context
- Service Broker message delivery is not enabled in this database. Use the ALTER DATABASE statement to
- Install the database vault
- The logical standby database
- normalizing the database.
- Clear the database log
- THE MNIST DATABASE
- Analyzing the Database Buffer
- 编译过程路径总结
- 美哈佛大学图书馆证实发现首本人皮书
- bug解决记录——2014/6/6
- 浅析中小型电商邮件营销策略
- JAVA中IO流简介及子类体系
- Database mail issue "Message: The read on the database failed"
- 橱窗位作用
- easyUI tree 和构造tree 后台是一样的。
- 对于结构体变量赋值的误区
- boost.asio的跨平台实现 <转>
- VC++添加菜单栏
- HDU 1253 胜利大逃亡
- linux常用命令详解
- Java 调用 C/C++ 之 JNA 系列实战篇 —— 输入wchar_t* (二)