.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

User proc must start Agent job -- how?

Posted By:      Posted Date: September 19, 2010    Points: 0   Category :Sql Server
My app must allow users to start a SQL Agent job to do a background operation.  I found a discussion on this and attempted to implement the last solution therein:
use [MyDB];

create PROCEDURE dbo.spStartAgentJob
	@pvJobName	nvarchar(100)
	WITH EXECUTE AS 'agentProxy'
EXEC msdb.dbo.sp_start_job @pvJobName

create certificate agentProxy 
    ENCRYPTION BY PASSWORD = 'pGFD4bb925DGvbd2439587y'
    with subject = 'agentProxy'
   , expiry_date='01/01/2100';

      BY CERTIFICATE [agentProxy]
        WITH PASSWORD = 'pGFD4bb925DGvbd2439587y';

alter certificate [agentProxy] 
  remove private key;

backup certificate [agentProxy] 
 to file='c:\temp\agentProxy.cer';

use msdb

create certificate [agentProxy] 
  from file='c:\temp\agentProxy.cer';

create user [agentProxyAuthenticator] 
 from certificate [agentProxy];

grant authenticate to [agentProxyAuthenticator];
grant execute on msdb.dbo.sp_start_job to [agentProxyAuthenticator];

use [MyDB];

exec dbo.spStartAgentJob N'test'
The EXECUTE permission was denied on the object 'sp_start_job', database 'msdb', schema 'dbo'.

Did I miss something?  What is the correct way to accompli

View Complete Post

More Related Resource Links

SQL Server 2008 Agent Fails to start in a Win 2008 Cluster

When I try to bring SQLAGENT Online, I get the following errors: EventID:53 [sqagtres] StartResourceService: Failed to start SQLSERVERAGENT service.  CurrentState: 1 [sqagtres] OnlineThread: ResUtilsStartResourceService failed (status 435) [sqagtres] OnlineThread: Error 435 bringing resource online.   I just did a fresh SQL Cluster install as well.  When I installed the cluster, the service account was good to go.  I cant figure out what is going on.  SQL Server Engine starts fine.  Any ideas?

SQL 2008 R2 clustered instance does not start in single user mode

Hi I am testing the startup of a SQL 2008 R2 clustered instance (Windows 2008 R2) using single user mode but it fails with : Error: 17058, Severity: 16, State: 1. initerrlog: Could not open error log file ''. Operating system error = 3(The system cannot find the path specified.) - I am running the following command from the default sql installation : C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQL01\MSSQL\Binn>sqlservr.exe -c -m -s SQL01 - The cluster service on the passive node has been shutdown. - The SQL Server and SQL Agent services have been set to offline in Failover Cluster Manager. Any assistance greatly appreciated. Regards, PK    

Custom workflows don't start via user accounts

Hi! Topic started here, http://social.msdn.microsoft.com/Forums/en-US/sharepoint2010setup/thread/a51673e5-ec13-408d-b512-4cc98d84fdd8 As adviced copy it  to this subforum. I have the following problem. Custom workflows dont start. In the log there are following errors: Workflow Infrastructure 72fv Unexpected AutoStart Workflow: System.ArgumentException: New instances of this workflow template are currently disallowed. at Microsoft.SharePoint.Workflow.SPWorkflowManager.StartWorkflowElev(Object context, SPWorkflowAssociation association, DateTime elevationTimeUtc, SPWorkflowEvent startEvent, SPWorkflowRunOptions runOptions) at Microsoft.SharePoint.Workflow.SPWorkflowAutostartEventReceiver.<>c__DisplayClass1.<AutoStartWorkflow>b__0(SPSite superUserSite, SPWeb superUserWeb) Workflow Infrastructure 72fv Unexpected AutoStart Workflow: System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.SharePoint.Workflow.SPWorkflowManager.GetEngine(SPWorkflowAssociation association) at Microsoft.SharePoint.Workflow.SPWorkflowManager.StartWorkflowElev(Object context, SPWorkflowAssociation association, DateTime elevationTimeUtc, SPWorkflowEvent startEvent, SPWorkflowRunOptions runOptions) at Microsoft.SharePoint.Workflow.SPWorkflowAutostartEventReceiver.<>c__DisplayClass1.<AutoStartWorkflow>b__0(SPSite superUserSite, SPWeb

Unable to start user profile synchronization service

Hello, I have the following problem. user profile synchronization service doesn't start up, with the following error in log: The service encryption keys could not be found. User Action Verify that the service account has permissions to the following registry key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Forefront Identity Manager\2010\Synchronization Service If the problem persists, run setup and restore the encryption keys from backup. Permissions for registry are availabele. Thank you.    

Unable to validate data in User Agent: Mozilla

Hi All,Thank you for advance.Error Details : User Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows XP)Message: Unable to validate data.Source: System.WebTargetSite: Byte[] GetDecodedData(Byte[], Byte[], Int32, Int32, Int32 ByRef)StackTrace:    at System.Web.Configuration.MachineKeySection.GetDecodedData(Byte[] buf, Byte[] modifier, Int32 start, Int32 length, Int32& dataLength)   at System.Web.UI.ObjectStateFormatter.Deserialize(String inputString)OS Environment : Microsoft Windows Server 2003 Statandard x64 Edition and Service back 1Application Environment : Asp.net 2.0/C#We have lot aspx files but we are getting this error in register and login page only.I added the machineKey in web.config file reference with codeproject article (http://www.codeproject.com/Articles/43637/Weird-Error-Unable-to-Validate-Data-in-ASP-NET-web.aspx)but still i am getting the error.

change snapshot agent user (Agent security)

Hi, we have replicated dbon sql server 2008 (transaction replication) now we want to change the user used for the snapshot agent, from sql Managment studio go to publication property and then agent security and then snapshot agent (now we are using domain user) here we want to use the other option which is " to be run under sql server agent service account" but I couldnt choose this option because its unactive so how we can activate this option for existing replication without restarting the replication (i can use this option for the new replication wizard) Thanks

Unable to start SQL Express 2005 service as a network user

I am trying to start ms sql server 2005 express as a network user from originally starting as local system. I cannot start the service.I have given this network user administrator access to sql express from the sql server surface area configuration "Add New Administrator". I have went into the local users/groups and added this network user to the 3 security groups SQLServer2005MSSQLServerADHelperUser$SQL1SQLServer2005MSSQLUser$SQL1$SQLEXPRESSSQLServer2005MSSQLBrowserUser$SQL1I receive one alert int he event logs/applicationEventID: 26010The server could not load the certificate it needs to initiate an SSL connection. It returned the following error: 0x8009030d. Check certificates to make sure they are valid.I receive five errors in the event logs/applicationEventID: 26014Unable to load user specified certificate. The server will not accept a connection. You should verify that the certificate is correctly installed. See "Configuring Certificate for Use by SSL" in Books Online.EventID: 17182TDSSNIClient initialization failed with error 0x80092004, status code 0x80EventID: 17182TDSSNIClient initialization failed with error 0x80092004, status code 0x1EventID: 17826Could not start the network library because of an internal error in the network library. To determine the cause, review the errors immediately prceding this one in the error log.EventID: 17120SQL Serve

How do I gather user input at the start of a workflow?

I'm a complete sharepoint newbie, so please forgive me :) I have developed a Sharepoint 2007 Sequential workflow in Visual Studio 2010. I have 'bound' it to a particular contact list, and set it such that it will be activated when a contact is edited. (I did this so that I had an easy way of starting the workflow (I just go in and edit a contact)). The workflow itself, on the designer just shows: onWorkflowActivated1 -> codeActivity1 -> logHistoryListActivity1 The workflow works and does the work in the codeActivity1 part. My problem now is how to ask the user for input. At present the code has some hard-coded values in it, for example: Dim emailTemplatePath = "http://en-ecm-jplender/Shared%20Documents/FATF%20Documents/EmailTemplate01.htm" Dim emailTemplate = (New System.Net.WebClient() With {.UseDefaultCredentials = True, .Encoding = System.Text.Encoding.UTF8}).DownloadString(emailTemplatePath) Dim attachmentFilePath = "http://en-ecm-jplender/Shared%20Documents/FATF%20Documents/People.pdf" Dim attachmentData = (New System.Net.WebClient() With {.UseDefaultCredentials = True, .Encoding = System.Text.Encoding.UTF8}).DownloadData(attachmentFilePath) However, I'd like for the user to be able to choose the PDF attachment, and the EmailTemplate document from Sharepoint. I tried fiddling with InfoPath, but it didn't seem to bind to t

Cannot start SQL Agent (2008)

I have a server with SQL Express 2008 running on it. 

SQL Agent service appears to be disabled, but when I try and start it I get the following error:

the sql server agent (SQLEXPRESS) service on local computer started and the stopped. Some services stop automatically if they have no work to do for example the Performance Logs and Alerts Service.

Anyone know whats causing this?

Custom Workflow won't auto start, but only for one user.


Hi, I have a custom worklfow which is associated with a list.  The workflow is set to auto start when a new item is added to the list.  This happens fine for every user in my organisation, but not for one particular user.  When he submits a new item to the list, nothing happens. The Workflow just will not start.  There are no errors in the log and no attempt is made to start the workflow.  The user is part of a SharePoint group which has contirbute (no delete) permission on the list, just like everyone else in that group who works fine. 

This user also is having problems progressing the workflow, if I start the workflow for him and assign it to him.

The workflow above, manages a CR process, creating tasks for users, taking their responses from custom task forms and populating a CR document held in a document library.  The first step for a user is to fill in a task form which when submitted, sets the task to 100% complete, then populates the CR document with the text the user entered.  Once the task is at 100%, the workflow process is looking for this, closes the task and creates a new task for an approver.  The problem for this same is user is that, the task gets set to 100%, but the CR doesn't progress.  Again, no errors are shown, but the tp_workflowversion value in the userdata table in the content datab

Couldn't start the distributor agent


Initially i had replication and then i have deleted the replication.When i redo the replication ,distributor agent is not starting.i got following error

SQLServerAgent Error: Request to run job FED-DB1-XXXX-XXXX_Pulbi-FED-DB2-19(From User sa) refused because the job is already running from a request by user sa.
Changed database context to 'XXXXXX'.(Microsoft SQL Server,Error:22022)'.

I have select the distributor agent in same publisher server.Please help me out of this.

Is there a way to start SQL Agent from Transact-SQL or SSMS?


Using SQL Server 2008 is there a way to start the SQL Agent service using T-SQL? I don't have remote desktop permissions to that server or I would try to start it from there. While connected to the server in SSMS, in object explorer, if I right-click on the The SQL Server Agent label I see the start and stop options but they are greyed-out. Why?

precise version: Microsoft SQL Server 2008 (SP1) - 10.0.2531.0 (X64)   Mar 29 2009 10:11:52   Copyright (c) 1988-2008 Microsoft Corporation  Enterprise Edition (64-bit) on Windows NT 6.0 <X64> (Build 6001: Service Pack 1)

Start over with User Profile Syc


I'm teaching myself how Sharepoint 2010 works (the boss wants SP, but doesn't want to pay for the classes) and I've got a test installation up and running.


I think I've fairly well borked up my attempt to sync user profiles over from our main AD, to the point the services won't start.  It might be that hotfix patch I applied.   Regardless it wasn't working right even before that.


What I'd like to do is dump all configuration information for the existing FIM and try provisioning it "clean."  Is there any way to do this or should I just roll my VM back to the last snapshot?  I don't really want to roll it back because I have some other things working fairly well e.g. search, so I consider a rollback a last resort.


This is SP2010 Server running on W2008R2 and MS SQL 2008 R2 (standard.)




can't start User Profile syncronization Service or FIM services


Using 2k8 R2, SQL 2k8 SP1 CU5 and Sharepoint 2010 RC. Standalone install with DC on separate server

Install to vanilla AD - can't do anything until I can get this service running and I can't run it because when I try to start it and I get a screen that lists the Service app - fine - but the service account is greyed out and listing NTAuthority\NetworkService - it demands a password but of course I can't priovide one. Can't select a different Service account because it's all greyed out - even if I create a new managed account and add that as an Admin to the Service Application

FIM services both won't start either -

Out of box install and nothing works - hardly bodes well

Anyway - seen lots of posts on problems with starting this service - anyone found a solution?





Better performance when all temp tables are at start of proc - STILL DON'T SEE WHY


I've already posted on this:


and was convinced even more by what was written in:



BUT when I actually tested a simple script with a profiler there was no difference in the number of deferred compiles (which is two) when all tables were at the start and when tables were spread in the procedure (According to the theory the second stored proc below should have produced only one deferred compile). This script completely contradicts the technical page link above. How can it be explained?




User Profile Synchronization won't start


Running Sharepoint 2010 on Server 2008 R2 with SQL Server 2008 R2. Acts like the service is starting then stops. Takes about 15 minutes, which apparently is normal. I'm logged in as the farm account(spadmin), added to the farm administrators accounts, and the service is set to start as the farm account.

This is the error I assume is holding it up. HELP!!! I've been at this for 5 days.


08/03/2010 12:45:29.10  OWSTIMER.EXE (0x1770)                    0x1060 SharePoint Portal Server       User Profiles                  9q15 High     UserProfileApplication.SynchronizeMIIS: Failed to configure ILM, will attempt during next rerun. Exception: System.Security.SecurityException: The Kerberos subsystem encountered an error. A service for user protocol request was made against a domain controller which does not support service for user.       at System.Security.Principal.WindowsIdentity.KerbS4ULogon(String upn)     at System.Security.Principal.WindowsIdentity..ctor(String sUserPrincipalName, String type)     at System.Security.Principal.Window

Sqlserver Agent not able to start the JOB.


I am having one pakage which execute one DOS batch file to operate a FTP task(Pulling files).

Its working fine with SSIS.

When Scheduling with SQLSERVER Agent Jobs its not working and status showing as "in progress". tried with different user IDs like "sa", Local User Account etc.


ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend