SQL Server Agent - Job History not being recorded (SQL Server 2005)

I have been trying to get to the bottom of an issue with SQL Server Agent not recording any job history. I am using SQL Server 2005 on a single Windows Server 2008 machine (i.e. no other domain controllers/active directory servers).
The SQL Server Agent service is configured to 'Log On As' NT user account 'sqlagent'. The jobs themselves are executed successfully (all 'Transact-SQL' type steps actually use the 'sa' account) however the there is no actual job history to be found for any
of the jobs -- in the SQL Activity monitor, the 'Last Run Outcome' is always 'Unknown' and the 'Last Run' date is always 'Never' for all jobs; in the SQL Job History Viewer there are no entries for any instances of a job being executed.
The 'sqlagent' NT user account ia a member of the 'Administrators' NT group; the 'Administrators' group appears under Security > Logins on the database server. I have another server that also uses the same setup with a 'sqlagent' NT user account, on that
database server the 'sqlagent' user account appears under Security > Logins and the SQL job history works correctly. I have attempted to add the 'sqlagent' to the Logins on the affected server using the SQL Server Surface Area configuration but this operation
returns an error, detailed below.
Additionally, I have attempted to use the built-in NT system account 'NETWORKSEVICES' to run the SQL Agent Service but this also results in exceptions in the error log and no job history being recorded. The entries in the error logs are very similar to those
from the 'sqlagent' NT user account but instead the user is referred to as 'NT AUTHORITY\ANONYMOUS LOGON' in the error logs, again these are detailed below.
Many thanks in advance for anyone's time and help with this issue!
Arthur
The following errors are raised in SQL Server Agent > Error Logs each time a job is executed:
Date 11/11/2012 18:30:01
Log SQL Agent (Current - 11/11/2012 18:30:00)
Message
[298] SQLServer Error: 18452, Login failed for user ''. The user is not associated with a trusted SQL Server connection. [SQLSTATE 28000]
Date 11/11/2012 18:30:01
Log SQL Agent (Current - 11/11/2012 18:30:00)
Message
[382] Logon to server 'XXXXXXXX' failed (ConnAttemptCachableOp)
If the SQLAgent service is configured to use the NT system account 'NETWORKSERVICE' then the following errors are returned instead:
Date 29/10/2012 18:30:15
Log SQL Agent (Archive #1 - 29/10/2012 18:38:00)
Message
[298] SQLServer Error: 18456, Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'. [SQLSTATE 28000]
Date 29/10/2012 18:30:15
Log SQL Agent (Archive #1 - 29/10/2012 18:38:00)
Message
[382] Logon to server 'XXXXXXXX' failed (ConnAttemptCachableOp)
I have tried granting the 'sqlagent' NT user account with SysAdmin Server Role privaledges using the SQL Server User Provisioning tool in SQL Server Surface Area Configuration, but this always throws the following, similar error:
Login failed for user ''. The user is not associated with a trusted SQL Server connection. (Error: 18452)
===================================
Login failed for user ''. The user is not associated with a trusted SQL Server connection. (.Net SqlClient Data Provider)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=18452&LinkId=20476
Server Name: 127.0.0.1,1344
Error Number: 18452
Severity: 14
State: 1
Line Number: 65536
Program Location:
   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
   at System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK)
   at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject)
   at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart)
   at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)
   at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)
   at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)
   at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)
   at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject)
   at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject)
   at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
   at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
   at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
   at System.Data.SqlClient.SqlConnection.Open()
   at sqlprov.SysAdminServerRole.ProvisionInstance(Instance instance, String userName)
   at sqlprov.ProvisionTask.Provision(Instance instance, String userName)
   at sqlprov.MainForm.ProvisionTasks()

Hi Rama,
Thanks for your reply. I have run the query you specified and can see only one entry with "NTLM" in the auth_scheme column, all of the rest have "SQL". It figures that the entry with "NTLM" is relating to the one NT user account that can successfully log
in to the service (as mentioned in my reply to Nag above, this is the NT user account that installed the service on the machine). I have also executed the same query on the other machine that I mentioned in my original post and this contains two "NTLM" entries,
I'd assume that these relate to the NT user that installed the software and the correctly working "sqlagent" NT user account that is correctly logging the job history on that machine.
I think the problem is very much to do with granting access to new NT user accounts, as per the KB article that you have quoted above. In this case, it is not relating to scenarios 1 or 2 as these relate to SQL Server logins and this issue is about a Windows
Authentication login. As I mentioned to Nag above, I am unable to grant any NT user accounts with access to the service however the NT accounts are all defined locally on the same machine as the SQL server is installed (i.e. there is no domain controller,
active directory controller, etc) so I don't understand how the Windows login cannot be verified.
Any further advice on the issue would be greatly appreciated, please let me know if there is any more information I can provide to help diagnose the problem.
Many thanks!
Arthur

Similar Messages

  • Excel Import Fails in SQL Server Agent Job but not when executed in BIDS

    We have a SQL Server agent job that has ran successfully for the past 6 months.  It started failing about a week ago.  I don't believe anyone installed anything on the server.  The proxy account used to run the job is an admin on the server.   
    I've tried everything I can think of or that I found on searches.  I even changed the connection manager from an Excel source to using an Microsoft office 12.0 Access Database Engine OLEDB connection and it still runs in BIDs and not as an agent job. 
    I also setup my LANID as a proxy account to see if the job would run (checking security) -- and it fails with the same error.   I also made sure the path is
    \\server\share rather than a drive letter.   Any ideas?
    The package is executed in 32 bit mode.  The package still runs fine in BIDS (where BIDs is opened on the server) but fails in the SQL Agent job with:
    Executed as user: xxxxxx\xxxxxx. Microsoft (R) SQL Server Execute Package Utility  Version 11.0.2100.60 for 32-bit  Copyright (C) Microsoft Corporation. All rights reserved.    Started:  9:00:00 AM  Error: 2014-12-01 09:00:02.46    
    Code: 0xC0202009     Source: xxxxxx Connection manager "Excel Connection Manager"     Description: SSIS Error Code DTS_E_OLEDBERROR.  An OLE DB error has occurred. Error code: 0x80004005.  An OLE
    DB record is available.  Source: "Microsoft Access Database Engine"  Hresult: 0x80004005  Description: "External table is not in the expected format.".  End Error  Error: 2014-12-01 09:00:02.65    
    Code: 0xC020801C     Source: Load File to Staging Excel Source [43]     Description: SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER.  The AcquireConnection method call to the connection manager
    "Excel Connection Manager" failed with error code 0xC0202009.  There may be error messages posted before this with more information on why the AcquireConnection method call failed.  End Error  Error: 2014-12-01 09:00:02.77    
    Code: 0xC0047017     Source: Load File to Staging SSIS.Pipeline     Description: Excel Source failed validation and returned error code 0xC020801C.  End Error  Error: 2014-12-01 09:00:02.90    
    Code: 0xC004700C     Source: Load File to Staging SSIS.Pipeline     Description: One or more component failed validation.  End Error  Error: 2014-12-01 09:00:03.02     Code: 0xC0024107    
    Source: Load File to Staging      Description: There were errors during task validation.  End Error  DTExec: The package execution returned DTSER_FAILURE (1).  Started:  9:00:00 AM  Finished: 9:00:03 AM 
    Elapsed:  2.761 seconds.  The package execution failed.  The step failed.

    I logged on to the server with the account that the SQL Agent runs under and ran the following from a command
    line to execute the package:
    "D:\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn\DTEXEC.exe" /FILE
    "\"K:\SSIS\xxxxxx\xxxxx.dtsx\"" /CHECKPOINTING OFF 
    /REPORTING EWCDI  /X86
    I wanted to see if it was a security issue with the agent account account - but
    this ran fine.
    I then updated the SQL Agent job to use an operating system command instead
    of a SSIS package on the job step.  This fails...
    The issue is definately with the SQL Server Agent

  • Want to change the SQL Server Agent Job History Text Files Location

    We have SQL Server 2014 installed on a couple servers, but they were not consistent on directory paths during the installs. I am trying to get the servers to all match.
    On one server, SQL Server the Agent Log and Job History files were being written to [H:\Data Root Directory\MSSQL12.MSSQLSERVER\MSSQL\Log].
    I want to change that to [H:\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\Log] to match the other server.
    I have ALREADY gone into SSMS - [SQL Server Agent] - [Properties] and changed the "Error Log " "Fle Name" to [H:\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\Log\SQLAGENT.OUT].  And that is working great.
    In [SQL Server Configuration Manager] - [SQL Server (MSSQLSERVER)] - [Properties] - Startup Parameters entries have been changed to the new path (-d, -e, and -l), and under [Advanced] both Data Path and Dump Directory are pointing to the new path. 
    In [SQL Server Configuration Manager] - [SQL Server Agent (MSSQLSERVER)] - [Properties] - [Advanced] Dump Directory is pointing to the new path. 
    However, the job's History text files are still being written to the old path.
    There is no setting in the Jobs or the Maintenance Plans that controls the history file location.
    I have searched the registry and changed three settings from the old path to the new path.  The registry does NOT contain any more references to the old path.
    I rebooted the server, but when the jobs run their history text files are still be written to the old path.
    Does anybody have any ideas??   Thanks

    I checked the [Job] - [Step] - [Advanced ] - "Output File", and the field is blank.
    I then reviewed all the tabs and left menu items in the Job...I cannot find any where the references the old path.
    I then went to the Maintenance Plan and checked every thing there.  Still cannot find what is referencing this old path.
    SQL Server is also still writing xel files to this old path...if that offers any clues.
    The text file being generated is the recap of the Job run.  Starts with this:
    Microsoft(R) Server Maintenance Utility (Unicode) Version 12.0.2430
    Report was generated on "xxxxxxxxxxxxxxx".
    Maintenance Plan: SQL_Backups_Log
    Duration: 00:00:03
    Status: Succeeded.
    Details:
    Thanks for the ideas....

  • SQL Server Agent Job is not running as per schedule

    I have a job that is supposed to run every 6 AM.  It was running last week but not this morning. 
    The big problem is that there are no error messages what so ever. I checked Agent History, SQL server logs and Windows system logs.
    I checked the schedule and it is set to run everyday and there are no limits on how long it is supposed to run and it is enabled.
    Did anyone get this problem before?

    Hi,
    Sometimes there are valid reasons a job will NOT kick-in on the scheduled time. Sometime ago, our database full backup job didn't start on time and in fact just
    got skipped over. Upon further investigation, a idiot started doing defragging on the target (destination) server without informing anybody in the enterprise and the previous days backup was running over 24+ hours instead of 2 hours. Sometime people cheat
    and try to enable/disable jobs and in those cases you may want to add notification if something like this happens. http://www.mssqltips.com/sqlservertip/1803/auto-alert-for-sql-agent-jobs-when-they-are-enabled-or-disabled/
    Sankar Reddy
    Blog: http://SankarReddy.com/
    Twitter: http://twitter.com/SankarReddy13/

  • How to find who has changed SQL Server Agent 'Job History' settings.

    Hi all,
    I was searching from couple of days to know is there a way to find out who has changed the SQl agent property settings.
    Like if someone unchecks the SQL Agent History settings how i can find who has done that change?
    I searched for trace flags but there is nothing related to it, i searched for system tables and views of msdb but nothing which can give this information, even didn't find any audit setting that can monitor these activities.
    My sql version is SQL Server 2008. Please throw your ides on how to track the sql agent history setting changes!!!
    Thanks In Advance!!!!
    VVinayPrasad

    Hi,
    You might be able to AUDIT the execute on that SP but its not giving exactly what has been changed... i guess you are getting what i am looking for...
    whatever the property might be changed it only shows the sp name thats it.... but not the exact sql statement executed on background
    VVinayPrasad
    First of all: It's not about me, it's about you. And it's not a might, its a given fact. I
    tested it for you.
    Second: your question was:
    >>I was searching from couple of days to know is there a way to find out
    who has changed the SQl agent property settings.
    >>Like if someone unchecks the SQL Agent History settings how i can find who has done that change?
    So please first clear up, what you really need.
    Third: instead of Auditing I already gave the advise to use Tracing (be it SQLTrace or Extended Events). Both will give you the exact statement. SQLTrace may be easier on SQL2008
    Please try all of the provided first before doing guesswork.
    Andreas Wolter (Blog |
    Twitter)
    MCM - Microsoft Certified Master SQL Server 2008
    MCSM - Microsoft Certified Solutions Master Data Platform, SQL Server 2012
    www.andreas-wolter.com |
    www.SarpedonQualityLab.com

  • Automated SQL Agent jobs do not run

    Hi all
    I am having serious issues in running SSIS packages automatically.
    Furthermore, when I assign a job to run the SSIS package manually (SSMS -> Start Job at Step....), it runs through the job very quickly and displays "success", when in actual fact, it hasn't done anything.
    I have tested my package in BIDS and all works fine.
    Can anyone give me a clue as to what may be going wrong please?
    Many thanks in advance.

    Hi divvyboy,
    Based on your description, the issue may be caused by one of the following factors:
    Data source connection issue. This can occur because the SQL Server Agent Service Account or the proxy account lacks permissions to access the data source.
    Package Protection Level issue.
    For the solution in each scenario, please refer to the following link:
    http://social.technet.microsoft.com/Forums/sqlserver/en-US/e13c137c-1535-4475-8c2f-c7e6e7d125fc/how-do-i-troubleshoot-ssis-packages-failed-execution-in-a-sql-agent-job?forum=sqlintegrationservices.
    If the issue persists, please post the error details from the SQL Server Agent job history.
    Regards,
    Mike Yin
    TechNet Community Support

  • VBScript Runs Correctly From Command Prompt, But Not From SQL Server Agent Job

    I'm trying to run this script on my local machine to do some post-batch cleanup and it doesn't run correctly from the scheduled job (or when I invoke the job).
    Here's the script in question:
    Option Explicit
    Const filePath = "C:\Documents and Settings\jmunn\My Documents\Visual Studio 2008\Logs\"
    Const holdDays = 6
    main
    Sub Main()
    ClearArchive
    End Sub
    Sub ClearArchive()
    Dim fso 'As Scripting.FileSystemObject
    Dim fld 'As Scripting.Folder
    Dim f 'As Scripting.File
    Dim delLogName, delLogOut, delCtr
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set fld = fso.GetFolder(filePath)
    delLogName = filePath & "Nightly Backup - Backup Logs Deleted" & ".txt"
    Set delLogOut = fso.CreateTextFile(delLogName, True)
    delLogOut.WriteLine(delLogName)
    delLogOut.WriteLine("")
    delLogOut.WriteLine("-- The following log files were deleted on " & DateValue(Now()) & " at " & TimeValue(Now()))
    delLogOut.WriteLine("")
    delCtr = 0
    For Each f In fld.Files
    If Left(f.Name, 48) = "Nightly Backup - SQL Server Databases_Subplan_1_" And Right(LCase(f.Name), 4) = ".txt" Then
    If DateDiff("d", f.DateCreated, Date()) > holdDays Then
    delLogOut.WriteLine(f.Name)
    fso.DeleteFile f, True
    delCtr = delCtr + 1
    End If
    End If
    Next
    If delCtr = 0 Then
    delLogOut.WriteLine("No log files were deleted this run...")
    End If
    Set fld = Nothing
    Set fso = Nothing
    delLogOut.Close
    End Sub
    If I put the script in its own file and run it from the command prompt, it runs just fine. If the script runs from the SQL Server Agent job, the for-loop will delete the files correctly, but the filenames
    do not get written to the deletion log file and the counter does not get incremented, so according to the job log, nothing was deleted. Why does the script run differently from each invocation? It can't be a permission thing, the service that logs in has full
    access to the directory and the files do get deleted. Any ideas out there?
    Between this and other outstanding issues, I'm quickly losing faith in SQL Server.  >=o(
    Thanks in advance for your thoughts!
    John
    Version Info:
    Microsoft SQL Server Management Studio      10.0.2531.0
    Microsoft Analysis Services Client Tools      10.0.1600.22
    Microsoft Data Access Components (MDAC)      3.85.1132
    Microsoft MSXML      2.6 3.0 4.0 5.0 6.0
    Microsoft Internet Explorer      8.0.6001.18702
    Microsoft .NET Framework      2.0.50727.3603
    Operating System      5.1.2600
    "A bus station is where a bus stops. A train station is where a train stops. On my desk I have a workstation..."

    Hi
    jrmunn
    i am trying to execute VB script to refresh my excel files.. using Vbscript file through SQL Agent job step.
    i have copied VBscript in a file with the extension RefreshExcel.vbs kept in C:\RefreshExcel.vbs
    Below is the script used inside the file (RefreshExcel.vbs)
    //---Script code-----------------------------------------------------------------
    Dim objXL, objWB
    Dim FileLocation, FileName
    On Error Resume Next
    'lgnConn = 1
    FileLocation = "F:\Reports\Reports"
    Set objXL = CreateObject("Excel.Application")
    objXL.DisplayAlerts = False
    FileName = "ReportFile1.xlsx"
    'MsgBox (FileLocation & "/" & FileName)
    Set objWB = objXL.Workbooks.Open(FileLocation & "/" & FileName)
    objWB.EnableConnections
    objXL.CalculateUntilAsyncQueriesDone
    objWB.RefreshAll
    objXL.CalculateUntilAsyncQueriesDone
    objWB.RefreshAll
    objXL.CalculateUntilAsyncQueriesDone
    objWB.Save
    objWB.Close
    Set objWS = Nothing
    Set objWB = Nothing
    objXL.Quit
    Set objXL = Nothing
    'MsgBox ("Refresh Completed")
    ---------------------------------------------------------------------------------------------------//Script complete
    Now when i am trying to call this script file in SQL agent job step (as you mentioned )
    as Type -cmdExec(OperatingSystem)
    cscript "C:\RefreshExcel.vbs"
    Issue: job step executed succesfully ,,but without performing any refresh on the excel. So i am not understandig what is going wrong. the same script file work when i am calling it through a batch file (window scheuler task). But it doesnt support
    to run the file "when user is not logged in"
    that is why  i want to refresh my excel file through sql agent ,which can be scheduled to any time and cab be run as SQL agent credentials.
    Can you please help me on this ...i have tried all the option but nothing working .. found hope by seeing your solution.
    Thanks in advance.
    Please help me. :-(

  • Error while executing SSIS package which contains Script component through SQL Server Agent Job

    Hello All,
    I have written one SSIS 2012 package which is fetching records from CSV and put it into staging DB and from staging DB , using SSIS script component task, I am inserting data into Dynamics CRM. So far it is working fine when
    I manually execute SSIS package.
    but when I run the SSIS package using SQL server agent job, I encounter below error. After seeing below error at step "Insert TLM Headers Script Component " I understand that it is failing at script component which I have used in SSIS package,
    but I am not sure what is the cause behind that? please advise.
    Error:
    Executed as user: domain\user account. Microsoft (R) SQL Server Execute Package Utility  Version 11.0.5556.0 for 64-bit  Copyright (C) Microsoft Corporation. All rights reserved.    Started:  1:21:41 PM  Error: 2015-02-25
    13:21:45.94     Code: 0xC0047062     Source: Insert TLM Headers Script Component [205]     Description: System.ServiceModel.FaultException: The server was unable to process the request due to an internal
    error.  For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the <serviceDebug> configuration behavior) on the server in order to send the exception information back to
    the client, or turn on tracing as per the Microsoft .NET Framework 3.0 SDK documentation and inspect the server trace logs.    Server stack trace:      at System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message
    reply, MessageFault fault, String action, MessageVersion version, FaultConverter faultConverter)     at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)    
    at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)     at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage
    methodCall, ProxyOperationRuntime operation)     at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)    Exception rethrown at [0]:      at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.HandleUserException(Exception
    e)     at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.ProcessInput(Int32 inputID, PipelineBuffer buffer)     at Microsoft.SqlServer.Dts.Pipeline.ManagedComponentHost.HostProcessInput(IDTSManagedComponentWrapper100
    wrapper, Int32 inputID, IDTSBuffer100 pDTSBuffer, IntPtr bufferWirePacket)  End Error  Error: 2015-02-25 13:21:45.94     Code: 0xC0047022     Source: Insert TLM Headers SSIS.Pipeline    
    Description: SSIS Error Code DTS_E_PROCESSINPUTFAILED.  The ProcessInput method on component "Script Component" (205) failed with error code 0x80131501 while processing input "Input 0" (215). The identified component returned an error
    from the ProcessInput method. The error is specific to the component, but the error is fatal and will cause the Data Flow task to stop running.  There may be error messages posted before this with more information about the failure.  End Error 
    DTExec: The package execution returned DTSER_FAILURE (1).  Started:  1:21:41 PM  Finished: 1:21:45 PM  Elapsed:  4.009 seconds.  The package execution failed.  The step failed.
    Thanks
    Pankaj

    domain\user account has not proper rights
    That being said, often SSIS jobs require a proxy to be runnable and this is how you make one up
    http://www.mssqltips.com/sqlservertip/2163/running-a-ssis-package-from-sql-server-agent-using-a-proxy-account/
    Arthur
    MyBlog
    Twitter

  • SQL Server Agent Job Failing on Job Step

    Hi,
    Firstly, apologies if this post has been made in the wrong group.  Running SQL Server 2012.  I'm attempting to add a SQL Server Agent Job which calls a stored procedure that sends a Database Mail message.  The SQL Server and SQL Server Agent
    both run under the NT AUTHORITY\NETWORK SERVICE account.  The Database Mail service has been enabled, and a public profile created.  When running the stored procedure manually, I receive no errors - everything runs as expected and I do receive an
    email containing the expected information.
    I've created the job, job step, job schedule, attached the schedule to the job, and assigned the job to server, all using T-SQL without error.  I've also enabled the mail profile on the SQL Server Agent, and I know that part is working because when
    the job fails, I get an email notification of the failure.
    I've checked the command text in the job step and parsed it within the SQL Job Step Edit window to confirm, it shows as parsing correctly.  However, when I manually run the job itself, I get the following:
    Execution of job failed.  See the history log for details.
    I check the history log and it shows:
    [474] Unable to refresh Database Mail profile Database Mail Profile. (reason: ) (Not a typo, the history log shows no reason)
    [260] Unable to start mail session.
    [396] An idle CPU condition has not been defined - OnIdle job schedules will have no effect
    The command text on the failing job step is as follows:
    DECLARE @date [varchar](10)
    SET @date = CAST(GETDATE() AS [varchar](10))
    EXEC [dbo].[GetExceptions]
    @company = 'MyCompany',
    @checkDate = @date
    With regard to the date value being passed as varchar: This stored procedure is used to check for exceptions against multiple databases on this server (hence the company parameter) via dynamic SQL.  I'd much prefer to use proper data typing but this
    is the only way I could get it to work.
    Does anyone have any suggestions on anything else I could check, or insights into why this is failing?  Any help is greatly appreciated!
    Best Regards
    Brad

    I am not sure if this really helps but I would do follow the below steps:
    1. make sure sql server agent has database mail enabled(rigt click on server agent--properties--alert system--enable database mail and choose right profile.) and RESTART THE SQL SERVER AGENT.(i know you said it i working, but sometimes,  restart the
    sql server agent might fix)
    2. check agent error log and check if any error messages.
    3. run the command text you mentioned in sql server and see if it is working.(i know you said it is working but just to make sure).
    4. make sure sql server agent service user has permissions to run database mail in msdb. check this https://msdn.microsoft.com/en-us/library/ms186358.aspx
    5. Check the output from select * from msdb.dbo.sysmail_log and if it says anything
    6.it does not look like the job log is getting truncated but to make sure, get the job step output to a text file.to do this, edit the job step and on the job step properties click on advanced,  enter path to the output file. this will give the complete
    output for the step.
    Hope it Helps!!

  • SQL Server Agent Jobs error for Slowly changing dimension

    Hi,
    I have implemented Slowly changing dimension in 5 of my packages for lookup insert/update.
    All the packages are running good in SSDT. And when i deployed the project to SSISDB and run the packages all are running successfully. But when i created a job out of that and run the packages, then 3 packages ran successfully and 2 packages failed. 
    When i opened All Execution Report. I found the following error:
    Message
    Message Source Name
    Subcomponent Name
    Process Provider:Error: SSIS Error Code DTS_E_OLEDBERROR.  An OLE DB error has occurred. Error code: 0x80004005. An OLE DB record is available.  Source: "Microsoft SQL Server Native Client 10.0"  Hresult: 0x80004005  Description:
    "Login timeout expired". An OLE DB record is available.  Source: "Microsoft SQL Server Native Client 10.0"  Hresult: 0x80004005  Description: "A network-related or instance-specific error has occurred while establishing
    a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online.". An OLE DB record is available. 
    Source: "Microsoft SQL Server Native Client 10.0"  Hresult: 0x80004005  Description: "Named Pipes Provider: Could not open a connection to SQL Server [53]. ".
    Process Provider
    Slowly Changing Dimension [212]
    Then i opened Provider package in SSDT and changed the source reading record limit from 4,00,000 to 15,000 in source query and deployed again and run, then the job succeeded. more than 15,000 failed.
    And in the 2nd experiment, I removed slowly changing dimension task and implemented normal lookup for insert/update, and set the source reading limit again to 4,00,000 and deployed again and run, then the job succeeded.
    Now i am not able to figure out, what exactly is the problem with Slowly changing dimension task for more than 15,00 records in SQL Server  Agent Job run?
    Can anybody pls help me out.
    Thanks
    Bikram

    Hi Vikash,
    As i have mentioned in the above post, below 2 scenarios: 
    "Then i opened Provider package in SSDT and changed the source reading record limit from 4,00,000 to 15,000 in source
    query and deployed again and run, then the job succeeded. more than 15,000 failed.
    And in the 2nd experiment, I removed slowly changing dimension task and implemented normal lookup for insert/update, and set the source reading limit again to 4,00,000 and deployed again and run, then the job succeeded."
    That means i am able to connect to sql server.
    But if i change the 1st scenario and read 4,00,000 records, the job fails and shows the above mentioned error.
    Similarly in the 2nd scenario, if i implement SCD look up,  the job fails and shows the above mentioned error.
    And i am consistently reproducing this.
    Thanks
    Bikram

  • SQL Server Agent Job intermittently running for packages on SSISDB

    I created an SSIS package to pull data from OLAP Cube and push it into SQL Server using SSIS 2o12. I deployed the same on the SQL Server SSIS DB and created a SQL Server Agent Job to run the package. I have an account configured to run the job (not by
    creating proxy in the job, but SQL Server Agent is running under that account), that has access to the OLAP Cube. The job is running sometimes and failing sometimes. Why the job behaving weirdly. Any help on the issue will help me a lot. I am using SQL Server
    2012 SP1 enterprise edition (11.0.3000.0) (if it helps). The error message which pops up when it fails is :
    OLE DB Source failed the pre-execute phase and returned error code 0xC0202009
    SSIS Error Code DTS_E_OLEDBERROR.  An OLE DB error has occurred. Error code: 0x80040E05.
    An OLE DB record is available.  Source: ""Microsoft OLE DB Provider for SQL Server 2012 Analysis Services.""  Hresult: 0x00000001  Description: ""Error Code = 0x80040E05, External Code = 0x00000000:."".
    "

    Hi,
    You are using Execute SQL Task to run a MDX query, right?  If so, here is an approach/workaround for your reference. If the MDX query doesn’t have parameters, you can create a view in SQL running the MDX query and make the Execute SQL Task to get data
    from that view. If the MDX query has parameters, you can try a Function and create a stored procedure, and then set the Execute SQL Task to execute that stored procedure.
    Regards,
    Mike Yin
    TechNet Community Support

  • What is the best way to read, process, and write an Excel File Server side...SQL Server Agent Job

    So I was using dynamic Excel commands to open and save as using...
    Microsoft.Office.Interop.Excel.Application
    and
     workbook.SaveAs(StringDestinationFile, XlFileFormat.xlExcel8, Type.Missing, Type.Missing, Type.Missing, Type.Missing, XlSaveAsAccessMode.xlExclusive, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
    which worked all fine and dandy client side. Then when I attempted to create a SQL Server Agent Job, this failed as a result of SQL Server side not being able to execute dynamic Excel commands.
    So do I need to therefore try and do this function via Microsoft.ACE.OLEDB.12.0 commands? And where can I find the commands and syntax to open and save as? I have to Open a .xlsx file, save it as a .xls file, and then open this newly created .xls file and
    then save it as a .csv file.
    Thanks for your review and am hopeful for a reply.
    ITBobbyP85

    I think you might be over complicating things.
    You can use SSIS with Excel Source/Destination connections to read in, or output to an excel sheet/file.

  • How to stop SQL Server Agent Job if Stored Procedure returns value 0

    I have SQL Server 2012 SSIS.
    I have 2 SSIS packages.
    I have created SQL Server Agent Job for running packages.
    I have created steps. If first step have run succesfully next step is run.
    I have need to add new logic.
    I have validation stored procedure, which validate DB table values and returns 1 or 0.
    I would like to create logic where first of all this SP is runned. Return value of SP determines if steps are run or not.
    I was thinking to use Execute SQL Task for running SP.
    If value 1 is returned, then run rest of Tasks is run.
    If value 0 is returned, what should I do so that Job is stopped? I need assistance! 
    I want current step to stop never moved to next step.
    Is there any SSIS tasks, which can stop the Job?
    Or should I make Step for running validation SP?
    How to do so that if value 0 is returned stop Job.
    Kenny_I

    Please refer the below link:
    http://technet.microsoft.com/en-us/library/aa260308(v=sql.80).aspx
    Please read Remarks carefully!!!
    Remarks
    If a job is currently executing a step of type CmdExec, the process being run (for example, MyProgram.exe) is forced to end prematurely. Premature ending can result in unpredictable behavior such as files in use by the process being held open. Consequently,
    sp_stop_job should be used only in extreme circumstances if the job contains steps of type CmdExec.
    Permissions
    Execute permissions default to the public role in the
    msdb database. A user who can execute this procedure and is a member of the
    sysadmin fixed role can stop any job. A user who is not a member of the
    sysadmin role can use sp_stop_job to stop only the jobs he/she owns.
    When sp_stop_job is invoked by a user who is a member of the
    sysadmin fixed server role, sp_stop_job will be executed under the security context in which the SQL Server service is running. When the user is not a member of the
    sysadmin group, sp_stop_job will impersonate the SQL Server Agent proxy account, which is specified using
    xp_sqlagent_proxy_account. If the proxy account is not available,
    sp_stop_job will fail. This is only true for Microsoft® Windows® NT 4.0 and Windows 2000. On Windows 9.x, there is no impersonation and
    sp_stop_job is always executed under the security context of the Windows 9.x user who started SQL Server.

  • One sql server agent job suspend

    One sql server agent job--run full backup of one database is suspended from activity monitor.
    How to find why it is suspended and troubleshoot?

    "Suspended" is a common status for a thread.  It indicates the thread is waiting on an external resource, which backups often are
    Check few things:
    1. Database size, how much backup is completed from below command and location where backup files are being placed
    select session_id,command, percent_complete
    from sys.dm_exec_requests
    If that on network than might be due to slow netword backup take some time.
    2. Check job history, expected
    completion time of backup job and also if any change in the I/O and CPU time for the SPID
    3.Check wait type of suspended spid, SQL server and event viewer logs. If any I/O issue on the server. Like disk responding slowly that might be a cause of delay.
    Please click the Mark as answer button and vote as helpful if this reply solves your problem

  • SQL Server agent job failing to back up database

    I have set up a SQL server agent job to back up database on regular basis.. For some reason the back up fails.. Could not find any meaningful info in the logs.. Transaction logs are getting created for the same DB but not the database back up..
    The below is my environment..
    MS SQL Server 2005 - 9.00.1399.06
    Windows 2003 server SP2
    Any pointers would be helpful.. I checked the event logs and the agent logs and did not see obvious error.
    Thanks

    I have set up a SQL server agent job to back up database on regular basis.. For some reason the back up fails.. Could not find any meaningful info in the logs.. Transaction logs are getting created for the same DB but not the database back up..
    The below is my environment..
    MS SQL Server 2005 - 9.00.1399.06
    Windows 2003 server SP2
    Any pointers would be helpful.. I checked the event logs and the agent logs and did not see obvious error.
    Thanks
    NO answer can be provided unless you show us the error message. There can be numerous reasons for backup job to fail. See job history for details please post complete information present in job history.
    Check errorlog and note what error message is there at time when the backup job failed. You could find something useful. Please learn how to post question in forum just saying I have a problem will not help both of us.
    Please mark this reply as answer if it solved your issue or vote as helpful if it helped so that other forum members can benefit from it.
    My TechNet Wiki Articles

Maybe you are looking for

  • I LOST MY IPHONE 5S, still trackable and has an ORANGE LOCK SYMBOL.

    Hi people, NEED URGENT HELP! Firstly, I have to say this information : I live in Indonesia and I cannot count on Indonesian police here. However, here, in MOST CASES you can solve everything with money. Two days ago I lost my Iphone 5s at a KTV place

  • PNG pictures not showing up in IE7 after Quicktime Install

    I am having a problem on my Vista box. PNG images are not showing in IE - not on any website since installing Quicktime. It seems this has something to do with Apple's Quicktime. I have gone to MIME and File Assoc. settings in Quicktime and set the i

  • Amber update in egypt

    I got Nokia Lumia 820 and i live in egypt and the amber update is available for me as the nokia says but when i go to phone updates it tells me I'm up to date so what should i do? Solved! Go to Solution.

  • REG: EXCISE CHALLAN

    Hi to all, Any predefined report format is there for designing the EXCISE CHALLAN with CUSTOMER ACKNOWLEDGEMENT related to SD MODULE. Sales related people  they are calling as PROFORMA INVOICE like that. Thanks, Sankar M

  • 8330 Can't receive email from ISP

    I have tried and tried to set up email to receive from my own domain mail server. I even took the phone to Sprint and they tried but we can't make it read incoming messages. Sending works fine. I think I've tracked it down to the fact that the email