Powershell sql agent jobs
Hi, I am trying to check status of sql agent jobs on various servers using powershell howerver I successfully list all the servers but cant seem to be able to
Write-Output
$job.name
for any of the servers including the monitoring server that I am absolutely sure I have all required permissions. I get no errors which makes troubleshooting that much
more difficult. Any ideas? Thank you
foreach($sqlserver
in $sqlservers)
#***THIS WORKS***
write-host
$sqlserver.instancename
$srv
= New-Object ('Microsoft.SqlServer.Management.Smo.Server')
$sqlserver;
foreach ($job
in $srv.Jobserver.Jobs)
$jobName
= $job.Name;
$jobEnabled
= $job.IsEnabled;
#***THIS DOESN'T WORK***
write-host
$jobName
write-host
$job.Name
Paula
I figured it out
The line
$srv = New-Object ('Microsoft.SqlServer.Management.Smo.Server') $sqlserver;
should be:
$srv = New-Object ('Microsoft.SqlServer.Management.Smo.Server') $sqlserver.InstanceName ;
Paula
Similar Messages
-
SQL Agent jobs status for multiple servers using Powershell.
Hi All,
I am following website link:
http://www.toadworld.com/platforms/sql-server/b/weblog/archive/2013/09/17/powershell-script-to-monitor-a-service-on-a-group-of-servers-html-formatted-email-output.aspx
I require to gather status details about all the SQL Agent jobs in the environment on multiple SQL Servers.
I tried to edit the script using:
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SMO")
$sqlServerName = 'localhost\developer'
$sqlServer = New-Object Microsoft.SqlServer.Management.Smo.Server($sqlServerName)
foreach($job in $sqlServer.JobServer.Jobs)
$job | select Name, OwnerLoginName, IsEnabled, LastRunDate, LastRunOutcome, DateCReated, DateLastModified
but SQL Agent jobs are not reflecting in the mail output...
requesting help...!!
Thanks in Advance.
HuntI've created a new script for you. Let me know if you've any questions
Create the function
Function Get-SQLJobHTMLReport
param(
[String]$ComputerList,[string]$Outputfile,[String]$To,[String]$From,[string]$SMTPMail
New-Item -ItemType file $Outputfile -Force
# Function to write the HTML Header to the file
Function writeHtmlHeader
param($fileName)
$date = ( get-date ).ToString(‘yyyy/MM/dd’)
Add-Content $fileName “<html>”
Add-Content $fileName “<head>”
Add-Content $fileName “<meta http-equiv=’Content-Type’ content=’text/html; charset=iso-8859-1′>”
Add-Content $fileName ‘<title>Service Status Report </title>’
add-content $fileName ‘<STYLE TYPE=”text/css”>’
add-content $fileName “<!–”
add-content $fileName “td {“
add-content $fileName “font-family: Tahoma;”
add-content $fileName “font-size: 11px;”
add-content $fileName “border-top: 1px solid #999999;”
add-content $fileName “border-right: 1px solid #999999;”
add-content $fileName “border-bottom: 1px solid #999999;”
add-content $fileName “border-left: 1px solid #999999;”
add-content $fileName “padding-top: 0px;”
add-content $fileName “padding-right: 0px;”
add-content $fileName “padding-bottom: 0px;”
add-content $fileName “padding-left: 0px;”
add-content $fileName “}”
add-content $fileName “body {“
add-content $fileName “margin-left: 5px;”
add-content $fileName “margin-top: 5px;”
add-content $fileName “margin-right: 0px;”
add-content $fileName “margin-bottom: 10px;”
add-content $fileName “”
add-content $fileName “table {“
add-content $fileName “border: thin solid #000000;”
add-content $fileName “}”
add-content $fileName “–>”
add-content $fileName “</style>”
Add-Content $fileName “</head>”
Add-Content $fileName “<body>”
add-content $fileName “<table width=’100%’>”
add-content $fileName “<tr bgcolor=’#CCCCCC’>”
add-content $fileName “<td colspan=’4′ height=’25′ align=’center’>”
add-content $fileName “</td>”
add-content $fileName “</tr>”
add-content $fileName “</table>”
# Function to write the HTML Header to the file
Function writeTableHeader
param($fileName)
Add-Content $fileName “<tr bgcolor=#CCCCCC>”
Add-Content $fileName “<td width=’10%’ align=’center’>ServerName</td>”
Add-Content $fileName “<td width=’50%’ align=’center’>Name</td>”
Add-Content $fileName “<td width=’10%’ align=’center’>OwnerLoginName</td>”
Add-Content $fileName “<td width=’10%’ align=’center’>IsEnabled</td>”
Add-Content $fileName “<td width=’10%’ align=’center’>LastRunDate</td>”
Add-Content $fileName “<td width=’10%’ align=’center’>LastRunOutcome</td>”
Add-Content $fileName “<td width=’10%’ align=’center’>DateCReated</td>”
Add-Content $fileName “<td width=’10%’ align=’center’>DateLastModified</td>”
Add-Content $fileName “</tr>”
Function writeHtmlFooter
param($fileName)
Add-Content $fileName “</body>”
Add-Content $fileName “</html>”
Function writeDiskInfo
param($filename,$Servername,$name,$OwnerLoginName,$IsEnabled,$LastRunDate,$LastRunOutcome,$DateCReated,$DateLastModified)
Add-Content $fileName “<tr>”
Add-Content $fileName “<td bgcolor=’#FF0000′ align=left ><b>$servername</td>”
Add-Content $fileName “<td bgcolor=’#FF0000′ align=left ><b>$name</td>”
Add-Content $fileName “<td bgcolor=’#FF0000′ align=left ><b>$OwnerLoginName</td>”
Add-Content $fileName “<td bgcolor=’#FF0000′ align=left ><b>$IsEnabled</td>”
Add-Content $fileName “<td bgcolor=’#FF0000′ align=left ><b>$LastRunDate</td>”
Add-Content $fileName “<td bgcolor=’#FF0000′ align=left ><b>$LastRunOutcome</td>”
Add-Content $fileName “<td bgcolor=’#FF0000′ align=left ><b>$DateCReated</td>”
Add-Content $fileName “<td bgcolor=’#FF0000′ align=left ><b>$DateLastModified</td>”
Add-Content $fileName “</tr>”
writeHtmlHeader $Outputfile
Add-Content $Outputfile “<table width=’100%’><tbody>”
Add-Content $Outputfile “<tr bgcolor=’#CCCCCC’>”
Add-Content $Outputfile “<td width=’100%’ align=’center’ colSpan=8><font face=’tahoma’ color=’#003399′ size=’2′><center><strong> SQL Server Agent Job Details</strong></font></td>”
Add-Content $Outputfile “</tr>”
writeTableHeader $Outputfile
#Change value of the following parameter as needed
Foreach($ServerName in (Get-Content $ComputerList))
$sqlServer = New-Object Microsoft.SqlServer.Management.Smo.Server($ServerName)
foreach($item in $sqlServer.JobServer.Jobs)
Write-Host $sqlServer $item.name $item.OwnerLoginName $item.IsEnabled $item.LastRunDate $item.LastRunOutcome $item.DateCReated $item.DateLastModified
writeDiskInfo $Outputfile $sqlServer $item.name $item.OwnerLoginName $item.IsEnabled $item.LastRunDate $item.LastRunOutcome $item.DateCReated $item.DateLastModified
Add-Content $Outputfile “</table>”
writeHtmlFooter $Outputfile
Function sendEmail
param($from,$to,$subject,$smtphost,$htmlFileName)
[string]$receipients=”$to”
$body = Get-Content $htmlFileName
$body = New-Object System.Net.Mail.MailMessage $from, $receipients, $subject, $body
$body.isBodyhtml = $true
$smtpServer = $smtphost
$smtp = new-object Net.Mail.SmtpClient($smtphost)
$smtp.Send($body)
write-output “Email Sent!!”
$date = ( get-date ).ToString(‘yyyy/MM/dd’)
sendEmail -from $From -to $to -subject “Service Status – $Date” -smtphost $SMTPMail -htmlfilename $Outputfile
Get-SQLJobHTMLReport -ComputerList f:\powersql\server.txt -SMTPMail hq.abc.com -To [email protected] -From [email protected] -Outputfile F:\Powersql\jobs.htm
--Prashanth -
Is there a way to get long running SQL Agent jobs information using powershell?
Hi All,
Is there a way to get long running SQL Agent jobs information using powershell for multiple SQL servers in the environment?
Thanks in Advance.
--HuntI'm running SQL's to fetch the required details and store it in centralized table.
foreach ($svr in get-content "f:\PowerSQL\Input\LongRunningJobsPowerSQLServers.txt"){
$dt = new-object "System.Data.DataTable"
$cn = new-object System.Data.SqlClient.SqlConnection "server=$svr;database=master;Integrated Security=sspi"
$cn.Open()
$sql = $cn.CreateCommand()
$sql.CommandText = "SELECT
@@SERVERNAME servername,
j.job_id AS 'JobId',
name AS 'JobName',
max(start_execution_date) AS 'StartTime',
max(stop_execution_date)AS 'StopTime',
max(avgruntimeonsucceed),
max(DATEDIFF(s,start_execution_date,GETDATE())) AS 'CurrentRunTime',
max(CASE WHEN stop_execution_date IS NULL THEN
DATEDIFF(ss,start_execution_date,stop_execution_date) ELSE 0 END) 'ActualRunTime',
max(CASE
WHEN stop_execution_date IS NULL THEN 'JobRunning'
WHEN DATEDIFF(ss,start_execution_date,stop_execution_date)
> (AvgRunTimeOnSucceed + AvgRunTimeOnSucceed * .05) THEN 'LongRunning-History'
ELSE 'NormalRunning-History'
END) 'JobRun',
max(CASE
WHEN stop_execution_date IS NULL THEN
CASE WHEN DATEDIFF(ss,start_execution_date,GETDATE())
> (AvgRunTimeOnSucceed + AvgRunTimeOnSucceed * .05) THEN 'LongRunning-NOW'
ELSE 'NormalRunning-NOW'
END
ELSE 'JobAlreadyDone'
END)AS 'JobRunning'
FROM msdb.dbo.sysjobactivity ja
INNER JOIN msdb.dbo.sysjobs j ON ja.job_id = j.job_id
INNER JOIN (
SELECT job_id,
AVG
((run_duration/10000 * 3600) + ((run_duration%10000)/100*60) + (run_duration%10000)%100)
+
STDEV
((run_duration/10000 * 3600) + ((run_duration%10000)/100*60) + (run_duration%10000)%100) AS 'AvgRuntimeOnSucceed'
FROM msdb.dbo.sysjobhistory
WHERE step_id = 0 AND run_status = 1
GROUP BY job_id) art
ON j.job_id = art.job_id
WHERE
(stop_execution_date IS NULL and start_execution_date is NOT NULL) OR
(DATEDIFF(ss,start_execution_date,stop_execution_date) > 60 and DATEDIFF(MINUTE,start_execution_date,GETDATE())>60
AND
CAST(LEFT(start_execution_date,11) AS DATETIME) = CAST(LEFT(GETDATE(),11) AS DATETIME) )
--ORDER BY start_execution_date DESC
group by j.job_id,name
$rdr = $sql.ExecuteReader()
$dt.Load($rdr)
$cn.Close()
$dt|out-Datatable
Write-DataTable -ServerInstance 'test124' -Database "PowerSQL" -TableName "TLOG_JobLongRunning" -Data $dt}
You can refer the below link to refer out-datatable and write-dataTable function.
http://blogs.technet.com/b/heyscriptingguy/archive/2010/11/01/use-powershell-to-collect-server-data-and-write-to-sql.aspx
Once we've the table details, I'm sending one consolidated email to automatically.
--Prashanth -
How do I automatically backup SQL Agent jobs and SSIS packages on the mirror daily?
I have seen this question asked before but I could not find a satisfactory answer. What is the best solution to get your SQL Agent jobs/schedules/etc. and your SSIS packages on the mirror server? Here's the details:
Server A is the principal with 2 DBs mirrored over to server B. Everything is fine and dandy, DBs are synched and all good. In Disaster Recovery testing, we need to bring up server B, which now will serve as the principal. Server A is inaccessible. Now,
we need all our jobs that are setup in server A to be in server B, ready to go, but disabled. We also need all our SSIS packages properly stored. Yes, we store our packages in the MSDB in server A.
Now, I can see a few answers coming my way.
1- Backup the MSDB to server B. When you bring server B up as principal in DR, restore the MSDB. All your jobs,schedules,steps, SSIS packages will be there. Is this possible? Can this be done on server B without rendering it incapable of serving as the principal
for the mirrored DBs? My fear with this option is that there may be information in the MSDB itself about the mirroring state of the DBs? Or is all that in the Master DB? Have you tried this?
2- Right click each job, script them out, re-create them on server B... No, thank you very much. :) I am looking for an AUTOMATED, DAILY backup of the jobs and SSIS packages. Not a manual process. Yes, we do change jobs and packages quite often and doing
the job twice on two servers is not an option.
3- Use PowerShell.. Really? Are we going back to scripting at the command prompt like that, that fast?
Since I fear option number 3 will be the only way to go, any hints on scripts you guys have used that you like that does what I need to do?
Any other options?
Any help GREATLY appreciated. :-) I can be sarcastic but I am a good guy..
Raphael
rferreiraI would go with option number 3. Once you have a script simple run it....
param([string]$serverName,[string]$outputPath)
function script-SQLJobs([string]$server,[string]$outputfile)
[reflection.assembly]::LoadWithPartialName("Microsoft.SqlServer.Smo") | Out-Null
$srv = New-Object Microsoft.SqlServer.Management.Smo.Server("$server")
$db = New-Object Microsoft.SqlServer.Management.Smo.Database
$scrp = New-Object Microsoft.SqlServer.Management.Smo.Scripter($srv)
$scrp.Options.ScriptDrops = $FALSE
$scrp.Options.WithDependencies = $TRUE
$jobs = $srv.JobServer.get_Jobs()
$jobs=$jobs | Where-Object {$_.Name -notlike "sys*"}
foreach($job in $jobs)
$script=$job.Script()
$script >> $outputfile
"GO" >> $outputfile
---script-SQLJobs "SQLSRV12" "C:\Jobs\test.txt"
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Blog:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance -
SQL Agent Job failing - not using credentials in the config file for Data source
Hi
We have an SSIS pkg, that is secheduled as SQL Agent job using proxy account. The pkg contanins data source for connecting different SQL servers and the proxy account do not have access to the external DBs. The data source credentials are stored in the Config
file.
Why the job is not using the credentials in the config file and try to use the proxy account and failing.
Do the proxy account need access to all the external dbs in the pkg, and then what is the purpose of the config file.
I am sorry, i am not SSIS person trying to understand. If any one can explain tha will be great!!
Thank you!
VRPlease take a look at these URLs:
Schedule a Package by using SQL Server Agent
SSIS package does not run when called from a SQL Server Agent job step
Cheers,
Saeid Hasani
Database Consultant
Please feel free to contact me at [email protected] as well as on Twitter and Facebook.
[My Writings on TechNet Wiki] [T-SQL Blog] [Curah!]
[Twitter] [Facebook] [Email] -
How to Create a SQL Agent Job For A SSIS Package with Sql Server Authentication
Hi ALl,
I have a SSIS package which basically has a data flow task in which i pull the data from one server and copy it into another server and my source server is the one where i dont have windows authentication and i have to only use a sql server authentication
. This package runs fine if i click the server connection properties type the password and save it.
Now, my task is to set up a sql agent job which basically uses a proxy account and takes this package from the file system and runs it.But when i try to run this package, its failing with an error saying
"Login Failed For rpt5user" where rpt5user is the username for my sql server authentication of the source connection.
Can someone please help me with any suggestions on how to do this?
I have heard that we can achieve it by using xml config file which i have never used and i am trying to google around but for no luck.
So, If someone can please throw any suggestions or ideas on this it would be great.
ThanksYou need to add password as a config item and set it from the file source or sql table
see this as an example
http://blogs.msdn.com/b/runeetv/archive/2009/12/22/ssis-package-using-sql-authentication-and-dontsavesensitive-as-protectionlevel.aspx
Please Mark This As Answer if it solved your issue
Please Mark This As Helpful if it helps to solve your issue
Visakh
My MSDN Page
My Personal Blog
My Facebook Page -
Pass value from SQL agent job step
Hi
I have created one SSIS package and I am scheduling the same using SQL Agent job. Now I want to pass one value from SQL job agent and want to use that value in SSIS package and then run that package. Can someone point to the solution.
Aniruddha http://aniruddhathengadi.blogspot.com/I have created one parameter on SSIS package named strValue and assigned a empty value "". After that I have created one SQL job and step wherein I have set the value to "Nike" for parameter under Parameters tab.
Now I am expecting Nike value which I have set on SQL job step should get reflected on SSIS package when I am running my job. Am I doing anything wrong ?
Aniruddha http://aniruddhathengadi.blogspot.com/
Not sure what's going wrong but you can have quick look at below step by step tutorial:
Parameterizing Connections and Values at Runtime Using SSIS Environment Variables (via SQL Agent)
Cheers,
Vaibhav Chaudhari -
Sql agent job getting file access denied error
I'm not sure if this question belongs in this forum. Please move it if you want to.
Here is my question. I have an ssis package that is running into an error at the file system task trying to move a file. The package is deployed to the catalog and I am running the package using the stored procedure
[SSISDB].[catalog].[start_execution] @execution_id
When I execute this stored proc in Management Studio while logged in under a sysadmin, everything works fine. But when I call the same TQL in SQL Agent job, I get a file access denied error. This has something to do with the id that is getting used
to run the package and I am not sure how to track that down. Any help would be appreciated.
I've check the windows permission on both the id that is running the SQL Agent and SQL SSIS Service. Both seem to have the right windows permission.Please see:
http://support.microsoft.com/kb/918760 -
SSIS Package will only run as SQL Agent Job when I have remote desktop to server open.
Hey guys, so I have another problem to add to the already massive 'SSIS/SQL Server Agent Job' pile. After days of searching, I can't seem to find anything specific to my problem though.
The setup is as follows: a SSIS package that refreshes and saves excel files that are hosted on a server. The package runs fine on the local machine, using BIDS on the server, and will even work as a SQL Agent Job on the server IF there is a remote
desktop connection to the server. To elaborate, if I simply run the job as you would normally do it will fail and give the below error. If I run the job while either myself, or a different machine, has a remote desktop connection to the server where the
job is scheduled - it will run successfully.
Below is the error from the History File of the job. Any help would be greatly appreciated.
Source: Refresh Excel and Save Description: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.InteropServices.COMException (0x8000401A): Retrieving
the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 8000401a. at ST_79772452677f4de1852d5ffbba3e5232.csproj.ScriptMain.ExcelRefresh(String FileName)
at ST_79772452677f4de1852d5ffbba3e5232.csproj.ScriptMain.Main() --- End of inner exception stack trace --- at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct&
sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags
invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo
culture, String[] namedParams) at System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, CultureInfo culture) at Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTATaskScriptingEngine.ExecuteScript()
UPDATE:
In my previous post the Identity in DCOM Config file for Microsoft Excel was set as The Interactive User. The job was working only when I had a remote connection to the server open.
If I set the Identity to 'This User' and use the username and password of the server login account, it will work as a scheduled job without needing an open remote connection to the server. So it works, great! but I have reservations setting this
for all instances of Excel for the server. I'm sure other users have different accounts they use for running Excel. Any suggestions around this?Hi LiamSexton,
It should be the server-side Automation of Office issue described in the following KB article:
http://support.microsoft.com/kb/257757
Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit
unstable behavior and/or deadlock when Office is run in this environment.
User Identity: Office applications assume a user identity when the applications are run, even when Automation starts the applications. The applications try to initialize toolbars, menus, options, printers, and some add-ins based on settings in the user
registry hive for the user who launches the application. Many services run under accounts that have no user profiles (such as the SYSTEM account or the IWAM_[servername] accounts). Therefore, Office may not initialize correctly on startup. In this situation,
Office returns an error on the CreateObject function or the CoCreateInstance function. Even if the Office application can be started, other functions may not work correctly if no user profile exists.
To work around the issue, you can refer to the following alternative introduced in the article:
Most server-side Automation tasks involve document creation or editing. Office 2007 supports new Open XML file formats that let developers create, edit, read, and transform file content on the server side. These file formats use the System.IO.Package.IO
namespace in the Microsoft .NET 3.x Framework to edit Office files without using the Office client applications themselves. This is the recommended and supported method for handling changes to Office files from a service.
Regards,
Mike Yin
TechNet Community Support -
SQL Agent Job Fails To Run A SSIS Package
Hi,
I have a SSIS Package which basically truncates the table and re-loads it from an excel file .The job runs fine if i run it manually on visual studio.However, i try to shcedule a SQL Agent job and it fails with the following error
Description: The requested OLE DB provider Microsoft.ACE.OLEDB.12.0 is not registered. If the 64-bit driver is not installed, run the package in 32-bit mode. Error code: 0x00000000. An OLE DB record is available. Source: "Microsoft
OLE DB Service Components" Hresult: 0x80040154 Description: "Class not registered". End Error Error: 2014-10-22 14:47:41.15 Code: 0xC001002B Source: Package1 Connection manager "Excel
Connection Manager 1" Description: The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine.
I am exactly not sure what it means?
Can someone please help me with any suggestions on this.
Thanks.Thanks for trying that option . It looks like there is an issue with the driver . Can you try to install/uninstall the driver once again from http://www.microsoft.com/en-us/download/details.aspx?id=13255.
You can try this URL , where he has the similar problem
https://social.msdn.microsoft.com/Forums/sqlserver/en-US/8a40d329-0611-44e2-ae51-3bd9b0901754/ssis-the-requested-ole-db-provider-microsoftaceoledb120-is-not-registered?forum=sqlintegrationservices
Please mark this as answer if this helps to solve your problem -
Hi,
I can able ran the SSIS package in BIDS, since set to false in Run64BitRuntime property.
Then I created SQL server Agent job I tried the following ways
Step 1:
Type is set as SQL Server Integration Services Packages,
Run as - SQL Server Agent Service Account
Package source - FileSystem
then Execution option tab I selected 32 bit runtime
and then run the job I am getting the below error
Message
Executed as user: CIT\svc_CS_SS2008Agent. Microsoft (R) SQL Server Execute Package Utility Version 11.0.2100.60 for 32-bit Copyright (C) Microsoft Corporation. All rights reserved. Started: 7:29:17 AM Error: 2013-11-28
07:29:18.57 Code: 0xC0014020 Source: Example Connection manager "DataSource.DataExtract" Description: An ODBC error -1 has occurred. End Error Error: 2013-11-28 07:29:18.57
Code: 0xC0014009 Source: Imports20_OAC_Gifts Connection manager "DataSource.DataExtract" Description: There was an error trying to establish an Open Database Connectivity (ODBC) connection with the
database server. End Error Error: 2013-11-28 07:29:18.59 Code: 0x0000020F Source: DFT_Example ODBC_SRC Example [11] Description: The AcquireConnection method call to the connection
manager DataSource.DataExtract failed with error code 0xC0014009. There may be error messages posted before this with more information on why the AcquireConnection method call failed. End Error Error: 2013-11-28 07:29:18.59
Code: 0xC0047017 Source: DFT_Example SSIS.Pipeline Description: ODBC_SRC Example failed validation and returned error code 0x80004005. End Error Error: 2013-11-2
Step 2:
Type - Operating sytem (CmdExec)
Run as - Sql Server agent service account
Command - C:\Program Files\Microsoft SQL Server\110\DTS\Binn\dtexec.exe /FILE "D:\Example\Example.dtsx" /x86 /CHECKPOINTING OFF /REPORTING E
then run the job I am getting the below error
Message
Executed as user: MIS\svc_CS_SS2008Agent. Microsoft (R) SQL Server Execute Package Utility Version 11.0.2100.60 for 64-bit Copyright (C) Microsoft Corporation. All rights reserved. Started: 6:37:58 AM Error: 2013-11-28
06:37:58.94 Code: 0xC0014020 Source: Example Connection manager "DataSource.DataExtract" Description: An ODBC error -1 has occurred. End Error Error: 2013-11-28 06:37:58.96
Code: 0xC0014009 Source: Example Connection manager "DataSource.DataExtract" Description: There was an error trying to establish an Open Database Connectivity (ODBC) connection with the database server.
End Error Error: 2013-11-28 06:37:59.01 Code: 0x0000020F Source: DFT_Example ODBC_SRC Example [11] Description: The AcquireConnection method call to the connection manager DataSource.DataExtract
failed with error code 0xC0014009. There may be error messages posted before this with more information on why the AcquireConnection method call failed. End Error Error: 2013-11-28 06:37:59.07 Code: 0xC0047017
Source: DFT_Example SSIS.Pipeline Description: ODBC_SRC Example failed validation and returned error code 0x80004005. End Error Error: 2013-11-28 06:37:59.12 Code: 0xC004700C
Source: DFT_Example SSIS.Pipeline Description: One or more component failed validation. End Error Error: 2013-11-28 06:37:59.16 Code: 0xC0024107 Source: DFT_Example
Description: There were errors during task validation. End Error DTExec: The package execution returned DTSER_FAILURE (1).Started: 6:37:58 AM Finished: 6:37:59 AM Elapsed: 1.373 seconds. Process Exit Code 1.
The step failed.
Note:
My source server is 32 bit and development environment in 64 bit
if anybody have idea please share your knowledgeHi BIRam,
Based on the current information, the issue may be caused by the factor that the SQL Server Agent Service Account doesn’t have access to the MySQL server. Try to create a SQL Server Agent Proxy account that has sufficient permission on the MySQL server.
In addition, also pay attention to the package protection level setting.
For more information, please see:
http://social.technet.microsoft.com/Forums/sqlserver/en-US/e13c137c-1535-4475-8c2f-c7e6e7d125fc/how-do-i-troubleshoot-ssis-packages-failed-execution-in-a-sql-agent-job?forum=sqlintegrationservices.
Regards,
Mike Yin
TechNet Community Support -
Management Studio Crashing When Adding SSIS Step to SQL Agent Job
Hi
I am running Windows Server 2012, SQL Server 2012 SP2 CU2, SQL Server Management Studio 2012 and Visual Studio 2012.
I have existing SQL Agent Jobs that run SSIS packages and they all currently work. However, if I try to edit them or add a new job that uses a SSIS package Management Studio will crash. I was having this problem a couple weeks ago when I was still
on SQL Server 2012 SP1 CU9, so I updated to SQL Server 2012 SP2 CU2 and the problem went away for a couple weeks and I was able to add new SQL Agent jobs that run SSIS packages. But now it issue is back and there are no new updates to try and fix it.
Has anyone seen this before and found a reliable fix to it?
Steps to cause crash:
1) Open new SQL Agent Job
2) Select Steps and add a New Step
4) Change the job type to SQL Server Integration Services Package.
5) SSMS Crashes
Error Message Below:
===================================
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.WmReflectCommand(Message& m)
at System.Windows.Forms.ComboBox.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.SendMessage(HandleRef hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at System.Windows.Forms.Control.SendMessage(Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.Control.ReflectMessageInternal(IntPtr hWnd, Message& m)
at System.Windows.Forms.Control.WmCommand(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.UserControl.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.CallWindowProc(IntPtr wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at System.Windows.Forms.NativeWindow.DefWndProc(Message& m)
at System.Windows.Forms.Control.DefWndProc(Message& m)
at System.Windows.Forms.Control.WmCommand(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ComboBox.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.SqlManagerUI.JobSteps.newJobStep_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()
at <CrtImplementationDetails>.LanguageSupport._Initialize(LanguageSupport* )
at <CrtImplementationDetails>.LanguageSupport.Initialize(LanguageSupport* )
Thanks,
AnthonyI ended up being able to work around this without having to recreate everything on a Windows Server 2008 R2. I did this by setting up an azure point to site VPN from
my computer to the Windows Server 2012 hosted on azure. I was then able to connect SSMS from my computer to the Azure VM allowing me to create and edit new SQL Agent jobs that run SSIS packages. Here are the steps to do this
1) Connect to the VPN from another machine besides the server.
2) Open SSMS using the runas.exe command with the Domain\User Name of a Windows account on the server.
- Ex. Runas.exe /netonly /user:DOMAIN\USER "C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\ManagementStudio\Ssms.exe"
2) Connect to the VM's Database Engine using its internal IP address and the port that SQL Server is listening on (default is 1433) and a SQL Login
setup on the server.
-Ex IP, 10.0.0.1,1433
3) Create a new job with the type SQL Server Integration
Services Package. Select the package source (SSIS Catalog). I could not get the server to be automatically discovered here so enter the server’s internal IP address and select the package you want to run.
4) Right click the new SQL Agent Job and choose Script Job As, CREATE To, New Query Window. This is the script to create the
SQL Agent Job and it needs to be edited to contain the Name of the server on the internal IP address that was used earlier.
5) Edit the @command= line of the script to use the server name. Change the highlighted part below to the server name.
- Ex . @command=N'/ISSERVER "\"\SSISDB\PACKAGELOCATION\"" /SERVER
"\"10.0.0.1\"" /Par "\"$ServerOption::LOGGING_LEVEL(Int16)\"";1 /Par "\"$ServerOption::SYNCHRONIZED(Boolean)\"";True /CALLERINFO SQLAGENT /REPORTING E',
- Change to this
- @command=N'/ISSERVER "\"\SSISDB\PACKAGELOCATION\""
/SERVER SERVERNAME /Par "\"$ServerOption::LOGGING_LEVEL(Int16)\"";1 /Par "\"$ServerOption::SYNCHRONIZED(Boolean)\"";True /CALLERINFO SQLAGENT /REPORTING E',
6) Now change the name of the package in the script and run it. Now the new package can be edited in the GUI to change things like the schedule and alerts. Also you
can edit any existing packages. -
User created SQL Agent Job that uses linked server with Windows authentication
OK, here's what I want to do, but not sure exactly what I need to accomplish it.
Environment
Windows 2008 Enterprise
SQL 2012 Enterprise
SQL Server & SQL Agent running under AD account (which has local Windows Administrative privileges...yes, I know..bad!)
Linked server to Teradata utilizing AD account mappings (the linked server works successfully and each windows login is mapped to a Teradata LDAP login)
Requirement
Allow non sysadmins to create SQL Agent jobs which execute TSQL statements which use OPENQUERY(LDAPLinkedServer, '....) syntax
I've already given the non sysadmins the necessary permissions to create and run SQL Agent jobs, and I understand that the jobs run under their login context, but I suspect that I'm missing something when it comes to the linked server.
Each windows user could have access to different databases/tables on the Teradata system that even I (the SQL Server sysadmin) don't have access to.
How can I facilitate this functionality? Any ideas?I think I may have been over complicating the Teradata piece. The authentication methodology in Teradata is LDAP, which just means that it authenticates against AD, but you still have to submit your Windows login & password. It doesn't automatically
authenticate you just because you're logged into Windows.
The linked server has the mapping for the individual windows logins like:
Local Login = <domain>.<windows id>
Remote User = <windows id>
Remote Password = <windows password>
This setup requires the user to have to change the passwords in the linked server whenever they change their passwords according to domain policy (every xx days)...but we've created a utility proc that they can use to do this.
So, I'm thinking that Teradata isn't really part of this equation. -
Error with SSIS package running as SQL Agent job
I have a strange issue.
I have a SQL Agent job that execute 5 steps, each step is an SSIS package that imports a CSV file to a temp table, then executes a SQL script to update a production table.
This job runs every 3 mins, every day, and has been for over a year.
Every once in a while it will start failing on step 2. Sometime it only happens for a couple of runs, other times I have to restart the SQL server. Once it corrects itself, it could be months before it happens again, but usually happens every
few weeks.
The error in the job history is: "Unable to bulk copy data. You may need to run this package as an administrator"
Obviously I have all the permissions correct, as it was running successfully every 3 mins before this error suddenly starts. I'm at a loss as to what the problem is. It is always on step 2, which is identical to step 1 except its a different CSV file
going to a different table. As I typed this, it failed twice, then was successful afterwards.
Any ideas where to look for further information? I've checked the event viewer and looked in the SQL logs, nothing stands out at this time.Hi Kerberos35,
It seems to be caused by the UAC feature which makes SSIS use the low-permissions token of the administrator Windows account under which the job runs. This issue is described in the following KB article:
http://support.microsoft.com/kb/2216489/en-us
To resolve the issue, you can install the latest service pack for your SQL Server. To work around this issue, you can also use one of the following two methods:
Method 1: Replace the SQL Server Destination components in the Data Flow Tasks that are failing with OLE DB Destination components that point to the same SQL Server connection manager.
Method 2: Create a SQL Server Agent proxy by using a Windows account that is not a member of the local Administrators group after you assign Create Global Objects permissions to that account.
To do this, follow these steps:
Click Start, point to Administrative Tools, and then click Local Security Policy.
Expand Local Policies, and then click User Rights Assignment.
In the details pane, double-click Create global objects.
In the Local Security Policy Setting dialog box, click Add.
In the Select Users or Group dialog box, click the user accounts that you want to add, click Add, and then click OK two times.
Regards,
Mike Yin
TechNet Community Support -
Unable to Run SSIS Package Through SQL Agent Job
Hi,
I recently upgraded SQL server 2008 R2 to SQL Server 2012. I also upgraded all the packages on the server. The package runs fine from BIDS. However when I try to run the package through the SQL Agent Job it fails with the error below:
Executed as user: A. Microsoft (R) SQL Server Execute Package Utility Version 11.0.2100.60 for 64-bit Copyright (C) Microsoft Corporation. All rights reserved. Started: 11:43:04 PM Could not load package "\FolderA\Package.dtsx"
because of error 0xC00160AE. Description: Connecting to the Integration Services service on the computer "S2345WE" failed with the following error: "Access is denied." By default, only administrators have access to the
Integration Services service. On Windows Vista and later, the process must be running with administrative privileges in order to connect to the Integration Services service. See the help topic for information on how to configure access to the service. Source:
Started: 11:43:04 PM Finished: 11:43:04 PM Elapsed: 0.016 seconds. The package could not be loaded.
Using Windows Authentication I am able to login to Integration services through SSMS. In the SQL Agent job I am using package store to execute the package. I have admin permission on the server. The integration services currently uses my credentials while
running.I am not sure why I am getting this error.
Please advice..
Thanks,
EVA05Hi ,
similar thread - http://social.technet.microsoft.com/Forums/en-US/sqlintegrationservices/thread/25e22c7e-bae0-42e4-b86d-2db7a4af519d
Try this link -
http://msdn.microsoft.com/en-us/library/dd440760%28v=sql.100%29.aspx
sathya --------- Please Mark as answered if my post solved your problem and Vote as helpful if my post was useful.
Maybe you are looking for
-
What can I do! I know servers are busy but if its installing right now before the restart it means its finished downloading from apple servers so I don't understand why it has been installing with two minutes remaining for a really long time now :[ I
-
Policy agent fot apache tomcat opensso
Hi, I am looking for policy agent fot apache tomcat opensso 8 u2. Can anyone post the url for the same
-
Integration Builder configuration.
Dear All, I am new to XI as Basis Administrator. I need to configure Integration Builder for developers. All I have access is to SLD http://<hostname>/sld and SAP GUI. All I know is I need to install JRE with version > 1.4.* and configure w
-
N95 8GB cannot view gallery photos/ uploads photos...
Hiya, I have had the same problem with my N95 8GB with viewing photos in my gallery! I have now got my 5th replacement handset (Orange) since August 29th due to various faults and issues. The main one being trying to transfer photos from my PC to my
-
Brand New 30g Video Ipod...dead right out of the box
So I take my new ipod out of the box and it wont turn on. I plug it up to the outlet charger and the screen lights up but says nothing and does nothing. It makes a little humming noise and gets very very hot also. Plugging it up to computer hasn't he