SQL Server Agent Job Step: Can I run in single step?
Hi:
I have a SSIS package that I am running from a SQL Agent job. I have to run a msdb Stored procedure first and then run the package. So I have created 2 steps. step-1, type =Tra-SQL where I am running my Stored Procedure. And then step-2, type= Integration
Services which is running the package. I am attaching a config file here too. Is there a simple way to do these 2 steps in just 1 single step without too much complexities.
In the step-1 , SQl command=EXEC MySQlProcedure
In the step-2 , by default the commandline=/SQL "MyPackage" /SERVER MySqlSer /CONFIGFILE "MyDataConfig.dtsConfig" /CHECKPOINTING OFF /REPORTING E
Thanks.
The stored procedure actually gives permission to any user who wants to run the job. I found only I (the creater) and DBA can run the job but other users could not. So I asked the DBA to set it up and he then created this SP. Is there any other way where
I can give access to every user or only DBA can do it?
Similar Messages
-
I've seen some conflicting things in terms of dynamic Excel commands running in a SSISDB Package and a scheduled SQL Server Agent Job...things like that it's not supported...that it won't work...etc...
It's a pretty simple script...to open up a .xlsx file and save it as a .xls file. I am trying to be proactive here and the reason I did it this way is because I could not source the .xlsx file and then I couldn't use OLE DB sourcing because I think the .xlsx
file wants you to use Microsoft.ACE.OLEDB.12.0 and that entails installing the 64-bit Microsoft Access Database Engine and I cannot do that because our network version of Microsoft Office 2010 is 32-bit and in order to install the 64-bit Microsoft Access Database
Engine 2010 it's prompting me to uninstall Microsoft Office 2010 and that is not possible.
Ugh!
So I'm hoping that I can promote and deploy this current SSIS Package to Production and create a SQL Server Agent Job that will successfully run this and its dynamic Excel commands.
Do you know of any hurdles with this? Any anomalies...struggles...
Thanks for your review and am hopeful for a reply.
Here's the C# Script...which works perfectly client side...
string StrFileName = (Dts.Variables["User::FileName"].Value.ToString());
StrFileName = Path.GetFileNameWithoutExtension(StrFileName);
string StringSourceFile = (Dts.Variables["User::FilePath"].Value.ToString()) + StrFileName + ".xlsx";
string StringDestinationFile = (Dts.Variables["User::FilePath"].Value.ToString()) + StrFileName + ".xls";
// This initiates the Excel Application
Microsoft.Office.Interop.Excel.Application excelApplication = new Microsoft.Office.Interop.Excel.Application();
// This Opens the Source .xlsx File from Emdeon ePaySmart
Workbook workbook = excelApplication.Workbooks.Open(StringSourceFile, XlUpdateLinks.xlUpdateLinksNever, true, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
// This will Save the Source .xlsx Emdeon ePaySmart File as a .xls File...note xlFileFormat.xlExcel5
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);
// This will Close the Source
workbook.Close(false, Type.Missing, Type.Missing);
// This shuts down the Excel Application
excelApplication.Quit();This should work if you use a proxy to run this package in the Agent; see:
http://www.mssqltips.com/sqlservertip/2163/running-a-ssis-package-from-sql-server-agent-using-a-proxy-account/
Arthur
MyBlog
Twitter -
How to run a SQL Server Agent job step on certain days/frequency
I've a SQL Server Agent job. One of the requirement is that a particular step should only run on certain frequency i.e. Certain Date and time. Any suggestions how can that be done?
GBMyes
1. Make first step as a Transact SQL step. Keep command as below
IF DAY(GETDATE()) = <Your date value>
AND DATEPART(hh,GETDATE()) = <your time hour)
AND DATEPART(minute,GETDATE()) = <your time minute)
SELECT 1
ELSE
RAISERROR 'Job cant be run at this time'
Then for job step properties set the following properties in advanced tab
This would make sure it will quit the job without executing other core steps untill it reaches the required day and time
You can add more conditions in IF based on requirement like if you want time to be on certain second or month to be particular value etc
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
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. :-( -
What SQL Server Agent jobs are currently running and for how long
Is there a way to tell what SQL Server Agent jobs are currently running and for how long? View history isn't working in my case because it's only showing completed jobs. John Schroeder
You can use the "Job Activity Monitor" for doing this. Do the following steps. It will open up the Job Activity Monitor.
1. In Object Explorer, connect to an instance of the SQL Server Database Engine, and then expand that instance.
2. Expand SQL Server Agent.
3. Right-click Job Activity Monitor and click View Job Activity.
4. In the Job Activity Monitor, you can view details about each job that is defined for this server.
In Job Activity Monitor page, we have column called Status. It will indicate whether job is executing or idle. Last Run column will give you the last invocation time of this job.
Use the following link for further reference.
http://msdn.microsoft.com/en-us/library/ms187449.aspx
Thanks,
Sateesh.
Mark Post as helpful if it provides any help.Otherwise,leave it as it is. -
How to run Exe file through Sql server agent job
Hello All
i have 2 servers
1.Application Server
2.Database server
Application server has a .exe file so i wanted to run this exe file through SQL server agent job from database server.
What is the process for run this Exe file
Can you plz suggest me step by step process
KamalWhile i'm trying to implement this below method
Step1 : Right Click SQL Server Agent. Select New -> Job. This will open a wizard to schedule a new
job.
Step2 : Select Steps from options given on the left side of wizard. This is the main place to set your
exe\program as a running step. Give some name to this step, Select Operating System (cmdexec) for the Type and give the full path of exe in Text box for Command.
ex:\\10.11.00.98(your application serverIP)\ch.exe
Thanks vanchan-Please
mark this reply as the answer or vote as helpful, as appropriate, to make it useful for other readers
I got this below error
Message
Executed as user:NJROSJ345\SYSTEM. The process could not be created for step1 of job
(Reason:Access is Denied)The step failed.
But i have sys admin rights on the both the servers
Kamal -
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 -
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
BradI 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!! -
Management Studio Fails when added Integration Services step to SQL Server Agent Job
Hi,
I have two new servers I've setup with Windows Server 2012, SQL Server 2012 SP1, Visual Studio 2012 SP4. I've previously been on SQL 2008 and VS 2008 so this is new to me.
I am finding SSMS is throwing an exception on both machines when i do the following:
1. Go to SQL Server Agent | Jobs
2. Create a new Job.
3. Select Steps and click New Step
4. Change the job type to SQL Server Integration Services Package.
Following error occurs:
TITLE: Microsoft SQL Server Management Studio
The type initializer for '<Module>' threw an exception. (SqlManagerUI)
ADDITIONAL INFORMATION:
The C++ module failed to load.
(DTEParseMgd)
Index was outside the bounds of the array. (DTEParseMgd)
I also find if I take an existing job with SSIS package steps and attempt to edit those steps the same message appears. This issue happens on both my servers as they have been configured almost identically. This doesn't occur when selecting any other job
type.
I've also tried installing cumulative update 8 in a hope that this may fix it but with no success.
As my entire environment is based around SQL Agents running SSIS i'm a little bit concerned, especially since I have some tight deadlines getting these servers running.
I have found nothing relating to this issue. Any help greatly appreciated.
Simon
Below is the detailed error message:
===================================
The type initializer for '<Module>' threw an exception. (SqlManagerUI)
Program Location:
at Microsoft.SqlServer.Management.SqlManagerUI.DTSJobSubSystemDefinition.Microsoft.SqlServer.Management.SqlManagerUI.IJobStepPropertiesControl.Load(JobStepData data)
at Microsoft.SqlServer.Management.SqlManagerUI.JobStepProperties.UpdateJobStep()
at Microsoft.SqlServer.Management.SqlManagerUI.JobStepProperties.typeList_SelectedIndexChanged(Object sender, EventArgs e)
at System.Windows.Forms.ComboBox.OnSelectedIndexChanged(EventArgs e)
at System.Windows.Forms.ComboBox.set_SelectedIndex(Int32 value)
at System.Windows.Forms.ComboBox.set_SelectedItem(Object value)
at Microsoft.SqlServer.Management.SqlManagerUI.JobStepProperties.InitializeStepCombo()
at Microsoft.SqlServer.Management.SqlManagerUI.JobStepProperties.InitializeData()
at Microsoft.SqlServer.Management.SqlManagerUI.JobStepProperties.OnInitialization()
at Microsoft.SqlServer.Management.SqlMgmt.ViewSwitcherControlsManager.SetView(Int32 index, TreeNode node)
at Microsoft.SqlServer.Management.SqlMgmt.ViewSwitcherControlsManager.SelectCurrentNode()
at Microsoft.SqlServer.Management.SqlMgmt.ViewSwitcherControlsManager.InitializeUI(ViewSwitcherTreeView treeView, ISqlControlCollection viewsHolder, Panel rightPane)
at Microsoft.SqlServer.Management.SqlMgmt.LaunchForm.InitializeForm(XmlDocument doc, IServiceProvider provider, ISqlControlCollection control)
at Microsoft.SqlServer.Management.SqlMgmt.LaunchForm..ctor(ISqlControlCollection control, IServiceProvider provider)
at Microsoft.SqlServer.Management.SqlManagerUI.JobSteps.editJobStep_Click(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.RunDialog(Form form)
at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
at System.Windows.Forms.Form.ShowDialog()
at Microsoft.SqlServer.Management.SqlMgmt.RunningFormsTable.RunningFormsTableImpl.ThreadStarter.StartThread()
===================================
The C++ module failed to load.
(DTEParseMgd)
Program Location:
at <CrtImplementationDetails>.LanguageSupport.Initialize(LanguageSupport* )
at .cctor()
===================================
Index was outside the bounds of the array. (DTEParseMgd)
Program Location:
at _getFiberPtrId()Hi,
I hadn't installed CU3 however as a test i tried installing CU4 and this didn't help. Since my first emails i have more issues that have brought a complete hault to the upgrade project.
If i double click on a package to run it manually I basically get the same issue. This means i have no way of running any packages except throught VS.
I've also found that regardless of the order of the software installs it still fails. It's related to SP1 of SQL and SP4 of VS.
I'm on Server 2012. When install in the following order SQL 2012, SQL SP1, VS2012, BIDS, VS SP4 i have no problem until VS SP4 is installed. If i install VS SP4 then BIDS it also fails at the last step. If i install all the VS and BIDS software first, then
SQL then SQL SP1 it fails at the SQL SP1 step.
This means i could actually install everything and either ignore the SQL SP1 or the VS SP4 and i'd be fine however this is not really a solution as i will never be able to patch the software and once live this is very dangerous.
I am still surprised there is no obvious solution to this. I'm only installing MS software on a fresh box and only installing 5 pieces of software (including the SPs). I would have though if this was an issue others would have come across it too.
Has anyone else installed all these components and got them working on the same OS. I believe early on in my testing i installed these in Windows Server 2008 and didn't have the issue.
Regards.
Simon. -
I've searched and can't find the answer to this, would like to post it in the appropriate forum. (Using SQL Server 2008R2) I'm having trouble with a long string of email addresses in one of my SQL Server Agent Jobs. I'd like to edit it for readability but
can't find a way to do it. Currently smashing all the addresses together works, The job executes and returns the correct data and sends the desired emails, but if I try a continuation character it sends emails to the first person on the list, then no
others.
It works fine when all the email addresses have to be in one long string with no spaces. (Example below) Hard to read/edit.
,@recipients ='[email protected];[email protected];[email protected];[email protected];[email protected];[email protected];[email protected];[email protected];[email protected];[email protected];[email protected];[email protected];[email protected]'Prashanth, This runs every two hours five days a week for the last two years. The only problem I have with it is that the line of email addresses is difficult to read and edit when employees leave and are replaced.
Thanks for looking at this for me - We like it because it's easy for smart phone users to read when they're out and about. EDITED TO ADD: Although this interface wraps the address line, in Microsoft's SQ: Server Agent, the line just stretches off to the
right apparently infinitely. DietSquirt
--Query for updates to QC db mail
--Delivers results in body of email
SET NOCOUNT ON;
use QC
Declare @bodytext nvarchar(150)
exec msdb.dbo.sp_send_dbmail
@profile_name = 'Send Mail'
,@recipients ='[email protected];[email protected];[email protected];[email protected];[email protected];[email protected];[email protected];[email protected];[email protected];[email protected];[email protected];[email protected];[email protected]'
,@reply_to = [email protected]'
,@subject = 'Updates to QC - ALL LOCATIONS'
,@execute_query_database = QC
,@attach_query_result_as_file = 0
,@query_result_header= 0
, @query_result_no_padding = 1
,@query_result_width = 6500
,@query_result_separator = ' '
,@query =
SET NOCOUNT ON
declare @startdate datetime
,@enddate datetime
,@Location nvarchar(20)
set @startdate = DATEADD (hour , -12 , GETDATE() )
set @enddate = GETDATE()
select
'' Updates to QC''
select
[The main query goes here] -
Can't launch executable from SQL Server Agent Job
I'm trying to launch an .exe from SQL Server Agent Job and basically nothing happens. I created a job, with 1 step, type is Operating System (CmdExec), run as sql agent service account, and in the command box I typed "start notepad" (no quotes). The job owner is set to administrator. I manually start the job, it processes successfully yet notepad does not launch. I've tried with other .exe's and result is the same. Any advice? Thanks!
I tried several things and not just with notepad, I tried a couple other small executables. I've tried:
c:\notepad --(I copied it to c:\ thinking it maybe it's not finding the file.)
c:\notepad.exe
notepad.exe
start notepad
start notepad.exe
and also launching it from a batch file.
If I use just notepad the job hangs saying it's executing and I have to stop it. If I use start notepad it comes back as executed but actually nothing happens, ie, notepad does not launch. I've tried different security settings within SQL Server (ie assigning all available default roles to the login at the same time and individually one at a time) with identical results. SQL Server is loging in with local administrator priviledges and so is SQL Server Agent. My settings are the default installation settings (for Windows Server 2003 and SQL Server 2005) except that I read the BOL page "Configuring SQL Server Agent" which indicates the permissions needed for the following:
Adjust memory quotas for a process
Act as part of the operating system
Bypass traverse checking
Log on as a batch job
Log on as a service
Replace a process level token
And they have been set. Still the same. BTW, I get the same result when trying to launch the file using xp_cmdshell with all the variations, and the proxy account for xp_cmdshell has been set to a login with administrator priviledges....
I think it's some security setting in Windows Server, if only because I think I've tried all the settings within SQL Server...
BTW, also, nothing is setup for Proxies under the SQL Server Agent node, but I don't think I should need to if I'm using the administrator level login... -
Running .exe file on remote computer using SQL server Agent JOb
I am trying to run exec file on a remote server by using sql server Agent job,
what is the best way to do this
kConfigure it as an operating system job step:
http://technet.microsoft.com/en-us/library/ms190264.aspx
Alternate: build an SSIS package and schedule it as a job.
Kalman Toth Database & OLAP Architect
SELECT Video Tutorials 4 Hours
New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012 -
SSIS Package Fails when Scheduled as a SQL Server Agent Job
I have an SSIS package that runs without any problems when executed through BIDS.
However, when I schedule the SSIS as an Agent job, it fails completely or part way through. When it partially runs, the part that it is failing on is a Script Task that moves the source data file to an archive folder (on the same server).
I have tried using my domain account as the owner of the job, then the job fails straight off and I get an error:
Unable to determine if the owner (Domain\MyID) of job JobName has server access (reason: Could not obtain information about Windows NT group/user 'Domain\MyID'
If I change the owner to the 'sa' account , then the job partially runs, but then fails because 'sa' is a SQL account and does not have access to the filesystem.
I have managed to get it to work by using the SQL2008_Local account and granting modify permissions to the affected folders.
My question is - what is the advised way of doing this?
Thanks
GaryHi Garyv.King,
When you see a SSIS package fails running in a SQL Agent job, you need to first consider the following conditions:
1. The user account that is used to run the package under SQL Server Agent differs from the original package author.
2. The user account does not have the required permissions to make connections or to access resources outside the SSIS package.
For more detailed information about the issue, please following this KB article:
An SSIS package does not run when you call the SSIS package from a SQL Server Agent job step
http://support.microsoft.com/kb/918760
You can check SQL Server Agent’s activity logs, Windows Event logs and SSIS logs to get more clues. Also the tool Process Monitor is helpful to track the cause of registry or file access related issues.
The following 4 issues are common encountered in the SSIS forum.
1. The package's Protection Level is set to EncryptSensitiveWithUserKey but your SQL Server Agent service account is different from the SSIS package creator.
2. Data source connection issue.
3. File or registry access permission issue.
4. No 64-bit driver issue.
For more information about it, please see:
How do I troubleshoot SSIS packages failed execution in a SQL Agent job:
http://social.technet.microsoft.com/Forums/en-US/sqlintegrationservices/thread/e13c137c-1535-4475-8c2f-c7e6e7d125fc
Thanks,
Eileen -
SQL SERVER AGENT JOB ERROR - SSIS PACKAGE
Hi ,
I have a SQL server agent job which runs SSIS package as the daily job. The SSIS package contains multiple child package. Its a master package which calls other SSIS package. The master package calls 23 SSIS packages, few of the packages runs in parallel.
I am getting the below 2 different errors more frequently. It fails only in the production server, I scheduled the job in UAT server, it did not fail. Also when we run the master package with out sql agent job, it did not fail.
Error 1 :
R6025 - pure virtual function call. The return value was unknown. The process exit code was 255. The step failed.
Error 2 : The step did not generate any output. The return value was unknown. The process exit code was -1073741819. The step failed.
We tried browsing for the answers ,no luck. It failing in live , so we need to run the package manually in live server every time.
Please help me to resolve this issue. Thanks in advance.
Regards,
Dhivya SivakumarHi Vijeth,
Thanks for your reply.
1) Run the Package manually and check whether it runs successfully. -
No Failures. Package completed succesfully
2) If Step 1 is successful,
a) Point the same package to the UAT database and run it and check whether it runs successfully or not. -
We tried to schedule the package almost for 1 month. No failures in UAT.
b) In UAT database, point to the Production database and run the package. - I am not sure, if i can do this.I will try and let you know the result.
These steps will help us identify whether the problems lies within the package or the Environment.
3) Run the Package manually in production Environment using dtexec utilily. -
No Failures. Success.
4) Check the ID used to run the SQL Agent job and modify to an account with elevated permissions or GRANT more permissions to the existing ID. -
The account used currently is having all the privileges. Its the most powerful user in live DB.
Regards,
Dhivya S -
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
Maybe you are looking for
-
Problem with text size on search pages, too small, the rest of the computer is good
the text and the images on the computer is in a good size in general, but on search pages in Firefox is too small, sometime it starts larger and then turn small in a few seconds ..... on facebook page the text is ok in size. How can we increase the t
-
Help me squash this bug please
Post Author: eseidel CA Forum: General Hi, Im using VS2005 CR. After playing around with my program for a while I think I have discovered a bug. I just don't know if it's me or Crystal? When I run the program and set the parameters and then generate
-
Problems copying text from Acrobat...
Hi, anyone know why, when I select text in a pdf and paste it into InDesign, some of the capitals seem to randomly become lowercase? Running Acrobat Pro 9 V9.4.0 Any help much appreciated. RP
-
Displaying results...
I have need to do the following, is step 3 possible: 1. Ask for Text Get input from the user - Done 2. Run Shell Script - Done *_3. Display Text results in a dialog box - Any idea how this can be done? I would to save this as an app, so I do not want
-
Aperture books chnage the format
Can we change the format of the books from landscape to portrait