SQL Server Agent and Jobs and executing @EventData
I have a SQL Server Agent Job and within it a Job Step which states "Execute Report Subscriptions" and a command which has...
exec msdb.dbo.sp_start_job '6FF53AED-855F-43AB-9FB7-064062B8012E' --9:07 subscription
GO
WAITFOR DELAY '00:08';
Now, I find within SQL Server Agent the Job '6FF53AED-855F-43AB-9FB7-064062B8012E' and its step command which is...
exec [ReportServer].dbo.AddEvent @EventType='TimedSubscription', @EventData='ca4e5410-2758-4a1a-9b06-513821e0d962'
How can I drill-down further into the @EventData 'ca4e5410-2758-4a1a-9b06-513821e0d962' to see what it does? I do not see 'ca4e5410-2758-4a1a-9b06-513821e0d962' within SQL Server Agent and Jobs or am I way off base here as to what exactly the @EventData
parameter seems to be?
Thanks for your review and am hopeful for a reply.
Hi ITBobbyP,
According to your description, you need to know the what does SQL Server Reporting Services do when fire a subscription, right?
When you create a subscription several things are added to the RS server
A row is placed in the Subscriptions table identifying the name of the report, along with parameter settings, data driven query info and so on to process the subscription
A row is placed in the Schedule and ReportSchedule tables with the timing of the subscription
A SQL Server Agent job is created to control the scheduled execution of the report, and this is stored in the sysjobs and sysjobsteps of the MSDB database.
When the subscription runs several things happen
The SQL Server Agent job fires and puts a row in the Event table in the RS catalog with the settings necessary to process the subscription
The RS server service has a limited number of threads (2 per CPU) that poll the Event table every few seconds looking for subscriptions to process
When it finds an event, it puts a row in the Notifications table and starts processing the subscription
Please refer to the links below to see the details.
http://blogs.msdn.com/b/deanka/archive/2009/01/13/diagnosing-and-troubleshooting-subscriptions.aspx
http://blogs.msdn.com/b/deanka/archive/2010/02/16/troubleshooting-subscriptions-part-ii-using-the-report-services-trace-log-file.aspx
Regards,
Charlie Liao
TechNet Community Support
Similar Messages
-
Will Sql Server Agent start job when previous instance is running?
Just as an example, I have a job that is set to run every 5 minutes. The job takes 30 minutes to complete. So sql server agent executes the job at 9:30AM. Will the job run again at 9:35AM even though the previous instance hasn't completed?
In my case, I would like to reproduce what Task Scheduler already has, which is to
not begin a new instance until the previous instance has completed. When the previous instance completes, then 5 minutes later, the job will be run again.
Thanks.
VMApparently, it will skip it until the job is completed: http://stackoverflow.com/questions/865042/will-a-sql-server-job-skip-a-scheduled-run-if-it-is-already-running
VM -
Hi
We have scheduled job running a console application daily. For some reason on Sunday's only the scheduler says it ran successfully but no email confirmation, table entries and the normal processing occurs.
This happens only on a Sunday and for no explained reason. No problem on the day before or after...
I think this also happened with Daylight Savings adjustment. Has anyone else encountered this?
Any ideas or suggestions
Environment is:
Microsoft SQL Server 2008 R2 (SP2) - 10.50.4000.0 (X64) Jun 28 2012 08:36:30 Copyright (c) Microsoft Corporation Enterprise Edition (64-bit) on Windows NT 6.1 <X64> (Build 7601: Service Pack 1) (Hypervisor)
Thanks in advance
GeorgeMichelle
Thanks for your reply. I was out sick all last week.
I too suspected our network and/or security features or maintenance.
Me and my manager decided to include a text log file which we append certain key points for each iteration when the vb.net console app runs to hopefully determine what is happening sporadically.
I created many errors and scenarios ( DB and network connectivity, unable to send email) and they were caught and appended to the logfile so all I can do is wait to see when/if this occurs.
Sincerely
George
NOTE: DISREGARD THE "Failure Sending mail" exceptions they disabled it for security reasons and it only works for production jobs and special users
DailySerial Feed started at 11:48:34 AM
Attempting DB Connection 11:48:34 AM
DB Connection successful 11:48:34 AM
completed successful 11:48:38 AM Record count: 153 processed
DailySerial Feed started at 11:49:37 AM
Attempting DB Connection 11:49:37 AM
DB Connection successful 11:49:37 AM
completed successful 11:49:42 AM Record count: 0 processed
SendEmail failed 11:49:44 AM - Failure sending mail.
DailySerial Feed started at 4:37:42 PM
Attempting DB Connection 4:37:42 PM
DB Connection successful 4:37:44 PM
completed successfully 4:37:44 PM Record count: 153 processed
SendEmail failed 4:37:45 PM - Failure sending mail.
System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 10.8.86.78:25
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception)
DailySerial Feed started at Monday12:50:29 PM
Attempting DB Connection 12:50:29 PM
DB Connection successful 12:50:29 PM
completed successfully 12:50:30 PM Record count: 153 processed
SendEmail failed Monday12:50:31 PM - Failure sending mail.
System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 10.8.86.78:25
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception)
DailySerial Feed started on Monday, March 23, 2015 - 2:31:40 PM
Attempting DB Connection 2:31:40 PM
Connection failed Monday 2:31:55 PM for: server=ITDEVPTENSDEV\sqlserver2008r2yada;database=ICES;Trusted_Connection=True - A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found
or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
SendEmail failed Monday 2:31:55 PM - Failure sending mail.
System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 10.8.86.70:25
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception)
Rollback Exception 2:31:55 PM - unable to OPEN the DB ConnectionA network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct
and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) - - Connection established
SendEmail failed Monday 2:31:55 PM - Failure sending mail.
System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 10.8.86.70:25
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception)
DailySerial Feed started on Monday, March 23, 2015 - 2:36:38 PM
Attempting DB Connection 2:36:38 PM
DB Connection successful 2:36:38 PM
DailySerial feed completed 2:36:38 PM Record count: 0 processed
SendEmail failed Monday 2:36:38 PM - Failure sending mail.
System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 10.8.86.70:25
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception)
DailySerial Feed started on Monday, March 23, 2015 - 2:37:03 PM
Attempting DB Connection 2:37:03 PM
DB Connection successful 2:37:03 PM
DailySerial feed completed 2:37:03 PM Record count: 153 processed
SendEmail failed Monday 2:37:03 PM - Failure sending mail.
System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 10.8.86.70:25
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception)
Imports System.IO
Imports System.Net
Imports System.Text
Imports System.Data.SqlClient
Imports System.Data.Common
Public Module DailySerialFeed
Dim attempts As Integer = 0
Dim sb As New StringBuilder
Dim myconnection As New SqlConnection
Dim m_SqlConnStr As String = My.Settings.SqlConnStr
Dim strCardAFCExportBatchIDGuid As String
Dim LogMessage As String
Dim TotalExtracted As Integer
Public sSource As String = "DailySerialFeed"
Public Slog As String = "Application"
Public sEvent As String = ""
Public ErrText As String
Public sMachine As String = "."
Dim mySqlTransaction As SqlTransaction
Dim time As DateTime = DateTime.Now
Dim format As String = "MMM ddd d HH:mm yyyy"
Dim LogFile As StreamWriter ' SFTPData\AFC\DailySerialFeedLog.TXT
Dim ExceptionString As String
Public Sub Main()
Try
LogFile = New StreamWriter(My.Settings.LogFile, FileMode.Append) ' append to file
LogFile.WriteLine("") '(Environment.NewLine)
LogFile.WriteLine("DailySerial Feed started on " & Now.ToString("D") & " - " & Now.ToLongTimeString)
strCardAFCExportBatchIDGuid = System.Guid.NewGuid().ToString
LogFile.WriteLine(" Attempting DB Connection " & Now.ToLongTimeString)
OpenDBConnection()
LogFile.WriteLine(" DB Connection successful " & Now.ToLongTimeString)
mySqlTransaction = myconnection.BeginTransaction("OuterTransaction")
'PadSerialNumbers() Lewycky 7/19/13 Zero digit padding for 8 or 9 digital serial numbers Disabled
'RemoveZeroSerial() ' Lewycky 11/3/11 remove zero serial numbers from being sent to AFC now in FlagSerialforExtract module
FlagSerialforExtract()
ExtractFlaggedSerialFile()
mySqlTransaction.Commit()
CloseDBConnection()
StageforFTPAndArchive()
sb.AppendLine(" " & "DailySerial Feed completed. Record count: " & TotalExtracted & " processed")
LogFile.WriteLine(" DailySerial feed completed " & Now.ToLongTimeString & " Record count: " & TotalExtracted & " processed")
Catch ex As Exception
If Not mySqlTransaction Is Nothing Then
LogFile.WriteLine(" Rollback Exception " & Now.ToLongTimeString & " - " & ex.Message)
mySqlTransaction.Rollback("OuterTransaction")
End If
sb.AppendLine(" " & "Problem encountered with DailySerialFeed extract :" & ex.Message & " - " & ErrText)
LogFile.WriteLine(" Rollback Exception " & Now.ToLongTimeString & " - " & ex.Message & " - " & " - " & ErrText)
Finally
SendEmail(RTrim(sb.ToString))
' if dbconnection is still open during exception/error force it closed
If myconnection.State = ConnectionState.Open Then
LogFile.WriteLine(" Closing DB Connection(2) " & Now.ToLongTimeString & " - ")
CloseDBConnection()
End If
LogFile.Close()
End Try
End Sub
Public Sub OpenDBConnection()
myconnection = New SqlConnection(m_SqlConnStr)
Try
myconnection.Open()
Catch ex As Exception
Dim strErr As String = ex.Message
LogFile.WriteLine(" Connection failed " & Now.ToString("dddd ") & Now.ToLongTimeString & " for: " & My.Settings.SqlConnStr & " - " & strErr)
SendEmail(strErr)
Throw New System.Exception("unable to OPEN the DB Connection" & strErr)
Finally
ErrText = "Connection established "
'sb.AppendLine("Connection established ")
End Try
End Sub
Public Sub FlagSerialforExtract()
' Update the batch of records in CardAFCExport table with the GUID related to that batch created earlier
' Now included in the same Commmand - removal of any zero digit serial numbers previously in another module
Dim myCommand As New SqlCommand
Try
' lewycky pull serial numbers prior to midnite 1 day lag
' lewycky use the GUID created in the Main() for updating in dbo.CardAFCExport indetifying qualifying serial
' numbers for this daily batch to ultimately be sent to AFC and to receive back detailed metrocard data
myCommand = New SqlCommand("DELETE from CardAFCExport where CAST(CardSerialNumber as bigint)= 0;Update CardAFCExport Set CardAFCExportBatchID = '" & strCardAFCExportBatchIDGuid & "' where
CardAFCExportBatchID is null and CreatedDate < DATEADD(dd,0,datediff(dd,0,getdate()))", myconnection, mySqlTransaction)
myCommand.ExecuteNonQuery()
Catch ex As Exception
Dim strErr As String = ex.Message
ErrText = "unable to update the batch with its GUID " & strErr & " "
sb.AppendLine("unable to update the batch with its GUID." & " ")
sb.AppendLine("Error Message : " & ex.Message)
LogFile.WriteLine(" FlagSerialforExtract failed " & Now.ToLongTimeString & " - " & strErr)
Throw New System.Exception(strErr)
Finally
ErrText = "Serial numbers flagged with GUID successfully "
'sb.AppendLine("Serial numbers flagged with GUID successfully ")
End Try
End Sub
'Public Sub PadSerialNumbers() 7/19/13 Lewycky Disabled per Serial numbers becoming duplicated if the enter with and without zeros
' Dim myCommand As New SqlCommand
' Try
' myCommand = New SqlCommand("update CardAFCExport set CardSerialNumber = '0' + CardSerialNumber where CardSerialNumber in (SELECT CardSerialNumber FROM CardAFCExport where LEN(cardserialnumber) = 9 )",
myconnection, mySqlTransaction)
' myCommand.ExecuteNonQuery()
' myCommand = New SqlCommand("update CardAFCExport set CardSerialNumber = '00' + CardSerialNumber where CardSerialNumber in (SELECT CardSerialNumber FROM CardAFCExport where LEN(cardserialnumber) = 8 )",
myconnection, mySqlTransaction)
' myCommand.ExecuteNonQuery()
' Catch ex As Exception
' Dim strErr As String = ex.Message
' ErrText = "unable to pad serial serial numbers" & strErr
' sb.AppendLine("unable to pad serial serial numbers" & " ")
' sb.AppendLine("Error Message : " & ex.Message & " ")
' SendEmail(strErr)
' Throw New System.Exception(strErr)
' Finally
' ErrText = "Serial numbers padded successfully "
' sb.AppendLine("Serial numbers padded successfully ")
' End Try
'End Sub
'Public Sub RemoveZeroSerial()
' now in the FlagSerialforExtract module
' ' Zero Serial number deletion still needed ( 8 & 9 digit ) otherwise 999 records will be generated on ICES when AFC returns file
' Dim myCommand As New SqlCommand
' Try
' myCommand = New SqlCommand("DELETE from CardAFCExport where CAST(CardSerialNumber as bigint)= 0", myconnection, mySqlTransaction)
' ' myCommand = New SqlCommand("delete from CardAFCExport where CardSerialNumber = '0000000000' ", myconnection, mySqlTransaction)
' myCommand.ExecuteNonQuery()
' Catch ex As Exception
' Dim strErr As String = ex.Message
' ErrText = "unable to remove Zero Serial Numbers" & strErr
' sb.AppendLine("unable to remove Zero Serial Numbers.")
' sb.AppendLine("Error Message : " & ex.Message)
' SendEmail(strErr)
' Throw New System.Exception(strErr)
' Finally
' ErrText = "Zero serial numbers removed "
' sb.AppendLine("Zero serial numbers removed successfully ")
' End Try
'End Sub
Public Sub ExtractFlaggedSerialFile()
' extract metrocard serial number feed in ascending order and w/o dupes
Dim column1 As String
Dim TotalRecords As Integer = 0
Dim myCommand As New SqlCommand
Dim objStreamWriter As StreamWriter
Try
' 7/19/13 - Lewycky modification to remove duplicates and omit the same serial number entered as a 8 or 9 digit number instead of the
' required 10 digit for AFC w/o extra DML updates due to Serialnumber being a Unique value per batch
myCommand = New SqlCommand("SELECT DISTINCT RIGHT('00' + Cardserialnumber,10) Cardserialnumber FROM CardAFCExport where CardAFCExportBatchID = '" & strCardAFCExportBatchIDGuid & "' order by
CardSerialNumber", myconnection, mySqlTransaction)
' myCommand = New SqlCommand("SELECT distinct CardSerialNumber FROM CardAFCExport where CardAFCExportBatchID = '" & strCardAFCExportBatchIDGuid & "' order by CardSerialNumber", myconnection,
mySqlTransaction)
myCommand.CommandType = CommandType.Text
objStreamWriter = File.CreateText(My.Settings.AFCExportInterimFile.ToString)
Dim myreader As SqlDataReader = myCommand.ExecuteReader
While myreader.Read
column1 = myreader.Item("CardSerialNumber").ToString
objStreamWriter.WriteLine(column1)
TotalExtracted = TotalExtracted + 1
End While
myreader.Close()
objStreamWriter.Close()
' Extract file is now created
myCommand = New SqlCommand("INSERT INTO CardAFCExportBatch (CardAFCExportBatchID, TotalRecords, ExportedDate, CreatedDate, CreatedBy) values ( '" & strCardAFCExportBatchIDGuid & "', " +
TotalExtracted.ToString + ", GETDATE(), GETDATE(), '00000000-0000-0000-0000-000000000000')", myconnection, mySqlTransaction)
myCommand.ExecuteNonQuery()
Catch ex As Exception
Dim strErr As String = ex.Message
ErrText = "unable to create extract from CardAFCExport last input record " & TotalRecords & "' '" & strErr
LogFile.WriteLine(" ExtractFlaggedSerialFile failed " & Now.ToLongTimeString & " - " & ErrText)
LogMessage = ErrText
sb.AppendLine(ErrText)
sb.AppendLine("Error Message : " & ex.Message)
SendEmail(LogMessage)
Throw New System.Exception("unable to create extract from CardAFCExport last record " & TotalRecords)
Finally
ErrText = "Batch Info updated & Extract created. Rec count: " & TotalExtracted
End Try
End Sub
Public Sub StageforFTPAndArchive()
'KD - Getting file ready for AFC ftp. Also archive the file with date time stamp.
Try
Dim strFileName As String = Path.GetFileNameWithoutExtension(My.Settings.AFCExportInterimFile)
Dim strDirectory As String = Path.GetDirectoryName(My.Settings.AFCExportInterimFile)
Dim strTimeStamp As String = Now.ToString("MMddyyyyhhmmss")
Dim strExtension As String = Path.GetExtension(My.Settings.AFCExportInterimFile)
'KD : copy AFCSWIPE.TXT file to outgoing folder
System.IO.File.Copy(My.Settings.AFCExportInterimFile, My.Settings.AFCExportFile.ToString, True)
'KD : make yyyyMMDD_hhmmss_ICE_SWP.TXT file to outgoing folder for MCO (Randy Steiner)
System.IO.File.Copy(My.Settings.AFCExportInterimFile, My.Settings.AFCExportFilePath + Now.ToString("yyyyMMdd_hhmmss") + "_ICE_SWP.TXT", True)
'KD : Archive file in archieve folder with date time stamp
System.IO.File.Move(My.Settings.AFCExportInterimFile, My.Settings.AFCExportArchivePath + strFileName + "_" + strTimeStamp + strExtension)
Catch ex As Exception
sb.AppendLine("Error occurred in StageforFTPAndArchive." + Chr(13) + Chr(10))
sb.AppendLine("Error Message : " & ex.Message + Chr(13) + Chr(10))
LogFile.WriteLine(" StageforFTPAndArchive failed " & Now.ToLongTimeString & " - " & ex.Message)
Throw ex
End Try
End Sub
Sub SendEmail(ByVal msg As String)
' Dim myWebRequest As WebRequest
' Dim myStreamReader As StreamReader
Dim strSubject, strBody As String
Dim myMailMessage As Mail.MailMessage
Dim mySmtpClient As Mail.SmtpClient
strBody = msg
' Get subject from settings and replace placeholder with current date
strSubject = My.Settings.EmailSubject
strSubject = strSubject.Replace("<date>", FormatDateTime(Now(), DateFormat.ShortDate))
Try
myMailMessage = New Mail.MailMessage(My.Settings.EmailFrom, My.Settings.EmailTo, strSubject, strBody)
If My.Settings.EmailCC <> "" Then myMailMessage.CC.Add(My.Settings.EmailCC)
myMailMessage.IsBodyHtml = My.Settings.EmailHtml
' Send email
mySmtpClient = New Mail.SmtpClient()
mySmtpClient.Host = My.Settings.SmtpServer()
mySmtpClient.Send(myMailMessage)
Catch ex As Exception
Console.Write("could not send Mail-" & ex.Message)
'ExceptionString = "Exception type " & ex.GetType.ToString & Environment.NewLine & "Exception message: " & ex.Message + Environment.NewLine
'& "Stack trace: " + ex.StackTrace + Environment.NewLine;
'LogFile.WriteLine(ExceptionString)
'LogFile.WriteLine(" SendEmail failed " & Now.ToLongTimeString & " - " & ex.Message.ToString & ex.InnerException.ToString)
' w.o stack trace ?
LogFile.WriteLine(" SendEmail failed " & Now.ToString("dddd ") & Now.ToLongTimeString & " - " & ex.Message.ToString & Environment.NewLine & (DirectCast(ex.InnerException,
System.Exception).InnerException.ToString))
End Try
End Sub
Public Sub CloseDBConnection()
Try
myconnection.Close()
Catch ex As Exception
Dim strErr As String = ex.Message
LogFile.WriteLine(" CloseDBConnection failed " & Now.ToString("dddd ") & Now.ToLongTimeString & " for: " & My.Settings.SqlConnStr & " - " & strErr)
Throw New System.Exception("unable to CLOSE the DB Connection" & strErr)
Finally
ErrText = " DB Conn closed & Serial Feed completed normally "
End Try
End Sub
End Module -
Schedule SSIS packages as job in SQL Server Agent errors
Hi, I am using SQL Server 2008 R2 and created few SSIS packages and schedule them using SQL Server Agent and every time I try to schedule packages via SQL Server Agent my jobs keep failing. I am using domain/ione as the owner and when I invoke the job on
ServerA let's say and the job gets executed by domain/ServerA$ and fails as it does not have enough privileges. How do I fix this issue firstly without the proxy and why is the job being executed by domain/ServerA$ when the owner & user who invokes
it is domain/ione?
Thanks in advance............
IoneHi Ione,
The owner of any SQL jobs should be SA or any other non-expiring account
If you do not want the proxy used, then add the needed priveleges.
The owner of the job is one, the SSIS step gets executed by the account the Agent is running under.
Arthur
MyBlog
Twitter -
Execution of a batch file within SSIS fails in Sql Server Agent Job
Hi All,
I have an SSIS Package, which simply runs a batch file , the code for the batch file is
MOVE \\cambosnapp01\Claims\Analytics\NICB\CurrentAlerts\* \\cambosnapp01\Claims\Analytics\NICB\AlertsArchive
If i run the SSIS package manually it runs fine and moves all the files, however if i run the package through a Sql Agent Job it fails with the following error
The directory "\\Cambosnapp01\Claims\Analytics\NICB" does not exist
This is where the batch file is located, i am not able to understand if the SSIS package is running fine then why not the sql agent job?
I also tried to create a sql agent job using Operating System(CmdExec) and i copied my batch file code in the command i am running it as SQL Server Agent Service Account , and here it fails as
Executed as user: CAMELOT\svcDW. Access is denied. Process Exit Code 1. The step failed
Does this mean this user doesnt have the rights to excute a batch file? how did this user even come up i am not running it from this user i am running it from SQL Server Agent Service Account . I dont know who is that user and if he even has the rights to
execute a batch file.
Can someone please help me with any solution for this? either first way or second way anything works fine for me.
ThanksHi SQLDEV,
According to your description, you are experiencing the issue "The directory "\\Cambosnapp01\Claims\Analytics\NICB" does not exist" when run the SSIS package
in SSMS by using SQL Server Agent, right?
In your scenario, since you can run the package in SSDT manually. So as per my understanding, the issue can be caused by that the Services Account of your SQL Server Agent do not have the permission on that folder. To avoid this issue, you can set the folder
permission for your SQL Server Agent account or change the services account to an account who have the corresponding permission. Please refer to the link below to see the details.
https://msdn.microsoft.com/en-us/library/bb727008.aspx
https://msdn.microsoft.com/en-us/library/ms345578.aspx
Regards,
Charlie Liao
If you have any feedback on our support, please click
here.
Charlie Liao
TechNet Community Support -
Sql server agent jobs deleting problem
hi team,
while i am trying to deleting in the sql server agent disabled jobs through sql query, that time i am getting below error.
query is:
delete from dbo.sysjobs
where version_number=5
error message:
Msg 547, Level 16, State 0, Line 1
The DELETE statement conflicted with the REFERENCE constraint "FK__sysjobsch__job_i__32E0915F". The conflict occurred in database "msdb", table "dbo.sysjobschedules", column 'job_id'.
The statement has been terminated.Hi,
You can delete multiple jobs
by using SQL Server Management Studio:
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, select the jobs you want to delete, right-click your selection, and choose Delete jobs.
For your information:
Delete One or More Jobs
http://technet.microsoft.com/en-us/library/ms187850.aspx
Thanks.
Tracy Cai
TechNet Community Support -
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.
ITBobbyP85I 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. -
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. -
SQL Server Agent Job And Database Mail - Error formatting query, probably invalid paramters
We have a stored procedure that we are trying to call with a SQL Server Agent Job. The stored procedure calls Database Mail. This is SQL 2008. The execute task is simply:
USE [Production]
GO
EXEC [dbo].[JOB_EMAIL_SCHEDULED_REPORTS]
GO
When the job runs, it is erroring out immediately, with the error:
Execute as user: NT AUTHORITY\NETWORK SERVICE. Error formatting query, probably invalid paramters [SQLSTATE 42000] (Error 22050). The step failed.
When we go into SQL Server Manager and just execute the SQL query, it works though. Something within the SQL Server Agent job, and Database Mail is causing problems. Any ideas? Thanks.Justin,
If you use SSMS then the procedure is executed under a different user when compared to running using a SQL Server Agent Job.
Isolate the problem by running a SQL Server agent job that sends a mail. Also check if the NT Authority\Network Service account is
in good standing. Look at the below thread with a similar problem that had an expired account.
http://social.msdn.microsoft.com/Forums/en/sqltools/thread/bac7ecee-a156-4313-b532-ba15813a0700
http://SankarReddy.com/ -
HOw to avoid DeadLocks when you schedule a Sql Server Agent Job and calling SSIS packages
Hi All,
I have scheduled 2 packages in in Sql Server Agent jobs .
First job which is having Package 1 executing at 11 AM and where I am inserting the data in the table.
Second job which is having Package 2 executing at 12 AM and where I am updating the data in the table based on the first job inserted records.
When I am executing my first job it taking more time and executing till 12 AM and from 12 AM my job 2 also starting ,so getting deadlocks conflicts because inserting happening from job1 and updating happening from Job 2.
How to avoid deadlocks and fix the issue.
Please Suggest .
Thanks & Regards,
AnandHi Anand,
Here is another solution, you can set the Job 2 not to run based on a schedule, and create another SQL Server Agent Job which starts at 12 AM and run with a specified time interval to execute a SQL statement in which you do the following steps:
1. Get the status information of Job 1 using the statement:
DECLARE @i int;
EXEC @i = msdb.dbo.sp_help_job @job_name = ‘Job Name'
2. If the value of @i is 1 which means the status of job 1 is success and current time is, then start the job 2. So, the statement is as follows:
IF @I = 1
EXEC msdb.dbo.sp_start_job @job_name= ‘Job Name’
Regards,
Mike Yin
TechNet Community Support -
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 -
Error While executing a SSIS package which contains a script task through SQL Server Agent job
Hi,
I have a SQL Server 2012 SSIS package with a script task along with other tasks [data flow, execute sql tasks ]. When I manually executed the job through BIDS, its completed successfully.
Then I have automated the execution of the package through SQL Server Agent Job. But when I executed the package through SQL Agent job, it runs successfully for all the tasks except script task. When it comes to execute the Script Task, it is getting failed
with the below error message.
"Error: 2012-08-29 12:45:14.67
Code: 0x00000001
Source: Script Task
Description: Exception has been thrown by the target of an invocation.
End Error
DTExec: The package execution returned DTSER_FAILURE (1).
Started: 12:45:10 PM
Finished: 12:45:14 PM
Elapsed: 4.353 seconds
I have installed the SSIS on the 64-bit environment and SSIS service is running. Also I tried to run the job through 32 bit [job option] but I am getting the above error in all cases.
Any help will be greatly appreaciated !
Thanks,
Navin
- naveen.reddyHi Arthur,
My script task access the excel files in a network share, refresh them all and save them. When I execute the ETL manually or thru DTEXEC, it is executing successfully. I am facing the issue when I am executing thru SQL Agent Job only. Logging also showing
the same error.
"Error: 2012-08-23 12:45:14.67
Code: 0x00000001
Source: Script Task
Description: Exception has been thrown by the target of an invocation.
End Error
DTExec: The package execution returned DTSER_FAILURE (1).
Started: 12:45:10 PM
Finished: 12:45:14 PM
Elapsed: 4.353 seconds
- naveen.reddy -
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
Pankajdomain\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 -
I created a SSIS package that litterally just export a view onto a server. The database, ssis and location are all on the same server. When I run the SSIS package in SSIS works perfectly. When I run it in SQL it doesnt work. I have read way to many articles
trying to figure out how to fix this. The best was something about a proxy. I really just want to run the package through as a JOb through SQL Server Agent. Any directions would be great.
Message
Executed as user: NT Service\SQLSERVERAGENT. Microsoft (R) SQL Server Execute Package Utility Version 11.0.2100.60 for 64-bit Copyright (C) Microsoft Corporation. All rights reserved. Started: 3:15:00 PM Error: 2015-03-05
15:15:00.41 Code: 0xC0011007 Source: {A9456201-8A74-44C9-839F-1CD3CC02637F} Description: Unable to load the package as XML because of package does not have a valid XML format. A specific XML parser error will
be posted. End Error Error: 2015-03-05 15:15:00.41 Code: 0xC0011002 Source: {A9456201-8A74-44C9-839F-1CD3CC02637F} Description: Failed to open package file
"C:\Users\lasadmin\Documents\Visual Studio 2010\Projects\Integration Services Project1\Integration Services Project1\Package.dtsx"
due to error 0x80070005 "Access is denied.". This occurs when loading a package and the file cannot be opened or loaded correctly into the XML document. This can be the result of specifying an incorrect file name when calling LoadPackage
or the specified XML file has an incorrect format. End Error Could not load package "C:\Users\Documents\Visual Studio 2010\Projects\Integration Services Project1\Integration Services Project1\Package.dtsx" because of error 0xC0011002.
Description: Failed to open package file "C:\Users\Documents\Visual Studio 2010\Projects\Integration Services Project1\Integration Services Project1\Package.dtsx" due to error 0x80070005 "Access is denied.". This occurs when
loading a package and the file cannot be opened or loaded correctly into the XML document. This can be the result of specifying an incorrect file name when calling LoadPackage or the specified XML file has an incorrect format. Source: {A9456201-8A74-44C9-839F-1CD3CC02637F}
Started: 3:15:00 PM Finished: 3:15:00 PM Elapsed: 0.015 seconds. The package could not be found. The step failed.
thanks
bryanNo I am still a bit confused.
1.) I created both Jobs as the admin.
2.) The NT Service\SQLSERVERAGENT is by default for whatever reason is running the job when I scheduled
it.
3.) Just so that I could try and run the job I tried to follow the article that was given in the first post. I got to the second script and I get the below error.
Msg 14529, Level 16, State 1, Procedure sp_add_proxy, Line 45
Proxy "ARSHADALI-LAP\SSISProxyDemoUser" is not a valid Windows user.
Msg 14262, Level 16, State 1, Procedure sp_verify_proxy_identifiers, Line 51
The specified @proxy_name ('SSISProxyDemo') does not exist.
Is there a more simpler way this seems almost like over kill.
bryan
Is that domain machine or is it in work group?
Please Mark This As Answer if it solved your issue
Please Vote This As Helpful if it helps to solve your issue
Visakh
My Wiki User Page
My MSDN Page
My Personal Blog
My Facebook Page -
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
-
Global Temp Table or PL/SQL Table
I am trying to determine if this can be done only using PL/SQL table. If not, will the usage of the global temp table affects the performance. Here is the situation, I have a data block that is based on a stored procedure. This stored procedure will
-
Photoshop CS4 in Windows 7 bug runing batch actions
I been using Photoshop CS4 in Vista with no problems, but now my problem is when I installed windows 7 and opened 60 photos and apply an action and try to do other things while PS is working in the batch, when I try to change to other window I get ba
-
Zen Vision M Power Adapter questi
I have a Zen Micro with the USB power adapter, i.e., the one that has an AC connection on one end a mini usb connection on the other. Can I use this to recharge a Zen Vision M? Thanks,Mark
-
New search criteria for old (standard) node?
Is it possible to create script, which adds new search criteria for old (standard) node? CustomSearchExtensionHandler.jsx gives example of custom search criteria for custom node. But it is not clear for me, how to add new search criteria over standar
-
Exchange 2013 issue with High memory Usage on Mailbox server post SP1 update.
So we have been chugging along fine since Feb 2 2014. I performed a migration from 2010 from the UK to the US doing "incremental" mailbox moves. (get in contact with me if you want to know how. But we moved 400 Mailboxes averaging at 2gb a piece fro