Solved

Problem with using Databasemail with SQL Server 2005

Posted on 2012-04-07
15
845 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
  • 8
  • 7
15 Comments
 
LVL 17

Expert Comment

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

Author Comment

by:jposp
Comment Utility
@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
Comment Utility
Yes, restart do the stuff.
by any chance can you reinstall the latest Service pack for sql ?
0
 

Author Comment

by:jposp
Comment Utility
0
 
LVL 17

Expert Comment

by:Anuroopsundd
Comment Utility
That's right..
0
 

Author Comment

by:jposp
Comment Utility
@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
Comment Utility
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 17

Expert Comment

by:Anuroopsundd
Comment Utility
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
Comment Utility
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
Comment Utility
so you are seeing the mail in outlook queue.?
0
 
LVL 17

Expert Comment

by:Anuroopsundd
Comment Utility
were you able to test account setting in outlook?
0
 

Author Comment

by:jposp
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
There was a problem with machine.config, probably it was corrupted, after reinstall .net framework works ok
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Help with SQL joins 9 38
Pivot Query Problem 9 30
Truncate vs Delete 63 87
How can I get this column in my query? 2 28
Recently, when I was asked to create a new SQL 2005 cluster, Microsoft released a new service pack for MS SQL 2005 what is Service Pack 3. When I finished the installation of MS SQL 2005 I found myself troubled why the installation of SP3 failed …
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

772 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now