• Welsh Corgi (4/2/2012)


    SELECT *

    FROM sysmail_event_log

    Nothing but start & stop DB Mail

    SELECT *

    FROM sysmail_allitems

    I found the items were listed as failed.

    So I check the Windows Event Log and I have the following:

    1) Exception Information

    ===================

    Exception Type: System.TypeInitializationException

    TypeName: System.Data.SqlClient.SqlConnection

    Message: The type initializer for 'System.Data.SqlClient.SqlConnection' threw an exception.

    Data: System.Collections.ListDictionaryInternal

    TargetSite: Void .ctor(System.String)

    HelpLink: NULL

    Source: System.Data

    StackTrace Information

    ===================

    at System.Data.SqlClient.SqlConnection..ctor(String connectionString)

    at Microsoft.SqlServer.Management.Common.SqlConnectionInfo.CreateConnectionObject()

    at Microsoft.SqlServer.Management.SqlIMail.Server.DataAccess.ConnectionManager.OpenConnection(SqlConnectionInfo ci)

    at Microsoft.SqlServer.Management.SqlIMail.Server.DataAccess.DataAccessAdapter.OpenConnection(String dbServerName, String dbName, String userName, String password)

    at Microsoft.SqlServer.Management.SqlIMail.IMailProcess.QueueItemProcesser.ProcessQueueItems(String dbName, String dbServerName, Int32 lifetimeMinimumSec, LogLevel loggingLevel)

    2) Exception Information

    ===================

    Exception Type: System.TypeInitializationException

    TypeName: System.Data.SqlClient.SqlConnectionFactory

    Message: The type initializer for 'System.Data.SqlClient.SqlConnectionFactory' threw an exception.

    Data: System.Collections.ListDictionaryInternal

    TargetSite: Void .cctor()

    HelpLink: NULL

    Source: System.Data

    StackTrace Information

    ===================

    at System.Data.SqlClient.SqlConnection..cctor()

    3) Exception Information

    ===================

    Exception Type: System.TypeInitializationException

    TypeName: System.Data.SqlClient.SqlPerformanceCounters

    Message: The type initializer for 'System.Data.SqlClient.SqlPerformanceCounters' threw an exception.

    Data: System.Collections.ListDictionaryInternal

    TargetSite: Void .ctor()

    HelpLink: NULL

    Source: System.Data

    StackTrace Information

    ===================

    at System.Data.SqlClient.SqlConnectionFactory..ctor()

    at System.Data.SqlClient.SqlConnectionFactory..cctor()

    4) Exception Information

    ===================

    Exception Type: System.Configuration.ConfigurationErrorsException

    Message: Configuration system failed to initialize

    BareMessage: Configuration system failed to initialize

    Filename: NULL

    Line: 0

    Errors: System.Configuration.ConfigurationException[]

    Data: System.Collections.ListDictionaryInternal

    TargetSite: Void EnsureInit(System.String)

    HelpLink: NULL

    Source: System.Configuration

    StackTrace Information

    ===================

    at System.Configuration.ClientConfigurationSystem.EnsureInit(String configKey)

    at System.Configuration.ClientConfigurationSystem.PrepareClientConfigSystem(String sectionName)

    at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(String sectionName)

    at System.Configuration.ConfigurationManager.GetSection(String sectionName)

    at System.Configuration.PrivilegedConfigurationManager.GetSection(String sectionName)

    at System.Diagnostics.DiagnosticsConfiguration.Initialize()

    at System.Diagnostics.Switch.InitializeConfigSettings()

    at System.Diagnostics.Switch.InitializeWithStatus()

    at System.Diagnostics.Switch.get_SwitchSetting()

    at System.Data.ProviderBase.DbConnectionPoolCounters..ctor(String categoryName, String categoryHelp)

    at System.Data.SqlClient.SqlPerformanceCounters..ctor()

    at System.Data.SqlClient.SqlPerformanceCounters..cctor()

    5) Exception Information

    ===================

    Exception Type: System.Configuration.ConfigurationErrorsException

    Message: An error occurred loading a configuration file: Access to the path 'C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Config\machine.config' is denied. (C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Config\machine.config)

    BareMessage: An error occurred loading a configuration file: Access to the path 'C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Config\machine.config' is denied.

    Filename: C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Config\machine.config

    Line: 0

    Errors: System.Configuration.ConfigurationException[]

    Data: System.Collections.ListDictionaryInternal

    TargetSite: Void ThrowIfErrors(Boolean)

    HelpLink: NULL

    Source: System.Configuration

    StackTrace Information

    ===================

    at System.Configuration.ConfigurationSchemaErrors.ThrowIfErrors(Boolean ignoreLocal)

    at System.Configuration.BaseConfigurationRecord.ThrowIfInitErrors()

    at System.Configuration.ClientConfigurationSystem.EnsureInit(String configKey)

    6) Exception Information

    ===================

    Exception Type: System.UnauthorizedAccessException

    Message: Access to the path 'C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Config\machine.config' is denied.

    Data: System.Collections.ListDictionaryInternal

    TargetSite: Void WinIOError(Int32, System.String)

    HelpLink: NULL

    Source: mscorlib

    StackTrace Information

    ===================

    at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)

    at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)

    at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy)

    at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)

    at System.Configuration.Internal.InternalConfigHost.StaticOpenStreamForRead(String streamName)

    at System.Configuration.Internal.InternalConfigHost.System.Configuration.Internal.IInternalConfigHost.OpenStreamForRead(String streamName, Boolean assertPermissions)

    at System.Configuration.Internal.InternalConfigHost.System.Configuration.Internal.IInternalConfigHost.OpenStreamForRead(String streamName)

    at System.Configuration.ClientConfigurationHost.OpenStreamForRead(String streamName)

    1) Exception Information =================== Exception Type: System.TypeInitializationException TypeName: System.Data.SqlClient.SqlConnection Message: The type initializer for 'System.Data.SqlClient.SqlConnection' threw an exception. Data: System.Collections.ListDictionaryInternal TargetSite: Void .ctor(System.String) HelpLink: NULL Source: System.Data StackTrace Information =================== at System.Data.SqlClient.SqlConnection..ctor(String connectionString) at Microsoft.SqlServer.Management.Common.SqlConnectionInfo.CreateConnectionObject() at Microsoft.SqlServer.Management.SqlIMail.Server.DataAccess.ConnectionManager.OpenConnection(SqlConnectionInfo ci) at Microsoft.SqlServer.Management.SqlIMail.Server.DataAccess.DataAccessAdapter.OpenConnection(String dbServerName, String dbName, String userName, String password) at Microsoft.SqlServer.Management.SqlIMail.IMailProcess.QueueItemProcesser.ProcessQueueItems(String dbName, String dbServerName, Int32 lifetimeMinimumSec, LogLevel loggingLevel) 2) Exception Information =================== Exception Type: System.TypeInitializationException TypeName: System.Data.SqlClient.SqlConnectionFactory Message: The type initializer for 'System.Data.SqlClient.SqlConnectionFactory' threw an exception. Data: System.Collections.ListDictionaryInternal TargetSite: Void .cctor() HelpLink: NULL Source: System.Data StackTrace Information =================== at System.Data.SqlClient.SqlConnection..cctor() 3) Exception Information =================== Exception Type: System.TypeInitializationException TypeName: System.Data.SqlClient.SqlPerformanceCounters Message: The type initializer for 'System.Data.SqlClient.SqlPerformanceCounters' threw an exception. Data: System.Collections.ListDictionaryInternal TargetSite: Void .ctor() HelpLink: NULL Source: System.Data StackTrace Information =================== at System.Data.SqlClient.SqlConnectionFactory..ctor() at System.Data.SqlClient.SqlConnectionFactory..cctor() 4) Exception Information =================== Exception Type: System.Configuration.ConfigurationErrorsException Message: Configuration system failed to initialize BareMessage: Configuration system failed to initialize Filename: NULL Line: 0 Errors: System.Configuration.ConfigurationException[] Data: System.Collections.ListDictionaryInternal TargetSite: Void EnsureInit(System.String) HelpLink: NULL Source: System.Configuration StackTrace Information =================== at System.Configuration.ClientConfigurationSystem.EnsureInit(String configKey) at System.Configuration.ClientConfigurationSystem.PrepareClientConfigSystem(String sectionName) at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(String sectionName) at System.Configuration.ConfigurationManager.GetSection(String sectionName) at System.Configuration.PrivilegedConfigurationManager.GetSection(String sectionName) at System.Diagnostics.DiagnosticsConfiguration.Initialize() at System.Diagnostics.Switch.InitializeConfigSettings() at System.Diagnostics.Switch.InitializeWithStatus() at System.Diagnostics.Switch.get_SwitchSetting() at System.Data.ProviderBase.DbConnectionPoolCounters..ctor(String categoryName, String categoryHelp) at System.Data.SqlClient.SqlPerformanceCounters..ctor() at System.Data.SqlClient.SqlPerformanceCounters..cctor() 5) Exception Information =================== Exception Type: System.Configuration.ConfigurationErrorsException Message: An error occurred loading a configuration file: Access to the path 'C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Config\machine.config' is denied. (C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Config\machine.config) BareMessage: An error occurred loading a configuration file: Access to the path 'C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Config\machine.config' is denied. Filename: C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Config\machine.config Line: 0 Errors: System.Configuration.ConfigurationException[] Data: System.Collections.ListDictionaryInternal TargetSite: Void ThrowIfErrors(Boolean) HelpLink: NULL Source: System.Configuration StackTrace Information =================== at System.Configuration.ConfigurationSchemaErrors.ThrowIfErrors(Boolean ignoreLocal) at System.Configuration.BaseConfigurationRecord.ThrowIfInitErrors() at System.Configuration.ClientConfigurationSystem.EnsureInit(String configKey) 6) Exception Information =================== Exception Type: System.UnauthorizedAccessException Message: Access to the path 'C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Config\machine.config' is denied. Data: System.Collections.ListDictionaryInternal TargetSite: Void WinIOError(Int32, System.String) HelpLink: NULL Source: mscorlib StackTrace Information =================== at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share) at System.Configuration.Internal.InternalConfigHost.StaticOpenStreamForRead(String streamName) at System.Configuration.Internal.InternalConfigHost.System.Configuration.Internal.IInternalConfigHost.OpenStreamForRead(String streamName, Boolean assertPermissions) at System.Configuration.Internal.InternalConfigHost.System.Configuration.Internal.IInternalConfigHost.OpenStreamForRead(String streamName) at System.Configuration.ClientConfigurationHost.OpenStreamForRead(String streamName) at System.Configuration.BaseConfigurationRecord.InitConfigFromFile()

    OMG, it looks like permissions.:crying:

    IMHO, the source of the Database mail problem is embeded in the Windows Application Event Log error that I posted above.

    For better, quicker answers on T-SQL questions, click on the following...
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    For better answers on performance questions, click on the following...
    http://www.sqlservercentral.com/articles/SQLServerCentral/66909/