Maintenance Cleanup Task fails when executed with SQL Agent but dont if executed manually

Hello,
I have a job that fails with the following error if exectued via the SQL Server Agent but not if executed manually.
The error is:
 Error: 2014-03-31 21:30:14.89     Code: 0xC002F210     Source: Maintenance Cleanup Task Execute SQL Task     Description: Executing the query "EXECUTE master.dbo.xp_delete_file 0,N'\\erpfiles\b..."
failed with the following error: "xp_delete_file() returned error 2, 'The system cannot find the file specified.'". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly,
or connection not established correctly.  End Error
I have checked and the user configured to run the SQL Agent has all needed accesses to the folder \\erpfiles\b....
Have you an idea to help me go further in my troubleshooting ? Or have you an idea to solve my problem ?
Thanks in advance

I think reason for this is the service account having no permissions on the specified folder path. Thats when you get this error most of the times. The user logged in might have access but please keep in mind that sql agent job makes use of service account
to execute the job which would still need access to the pat to delete the files
What you can do is add a proxy account and give it access to folder path and use it to execute the job
http://www.databasejournal.com/features/mssql/article.php/3789881/Proxy-Accounts-in-SQL-Server.htm
Alternatively you can give the service account access to the folder path.
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

Similar Messages

  • Maintenance Cleanup Task

    I am trying to run Maintenance Cleanup task using ssis but when i execute task it give me following error
    "[Execute SQL Task] Error: Executing the query "EXECUTE master.dbo.xp_delete_file 0,N'\\10.129.12.27\agq-to-fo

    Please what kinf of user rights required to run Maintenance Cleanup task ?
    the account who runs the SSIS package, should have full permission on UNC path of folder which you want to delete files there. Does it make sense?
    and did you checked the link I suggested in my  second post?
    http://www.rad.pasfu.com
    My Submitted sessions at sqlbits.com

  • SSIS ETL does not pick the file from Share point when it execute through SQL Agent job

    I have created one SSIS packages, which pick the file from the Share point document library. its work successfully, once it execute through the VS project application. 
    But when i create a job in SQL Server Agent for this package then it does not pick the file and job getting fail. 
    Just for more update, SQL Server has been install in Cluster mode and using BIDS 2012 with SQl Server 2012.

    Hi PriyankGupta,
    SQL Server Integration Services is not cluster awareness, and does not support failover from one cluster node to another. So, in your clustered environment, make sure SSIS is installed on each node in the cluster. In other word, SSIS must be installed on
    the server where the SQL Server Agent job is created. 
    If you use any third party task/component or drivers, make sure they are installed on the SQL Server Agent job server. Besides, also pay attention to the protection level of the package as well as 32-bit or 64-bit runtime mode of the package. For more information,
    please see:
    http://social.technet.microsoft.com/Forums/systemcenter/en-US/e13c137c-1535-4475-8c2f-c7e6e7d125fc/how-do-i-troubleshoot-ssis-packages-failed-execution-in-a-sql-agent-job 
    If the issue persists, please post the error message in the job history for further analysis.
    Regards,
    Mike Yin
    TechNet Community Support

  • SSIS Script task not executing macro through SQL Agent (but it does through bids)

    <p>Hello everyone,</p><p>I am having an issue with SQL Agent when executing a macro contained in a script task component. The script task actually opens an excel file, runs the macro, save and closes the file. </p><p>When
    I execute the package via BIDS/Visual studio, it works like a charm. However, when i execute the package with SQL agent, the package runs successfully but it seems that the macro is not executed as the excel file has not been modified as it should have. Also,
    the history log does not show any error messages. </p><p>Could </p>

    Thanks!I did create a credential and a proxy too but still the macro is not executed.I have searched online for solutions but no one has experimented this kind of issue before it seems. Please have a look at the script task code:
    Imports
    Excel = Microsoft.Office.Interop.Excel
    Imports
    System
    Imports
    System.Data
    Imports
    System.Math
    Imports
    Microsoft.SqlServer.Dts.Runtime
    <System.AddIn.AddIn(
    "ScriptMain", Version:="1.0",
    Publisher:="", Description:="")>
    <System.CLSCompliantAttribute(
    False)> _
    Partial
    Public
    Class ScriptMain
    Inherits Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
    Enum ScriptResults
    Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success
    Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure
    End
    Enum
    Public
    Sub Main()
    Dim Macro_name
    As
    String
    Dim ExcelObject
    As
    New Microsoft.Office.Interop.Excel.Application
    Dim oBook
    As Microsoft.Office.Interop.Excel.Workbook
    Dim oBooks
    As Microsoft.Office.Interop.Excel.Workbooks
    Try
    Macro_name =
    "Macro001"
    ExcelObject =
    CType(CreateObject("Excel.Application"),
    Excel.Application)
    ExcelObject.Visible =
    True
    ExcelObject.UserControl =
    False
    ExcelObject.DisplayAlerts =
    False
    oBooks = ExcelObject.Workbooks
    oBook =
    CType(oBooks.Open("C\Book1.xls"),
    Excel.WorkbookClass)
    ExcelObject.Run(Macro_name)
    Catch ex
    As Exception
    ExcelObject.Application.Quit()
    ExcelObject.DisplayAlerts =
    True
    ExcelObject =
    Nothing
    End
    Try
    Dts.TaskResult = ScriptResults.Success
    End
    Sub
    End
    Class

  • I have a production mobile Flex app that uses RemoteObject calls for all data access, and it's working well, except for a new remote call I just added that only fails when running with a release build.  The same call works fine when running on the device

    I have a production mobile Flex app that uses RemoteObject calls for all data access, and it's working well, except for a new remote call I just added that only fails when running with a release build. The same call works fine when running on the device (iPhone) using debug build. When running with a release build, the result handler is never called (nor is the fault handler called). Viewing the BlazeDS logs in debug mode, the call is received and send back with data. I've narrowed it down to what seems to be a data size issue.
    I have targeted one specific data call that returns in the String value a string length of 44kb, which fails in the release build (result or fault handler never called), but the result handler is called as expected in debug build. When I do not populate the String value (in server side Java code) on the object (just set it empty string), the result handler is then called, and the object is returned (release build).
    The custom object being returned in the call is a very a simple object, with getters/setters for simple types boolean, int, String, and one org.23c.dom.Document type. This same object type is used on other other RemoteObject calls (different data) and works fine (release and debug builds). I originally was returning as a Document, but, just to make sure this wasn't the problem, changed the value to be returned to a String, just to rule out XML/Dom issues in serialization.
    I don't understand 1) why the release build vs. debug build behavior is different for a RemoteObject call, 2) why the calls work in debug build when sending over a somewhat large (but, not unreasonable) amount of data in a String object, but not in release build.
    I have't tried to find out exactly where the failure point in size is, but, not sure that's even relevant, since 44kb isn't an unreasonable size to expect.
    By turning on the Debug mode in BlazeDS, I can see the object and it's attributes being serialized and everything looks good there. The calls are received and processed appropriately in BlazeDS for both debug and release build testing.
    Anyone have an idea on other things to try to debug/resolve this?
    Platform testing is BlazeDS 4, Flashbuilder 4.7, Websphere 8 server, iPhone (iOS 7.1.2). Tried using multiple Flex SDK's 4.12 to the latest 4.13, with no change in behavior.
    Thanks!

    After a week's worth of debugging, I found the issue.
    The Java type returned from the call was defined as ArrayList.  Changing it to List resolved the problem.
    I'm not sure why ArrayList isn't a valid return type, I've been looking at the Adobe docs, and still can't see why this isn't valid.  And, why it works in Debug mode and not in Release build is even stranger.  Maybe someone can shed some light on the logic here to me.

  • I dropped my iphone 3gs now it goes on when connected with a charger but battery show 0% battery. as soon as i disconnect the charger the phone goes off....

    I dropped my iphone 3gs now it goes on when connected with a charger but battery show 0% battery. as soon as i disconnect the charger the phone goes off....

    Your the one saying it won't work properly, so yes it is broken.

  • HT1553 i am upgrading my 2008 macbook to an ssd drive and want to save my settings. how do i save then? I have my files backed up with time machine ,but dont want to restore all files ,as there might be some junk backed up too. Help will be appretiated

    i am upgrading my 2008 macbook to an ssd drive and want to save my settings. how do i save then? I have my files backed up with time machine ,but dont want to restore all files ,as there might be some junk backed up too. Help will be appretiated

    When you restore from a Time Machine back up you can pick and chose what is restored. It is not an all or nothing process. Nor do you have to do the partial restores all at the same time. If days after the first partial restore you find something else you want you can restore just that.

  • "ERROR_DESTINATION_INVALID: Web deployment task failed" when trying to deploy site

    I'm working on our CI process for auto-publishing WebJobs along with a host WebSite for said jobs. This isn't working, but that's not the point at the moment.
    The site in question is called devpandajobhost.azurewebsites.net and I have created (and deleted
    and recreated) and published to this site successfully many times, from both msbuild and VS.
    However, earlier today, my publish commands have started failing with 
    C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\Web\Microsoft.Web.Publishing.targets(4253, 5): error ERROR_DESTINATION_INVALID: Web deployment task failed. ( Could not connect to the remote computer ("devpandajobhost.scm.azurewebsites.net"). Make sure that the remote computer name is correct and that you are able to connect to that computer.  Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_DESTINATION_INVALID.) 
    or (from vs)
    Error 4
    Web deployment task failed. ( Could not connect to the remote computer ("devpandajobhost.scm.azurewebsites.net"). Make sure that the remote computer name is correct and that you are able to connect to that computer.  Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_DESTINATION_INVALID.)
    0 0
    JobHost
    It looks like the scm site for my site doesn't exist. I have tried deleting and recreating my site several times, through various different mechanisms (VS new project, portal, powershell). The site can be created but when I publish to it I get the error
    above.
    What is going on?
    PS my theory is that I deleted and recreated it and the Azure internal DNS server has got in a pickle

    it is not only internal Azure DNS but your DNS provider as well. Since DNS records are propagated and cached (and negative cached as well) you need to wait for some time for negative cache to expire.
    I see no good reason to go through the cycle of creating new site every time unless this is your scenario. If so you can delete the old one and create always sites with new name.
    Galin Iliev [MCSD.NET, MCPD], http://www.galcho.com

  • SSIS script task failing when deployed as project in SSIS 2012

    Yes , it's the classic "my package works inside SSDT but dies when I deploy it". I  have a fairly good idea what the problem is. I have a line of code that looks in a directory. My guess is that the account that is used to run packages out
    of SSISDB doesn't have access to the directory in question. My question is, what exactly needs to be set properly in order for packages to run properly in the package deployment model.
    Error message: Exception has been thrown by the target of an invocation.
    Code:
    using System;
    using System.Data;
    using System.IO;
    using Microsoft.SqlServer.Dts.Runtime;
    using System.Windows.Forms;
     public void Main()
                String FilePath;
                FilePath = Dts.Variables["InitialDirectoryFullPath"].Value.ToString();
                if (Directory.GetFiles(FilePath).Length == 0)
                    Dts.Variables["FilesExist"].Value = false;
                else
                    Dts.Variables["FilesExist"].Value = true;
                Dts.TaskResult = (int)ScriptResults.Success;
            enum ScriptResults
                Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success,
                Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure

    You need to give the account which is executing package the access to the directory. If its from SQL Agent job, it might be using SQL Agent service account by default. Then you've to give it required permissions
    Alternatively you can create a proxy account with required permissions and configure the job to use it
    http://www.mssqltips.com/sqlservertip/2163/running-a-ssis-package-from-sql-server-agent-using-a-proxy-account/
    Also you've not posted error message. Whatever I've suggested is by assuming that its a permission issue. If you can post error message we might be able to confirm on the actual cause of error.
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Mounting network drive failing when launched with "crontab"...

    Greetings!
    Here's my problem:
    I have a cron job (domain user) that launch a perl script.
    Somewhere in the script, I mount a network drive like this: "/sbin/mount_smbfs //user:pw@machine/path"
    I get the following error: mount_smbfs: server connection failed: broken pipe.
    -If I ssh to the mac, manually execute the Perl script, no problem, the drive is mounted and I am happy. But it constantly fails if I am not logged in.
    As a workaround, I tried to make my user automatically logged in when the Mac restart. But what do you know? Not working with my (domain) user. But it works fine with any other local users.
    Any ideas?

    Post to the Unix forum under OS X Technologies.

  • Package failed when ANE with a sub-dir

    the error infor is    :   aapt tool failed:invalid resource directory name: D:\LocalProfile\Localtemp\2d9020c8-c1ad-4f26-8bc9-900f763aab37\res/1.txt
    when debug or release an android package with ANE .

    Hi SQL_Gun,
    Based on the current information, you use the
    SharePoint List Adapter in the package, right? According to the following two threads with the same error message, please check whether restarting the SSIS service works:
    http://sqlsrvintegrationsrv.codeplex.com/workitem/13760 
    https://sqlsrvintegrationsrv.codeplex.com/discussions/251698 
    If it doesn’t work, maybe the SharePoint components don’t work well with SQL Server 2014 Integration Services. Besides, since it is a third party component, you can ask a question in its own discussion plate:
    https://sqlsrvintegrationsrv.codeplex.com/discussions 
    Regards,
    Mike Yin
    TechNet Community Support

  • Setting Expiration period for Maintenance Plan Backups fails to work in sql server 2008

    I have created a Maintenance Plan to do a nightly full backup and set the backup
    set to expire after 4 days in sql server 2008 R2.
    Weeks later, old backups are sitting on the hard drive.Please do the needful.

    I have created a Maintenance Plan to do a nightly full backup and set the backup
    set to expire after 4 days in sql server 2008 R2.
    Weeks later, old backups are sitting on the hard drive.Please do the needful.
     Can any one please explain what is the use of BACKUP Expiration ??? 
     I created a backup with expiration date but still am using the same backup file to restore databases?? Then what is the use of Expiration date?

  • Interfaces not visible in 'Operator' when executed with 'Remote Agent'

    Hi,
    I am new to ODI, and have an issue with running Interfaces/Packages with a Remote Agent.+
    I have setup an agent on the machine on which the Database is installed. I have created a Physical Agent with the details, and on using the 'Test' button in the client, it works fine.
    However, when i try an execute a package with this agent, i get the 'Session Started' pop up, but the interface does not register in the 'Operator' section, and nothing happens.+
    However, this does not happen when i use the 'Local (No Agent)', and the interface runs successfully and is registered in the 'Operator'.+
    I just get this error under the 'Physical Agents' tree in the 'Operator' section for the interface - "ODI-1266: Agent agent_apo13110026 detected Session as stale session and set to error status"
    Would appreciate any inputs.
    Thanks,
    Ab

    Hi,
    Thank you for your response.
    We have actuall just migrated the from DEV to TEST. But in DEV we were only using the local agent, and we have configured the new standalone agent only in TEST.
    The way the migration was done, was that we exported the Master and Work Rep from DEV, and then imported it into TEST.
    Could this have had any impact, and would appreciate any pointers on how i can check if indeed the Agent is interacting with the wrong repository.
    Thanks,
    Ab

  • Error -2147418113 when connecting with SQL toolkit

    I have no trouble connecting with DBConnect( ) to an Access database.  However, when I try to connect to an Oracle database (Oracle73 driver), I get error -2147418113 "Catastrophic failure".  Any ideas?  Thanks.

    Hi Gris, 
    This seems to be a relatively common error when connecting to SQL databases and is not necessarily related to LabWindows/CVI. The following are several third party resources that I hope you will find helpful in your troubleshooting: 
    Microsoft Support 1
    Microsoft Support 2
    Microsoft Support 3
    There is one KnowledgeBase referring to this error when expereinced in our LabVIEW Database Connectivity that you may also find helpful: 
    Receiving Error -2147418113 "Catastrophic Failure in xxx.vi" When Using Database Connectivity Toolki...
    I hope this helps!
    Regards,
    Jackie
    DAQ Product Marketing Engineer
    National Instruments

  • 7-zip SSIS task run with SQL agent gives "This operation requires an interactive window station" error.

    I have set up the 7-zip parameters to not require a response, and the process task object to have a "hidden" window.  This is also running with a proxy on the SQL agent.  Is there some other proxy setting, or package or job setting that
    needs to be done to let this run with the SQL agent?  It works fine running under BIDS.
    Thanks,
    John

    Actually you can implement zipping unzipping functionality without using any third party tools if you want. You'll just need to include j# redistributable functions for that in a script task.
    See
    http://microsoft-ssis.blogspot.in/2011/01/unzip-files-with-ssis.html 
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

Maybe you are looking for