Solved

SSIS: Check for Connection Manager Login Fail

Posted on 2014-04-23
2
560 Views
Last Modified: 2016-02-10
Hi Experts,

I have an SSIS package that runs on task scheduler everyday. The main thing is there is an OLE DB connection manager to an SQL server and it's been set on the server that this password must be updated every 3 months which of course causes a package failure.

Now. Is there a way I can somehow capture a login failure in this connection manager and use the send mail task to mail me when this happens? It's not as easy as using an event handler I don't think anyway...

Thanks,

OS
0
Comment
Question by:onesegun
2 Comments
 
LVL 8

Accepted Solution

by:
ProjectChampion earned 100 total points
ID: 40017468
There are several ways you can audit failed login attempts to SQL Server, but one way which sounds suitable for your specific case is xp_readerrorlog proc; for instance try the following:
DECLARE
  @StartTime DATETIME = GETDATE() - 100
, @EndTime DATETIME = GETDATE();
EXEC sys.xp_readerrorlog 0, 1, N'Login', N'failed', @starttime, @endtime;

You can modify the WHERE clause to filter the result specifically for the particular login that's used by your SSIS package.
Anyhow after detecting the failure you can use sp_send_dbmail or similar to send a notification to yourself.

Alternatively you can be proactive and check the login in the context of a separate job that runs more frequently or ahead of that SSIS package to allow you detect and resolve the problem before it affects your SSIS.

You can also use this method to proactively monitor all failed login attempts for all other logins (be it accidental or malicious) to stay on top of the game.
0
 

Author Closing Comment

by:onesegun
ID: 40020410
Thanks mate! Although it works and I can perhaps try to experiment with a way to pass some variables from the returned results into an SSIS variable and then perhaps use that to trigger a send mail task.

At the moment though I'm unable to execute sproc on the server of interest. Thanks anyway.
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

828 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