Search code examples
c#sqlsql-serverwindows-installerinstallshield

Why sql job is not executed from installer?


I'm trying to start a sql server job using following command.

EXEC msdb.dbo.sp_start_job N'Cube Initializer'

If a run it manually it works perfectly, but I run this command in the INSTALLER(InstallShield) tool and I received following log message.

SQL Server Agent is not currently running so it cannot be notified of this action

But the SQLServerAgent is running on my machine and I don't understand why I received this log error while the SQLServerAgent is running.


Solution

    • MSDB database in recovery state? Check if this database in online.
    • Hanged SQL Agent Service? Restart SQL Agent service and try again.
    • Few SQL Server instances installed and the command sent to a wrong one?