1. Start or stop the SQL Agent service in Query Analyzer
Start
Use master
Go
xp_cmdshell ' net start SQLServerAgent '
Stop it
Use master
Go
xp_cmdshell ' net stop SQLServerAgent '
Change the startup of a service from manual to automatic start
exec xp_cmdshell ' scm-action 7-service mssqlserver-svcstarttype 2 '
It is also possible to execute the contents of quotes directly with the command line.
2. Cause and treatment of abnormal startup
Ostensibly, the SQL Server Agent service starts correctly, but the following error occurs when viewing the properties of the job and the job history:
Error 14258: This operation cannot be performed while SQLServerAgent is starting. Please try again later.
Possible causes:
"Use Windows NT Fiber" was selected for specific reasons.
Workaround:
Enterprise Manager--right key SQL instance--Properties--processor--deselect "Use Windows NT Fiber"
Then restart the SQL service
Modified the System password
Workaround:
A. My Computer--control Panel--management tools--services--right key mssqlserver--properties--landing--Landing identity--Select "Local System Account"
Or:
B. My Computer--control Panel--management tools--service--right key mssqlserver--Properties--Login--Login--Select "This Account"--select Administrator, Password and Confirm password to enter your administrator password.
The difference between the two:
Choose the first way, later modified the administrator password, no more adjustments (but require the system administrator to log on to the operating system)
Database illegal down machine failed
Workaround:
Reinstall with the installation CD and choose ' Advanced options '-' Rebuild registry ' and go all the way ...