Click here to monitor SSC

Rodney

SQL Server Secret Agent Holds its Secret as to Why It Won't Start

Published Thursday, March 01, 2007 10:22 PM

SQL Server Agent and SQL Mail for SQL 2000 Server requires a MAPI client (out of the box) to begin with -- a simple, yet unavoidable fact. MAPI, for those who like to time travel is the Messaging Application Programming Interface. To send notifications with SQL 2000, say when a SQL Server (Secret) Agent job fails,  the service account must have access to a MAPI client, or a mail profile to be precise. The mail profile is created with a MAPI client (Outlook or Outlook Express). MAPI, which is an MS beast that adheres to the "Embrace, extend and exterminate" practice of developing proprietary code. I won't go into that further but will say, MAPI, like TAPI (Telephony Application Programming Interface) and SAPI (Speech fill out the rest) is something that will not lay over and die.  Thankfully SQL Server 2005 embraces a fully compliant SMTP interface in Database Mail (death to SQL Mail). At any rate, inheritance being what it is, the marriage of the SQL Server Agent and MAPI was one that brought a bit of frustration today. If you ever stop and attempt to restart the SQL Server Agent to get the notifactions to work (especially on Windows 2000) beware.  And I would recommend to not set the SQLServerAgent service to restart if it stops unexpectedly.

I say all of this because today I could not start the SQL Agent Service at all. It timed out every time, could not / would not with a house, start. I used "SQLServerAgent -c -v "to try start is outside of the service and recieved an error regarding a failed login to the MAPI client. I had to use Task Manager to KILL the sqlagent process many times.  Service account was good, with all permissions to log files and registry. Rebuilding the profile and "ugg" Personal Folders for the mail profile did nothing.

So...is it true..dare I say..dare I? When in doubt...reboo...

no I can't say it.

But alas, a scheduled reboot cured ALL ails. Sql Server Secret Agent started as if it had not pissed me off all afternoon with it's inability to fire off from Service Manger, Enterprise Manager and command line.

Here is my advice if you find yourself with a Windows 2000 \ SQL Server 2000 \ SQL Server Agent that will not start. Tell your IT team (assuming you are not the IT team) you need to schedule a reboot for late in the evening, go home, get a glass of wine or a 6 pack and wait for the expected success after said reboot.  Don't waste time, as I did, dorking around with MAPI, registry, file permissions, log files, event logs, SQL Server logs, RDP, and command lines. Get the Hell out and look for the power button.

by Rodney

Comments

 

David R Buckingham said:

It won't succeed until you can clear out all the MAPI32.EXE processes.  If SQL Server has not made use of MAPI (and only SQL Server Agent service), then you should be able to kill any/all of them through Task Manager.  However, if SQL Server has accessed the MAPI interface, then you will at minimum have to stop the SQL Server service, then kill all the MAPI32.EXE processes.

Once they're all dead, the SQL Server and SQL Server Agent services should start up clean and notifications will flow as expected.  It was for that reason I stopped using SQL Mail from SQL Server and only used it from SQL Server Agent --- so that I could just stop the Agent service, kill the MAPI32.EXE processes, and restart the Agent service --- without having to stop/start the SQL Server service and incur downtime.

For sending mail from SQL Server, I made use of a 3rd party extended stored procedure that was a pure SMTP solution (however, it did not work with SQL Server Agent of course).
March 2, 2007 1:03 PM
 

blackberry download free ringtones said:

As a summary of <a href=http://www.genebase.com/node/P3905073/blogIndex.php?blogId=156416>100 free mobile ringtones virgin</a> <a href=http://taletta6186.blogr.com/stories/8022298/>free nokia 1100 ringtones</a>
February 4, 2008 12:06 PM
 

free i730 motorola nextel ringtones said:

Any kind of <a href=http://taletta6186.blogr.com/stories/8022308/>complimentary music real ringtones</a> <a href=http://taletta6186.blogr.com/stories/8022316/>free ringtones maker software</a>
February 4, 2008 12:33 PM
 

Howe’s Bayou » Blog Archive » SQL Server Agent Won’t restart said:

December 15, 2008 8:24 AM
 

Maa421 said:

I read this while suffering with a mysterious SQL Server Agent refusal to restart. It gave me a well-needed laugh. Thanks for the great suggestions. I have planned a reboot.
March 10, 2009 1:24 PM
 

Metro Radiator Transmission Oil Cooler Strut Assembly, Portland Part Metro Area said:

May 20, 2010 2:23 PM
 

Headlight Passenger 2002 Chrysler Sebring Catalytic Converter, 1997 Sebring Sale said:

May 20, 2010 8:09 PM
 

Fx500 Headlight Mitsubishi Mirage, Fx500 Headlight Mitsubishi Mirage said:

May 20, 2010 10:37 PM
 

Swift Theater Concert Tickets, Swift Mt 17 said:

May 21, 2010 1:19 AM
 

1995 Sephia Mpg Kia Spectra5, Working Kia Sephia Heater said:

May 21, 2010 2:26 AM
 

Used Xterra Maine Nissan Murano, 2004 Nissan Murano Engine Problems said:

May 21, 2010 2:42 AM
You need to sign in to comment on this blog
Latest articles
Backups, What Are They Good For?
 We've heard the confessional story from Pixar that Toy Story 2 was almost lost due to a bad backup, but... Read more...

C# Async: What is it, and how does it work?
 The biggest new feature in C#5 is Async, and its associated Await (contextual) keyword. Anybody who is... Read more...

Handling Deadlocks in SQL Server
 In this excerpt from his book Troubleshooting SQL Server: A Guide for the Accidental DBA, Jonathan... Read more...

SQL VIEW Basics
 SQL Views are essential for the database developer. However, it is common to see them misued, or... Read more...

The PoSh DBA: Grown-Up PowerShell Functions
 Laerte goes step-by-step through the process of tidying up and making more reusable an untidy... Read more...