Wednesday, March 7, 2012

Enabling SQL Server Agent by using scripts

Hi NG,
how do I have to enable the SQL Server Agent by using command line scripts
(without the Enterprise Manager). According to SQLServer books online the
command line command sqlagent should only be used for diagnostic purposes.
thanks for help, rene
Rene,
To start SQL Server Agent from the commandline you can do this:
net start sqlserveragent
Mark Allison, SQL Server MVP
http://www.markallison.co.uk
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602m.html
Re Fo wrote:
> Hi NG,
> how do I have to enable the SQL Server Agent by using command line scripts
> (without the Enterprise Manager). According to SQLServer books online the
> command line command sqlagent should only be used for diagnostic purposes.
> thanks for help, rene
>
|||Thanks,
can I set it somewhere in the registry that the service will alwyas be
started, as I can set it in the Services properties?
Thanks for help, rene
"Mark Allison" <marka@.no.tinned.meat.mvps.org> wrote in message
news:ec0Gbwf4EHA.1976@.TK2MSFTNGP09.phx.gbl...[vbcol=seagreen]
> Rene,
> To start SQL Server Agent from the commandline you can do this:
> net start sqlserveragent
> --
> Mark Allison, SQL Server MVP
> http://www.markallison.co.uk
> Looking for a SQL Server replication book?
> http://www.nwsu.com/0974973602m.html
>
> Re Fo wrote:
scripts[vbcol=seagreen]
the[vbcol=seagreen]
purposes.[vbcol=seagreen]
|||There are two places you can do this.
1)
Enterprise Manager-->General Tab, Tick AutoStart SQL Server Agent
2)
In Services Control Panel Applet, you can set the SQLServerAgent service
to AutoStart.
or if these don't work, you could even do this:
3)
CREATE PROC sp_startagent
AS
exec master..xp_cmdshell 'net start sqlserveragent', no_output
GO
exec sp_procoption N'sp_startagent', N'startup', N'true'
GO
Mark Allison, SQL Server MVP
http://www.markallison.co.uk
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602m.html
Re Fo wrote:
> Thanks,
> can I set it somewhere in the registry that the service will alwyas be
> started, as I can set it in the Services properties?
> Thanks for help, rene
> "Mark Allison" <marka@.no.tinned.meat.mvps.org> wrote in message
> news:ec0Gbwf4EHA.1976@.TK2MSFTNGP09.phx.gbl...
>
> scripts
>
> the
>
> purposes.
>
>

No comments:

Post a Comment