|
-
November 24th, 2004, 04:19 PM
#1
How to turn start SQL Server Agent from code?
Hi,
Is is it possible to check if SQL Server Agent is running and if it is not running start it to schedule tasks from MFC app in VC++.net
Any help is highly apprecited!
Thankx
-
November 25th, 2004, 09:25 AM
#2
Re: How to turn start SQL Server Agent from code?
U can use SQL-DMO methods .
Best regards,
Krzemo.
-
November 25th, 2004, 09:34 AM
#3
Re: How to turn start SQL Server Agent from code?
JobServer Object
The JobServer object exposes attributes associated with SQL Server Agent. SQL Server Agent is responsible for executing scheduled jobs and notifying operators of Microsoft® SQL Server™ 2000 error conditions or other SQL Server execution or job states.
[img]mk:@MSITStore:C:Program%20FilesMicrosoft%20SQL%20Server80ToolsBookssqldmo.chm::/dmor01.gif[/img] Properties
AutoStart PropertyStatus Property (Services)MSXServerName PropertyType Property (JobServer)StartupAccount Property
Methods
BeginAlter MethodReAssignJobsByLogin MethodCancelAlter MethodRefresh MethodDoAlter MethodRemoveJobByID MethodEnumJobHistory MethodRemoveJobsByLogin MethodEnumJobs MethodRemoveJobsByServer MethodEnumSubSystems MethodStart Method (FullTextService, JobServer)GetJobByID MethodStartMonitor MethodMSXDefect MethodStop MethodMSXEnlist MethodStopMonitor MethodPurgeJobHistory Method
Remarks
With the JobServer object, you can:
- Start or stop SQL Server Agent on a server running SQL Server.
- Manage alerts, jobs, and operators.
- Enlist the server in a multiserver administration group.
[img]mk:@MSITStore:C:Program%20FilesMicrosoft%20SQL%20Server80ToolsBookssqldmo.chm::/Basics/note.gif[/img] Note The JobServer object is compatible with instances of SQL Server 2000 and SQL Server version 7.0. However, the JobServer2 object extends the functionality of the JobServer object for use with features that are new in SQL Server 2000.
(SQL Books Online)
Best regards,
Krzemo.
-
November 25th, 2004, 05:10 PM
#4
Re: How to turn start SQL Server Agent from code?
thanks a lot for the guidance, I will look into it.
Meanwhile I have tried the approach that SQL ServerAgent is just another service on windows and tried win api functions for the purpose of querying the status of the service and staerting it.
But no success till now because the server is Onn LAN and I can't find a way to make it work.
OpenSCManager accepts the server name if the computer is remote. but it returns RPC server not available.
I will try both approaches and see hat happens.
Thanks again
-
November 25th, 2004, 05:11 PM
#5
Re: How to turn start SQL Server Agent from code?
Well the Links ove r there don't work!!!!
-
November 25th, 2004, 11:41 PM
#6
Re: How to turn start SQL Server Agent from code?
It was just a copy of CHM help (SQL Server Books Online) from local computer.
It was'nt suppose to work.
But I found an article (over Internet) that fully covers UR problem.
http://msdn.microsoft.com/library/de...asp?frame=true
And that link works
Best regards,
Krzemo
-
November 26th, 2004, 02:41 PM
#7
Re: How to turn start SQL Server Agent from code?
thnks dude am trying to find out what i need to include in c++ in order to make that work
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|