?
Solved

Problem with using Databasemail with SQL Server 2005

Posted on 2012-04-07
15
Medium Priority
?
871 Views
Last Modified: 2012-04-21
Hello,
I want to use databasemail to send automatic reports.
So I run Databasemail Configuration Wizar, after few minutes everything was complete.
Then I send test mail from SQL Server 2005, nothing happens.

From computer where is installed SQL Server 2005 i can telnet to smtp without any problems. Everything seems to be ok.

On developing server where is installed SQL Server 2008R2 i configure exactly same parameters like on SQL Server 2005. On develop server databasemail works fine.


In the end i lookup for errors in EventViewer and i found 2 errors:

FIRST

Event Type:      Error
Event Source:      DatabaseMail
Event Category:      None
Event ID:      0
Date:            2012-04-06
Time:            14:18:03
User:            N/A
Computer:      HADRON
Description:


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: Unrecognized configuration section system.serviceModel. (C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\Config\machine.config line 134)
BareMessage: Unrecognized configuration section system.serviceModel.
Filename: C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\Config\machine.config
Line: 134
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)

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.


SECOND

Event Type:      Error
Event Source:      .NET Runtime 2.0 Error Reporting
Event Category:      None
Event ID:      5000
Date:            2012-04-06
Time:            14:18:04
User:            N/A
Computer:      HADRON
Description:
EventType clr20r3, P1 databasemail90.exe, P2 9.0.242.0, P3 4d0276ad, P4 system, P5 2.0.0.0, P6 4ea7901b, P7 5a2, P8 7, P9 system.typeinitialization, P10 NIL.

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
Data:
0000: 63 00 6c 00 72 00 32 00   c.l.r.2.
0008: 30 00 72 00 33 00 2c 00   0.r.3.,.
0010: 20 00 64 00 61 00 74 00    .d.a.t.
0018: 61 00 62 00 61 00 73 00   a.b.a.s.
0020: 65 00 6d 00 61 00 69 00   e.m.a.i.
0028: 6c 00 39 00 30 00 2e 00   l.9.0...
0030: 65 00 78 00 65 00 2c 00   e.x.e.,.
0038: 20 00 39 00 2e 00 30 00    .9...0.
0040: 2e 00 32 00 34 00 32 00   ..2.4.2.
0048: 2e 00 30 00 2c 00 20 00   ..0.,. .
0050: 34 00 64 00 30 00 32 00   4.d.0.2.
0058: 37 00 36 00 61 00 64 00   7.6.a.d.
0060: 2c 00 20 00 73 00 79 00   ,. .s.y.
0068: 73 00 74 00 65 00 6d 00   s.t.e.m.
0070: 2c 00 20 00 32 00 2e 00   ,. .2...
0078: 30 00 2e 00 30 00 2e 00   0...0...
0080: 30 00 2c 00 20 00 34 00   0.,. .4.
0088: 65 00 61 00 37 00 39 00   e.a.7.9.
0090: 30 00 31 00 62 00 2c 00   0.1.b.,.
0098: 20 00 35 00 61 00 32 00    .5.a.2.
00a0: 2c 00 20 00 37 00 2c 00   ,. .7.,.
00a8: 20 00 73 00 79 00 73 00    .s.y.s.
00b0: 74 00 65 00 6d 00 2e 00   t.e.m...
00b8: 74 00 79 00 70 00 65 00   t.y.p.e.
00c0: 69 00 6e 00 69 00 74 00   i.n.i.t.
00c8: 69 00 61 00 6c 00 69 00   i.a.l.i.
00d0: 7a 00 61 00 74 00 69 00   z.a.t.i.
00d8: 6f 00 6e 00 20 00 4e 00   o.n. .N.
00e0: 49 00 4c 00 0d 00 0a 00   I.L.....

When i run manually databasemail90.exe, then in the EventViewer came out same errors.

Configuration:
Windows Server 2003 x64 with updates
SQL Server 2005 x64 with updates


How handle this problem ?

Thanks in advance.
0
Comment
Question by:jposp
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 7
15 Comments
 
LVL 17

Expert Comment

by:Anuroopsundd
ID: 37818577
can you kill the databasemail executable on the server and then try again.
0
 

Author Comment

by:jposp
ID: 37818586
@Anuroopsundd - yesterday i restarted server, so i think this is equal to re-run databasemail executable;

EDIT:
i checkout windows process and there was no databasemail process
0
 
LVL 17

Expert Comment

by:Anuroopsundd
ID: 37818587
Yes, restart do the stuff.
by any chance can you reinstall the latest Service pack for sql ?
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
LVL 17

Expert Comment

by:Anuroopsundd
ID: 37818594
That's right..
0
 

Author Comment

by:jposp
ID: 37818782
@Anuroopsundd - i try to reinstall SP4, but i can't update database services beacause it is up-to-date
0
 
LVL 17

Expert Comment

by:Anuroopsundd
ID: 37818810
To use this wizard you must be a member of the sysadmin fixed server role. To send Database Mail you must be a member of the DatabaseMailUserRole database role in the msdb database.

Note:  
Enabling SQL Server Service Broker in any database requires a database lock. If Service Broker was deactivated in msdb, to enable Database Mail, first stop SQL Server Agent so Service Broker can obtain the necessary lock.

http://msdn.microsoft.com/en-us/library/ms175951(v=sql.90).aspx
0
 

Author Comment

by:jposp
ID: 37818828
I configure database mail like in sqlserverclub.com, i don't think is problem with config.

I troubleshoot with:
http://msdn.microsoft.com/en-us/library/ms187540(v=sql.90).aspx
and seems to be ok, except the fact, that mail are still in queue.
0
 
LVL 17

Expert Comment

by:Anuroopsundd
ID: 37818835
so you are seeing the mail in outlook queue.?
0
 
LVL 17

Expert Comment

by:Anuroopsundd
ID: 37818836
were you able to test account setting in outlook?
0
 

Author Comment

by:jposp
ID: 37836361
I'm back :)

So i didn't install Outlook on server. But I test that account setting in Outlook and in development SQL Server 2008R2 and it works fine.
0
 

Author Comment

by:jposp
ID: 37850638
In SQL Server Agent Log i found this:


[260] Unable to start mail session (reason: System.TypeInitializationException: The type initializer for 'System.Data.SqlClient.SqlConnection' threw an exception. ---> System.TypeInitializationException: The type initializer for 'System.Data.SqlClient.SqlConnectionFactory' threw an exception. ---> System.TypeInitializationException: The type initializer for 'System.Data.SqlClient.SqlPerformanceCounters' threw an exception. ---> System.Configuration.ConfigurationErrorsException: Configuration system failed to initialize ---> System.Configuration.Confi)



SQL Surface Area Configuration - exception when chosen Features
And this is my machine.config serviceModel section:


<system.serviceModel>
    <extensions>
      <behaviorExtensions>
        <add name="persistenceProvider" type="System.ServiceModel.Configuration.PersistenceProviderElement, System.WorkflowServices, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
        <add name="workflowRuntime" type="System.ServiceModel.Configuration.WorkflowRuntimeElement, System.WorkflowServices, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
        <add name="enableWebScript" type="System.ServiceModel.Configuration.WebScriptEnablingElement, System.ServiceModel.Web, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
        <add name="webHttp" type="System.ServiceModel.Configuration.WebHttpElement, System.ServiceModel.Web, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
      </behaviorExtensions>
      <bindingElementExtensions>
        <add name="webMessageEncoding" type="System.ServiceModel.Configuration.WebMessageEncodingElement, System.ServiceModel.Web, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
        <add name="context" type="System.ServiceModel.Configuration.ContextBindingElementExtensionElement, System.WorkflowServices, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
      </bindingElementExtensions>
      <bindingExtensions>
        <add name="wsHttpContextBinding" type="System.ServiceModel.Configuration.WSHttpContextBindingCollectionElement, System.WorkflowServices, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
        <add name="netTcpContextBinding" type="System.ServiceModel.Configuration.NetTcpContextBindingCollectionElement, System.WorkflowServices, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
        <add name="webHttpBinding" type="System.ServiceModel.Configuration.WebHttpBindingCollectionElement, System.ServiceModel.Web, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
        <add name="basicHttpContextBinding" type="System.ServiceModel.Configuration.BasicHttpContextBindingCollectionElement, System.WorkflowServices, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
      </bindingExtensions>
    </extensions>
    <client>
      <metadata>
        <policyImporters>
          <extension type="System.ServiceModel.Channels.ContextBindingElementImporter, system.workflowservices, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"/>
        </policyImporters>
        <wsdlImporters>
          <extension type="System.ServiceModel.Channels.ContextBindingElementImporter, system.workflowservices, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"/>
        </wsdlImporters>
      </metadata>
    </client>
  </system.serviceModel>
0
 

Accepted Solution

by:
jposp earned 0 total points
ID: 37850906
I'm resolved problem.
I've used http://blogs.msdn.com/b/joy/archive/2008/07/22/how-to-use-microsoft-net-framework-cleanup-utility.aspx and then reinstall .NET Framework 2.0, now everything works :)
0
 

Author Closing Comment

by:jposp
ID: 37875016
There was a problem with machine.config, probably it was corrupted, after reinstall .net framework works ok
0

Featured Post

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are some very powerful Dynamic Management Views (DMV's) introduced with SQL 2005. The two in particular that we are going to discuss are sys.dm_db_index_usage_stats and sys.dm_db_index_operational_stats.   Recently, I was involved in a di…
When writing XML code a very difficult part is when we like to remove all the elements or attributes from the XML that have no data. I would like to share a set of recursive MSSQL stored procedures that I have made to remove those elements from …
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question