Index Optimization job stuck - Sql 2008R2

pdsqsql 411 Reputation points
2020-08-17T17:22:28.687+00:00

Hello,
We have Sql 2008R2 and we are running Index Maintenance job (Index optimization) part of Ola's maintenance Solution but during job was running and Sql server Shutdown/Restarted and job still showing as in 'Progress'.
This is a Sql Agent job we have set up on Sql Server 2008.
What i should do? What i should check that it's hang or not?
I have checked CommandLog table of Ola's script and it's not showing any error message.
I have also checked SP_WHO2 and it's not showing any locking/blocking.
None of the steps are looks like active but Jobs shows "in progress".

Any hep or guidance appreciated!

Thank You!

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,326 questions
{count} votes

5 answers

Sort by: Most helpful
  1. Tom Phillips 17,721 Reputation points
    2020-08-17T18:57:16.903+00:00

    That happens sometimes. Restarting SQL Agent usually fixes it.
    Also make sure you have the last patches installed.

    https://support.microsoft.com/en-us/help/2979597/sql-server-2008-r2-service-pack-3-release-information


  2. Shashank Singh 6,251 Reputation points
    2020-08-18T07:36:36.373+00:00

    Did you tried stopping the job from SQL Server agent ?. Restarting SQL Server agent is fine but it will kill any other job which is running. Please first try to stop the job from SQL Server agent if nothing happens let me know.

    0 comments No comments

  3. Sreekanth Madambath 86 Reputation points
    2020-08-18T15:43:01.357+00:00

    Please check what is status of the SPID.
    Probably, the SPID which ran for the same in Rollback process which may be the reason the jobs shows in progress.

    select * from sys.sysprocesses - check if any rollback in progress.

    If you have big DB yes, rollback should be happening for indexing job if that fails in between.


  4. pdsqsql 411 Reputation points
    2020-08-18T16:06:09.917+00:00

    I also tried to stop the job using EXEC MSDB.dbo.sp_stop_job 'Sql Agent Job' but getting message that
    "SQLServerAgent Error: Request to stop job 'Sql Agent Job' refused because the job is not currently running.


  5. pdsqsql 411 Reputation points
    2020-08-18T19:43:36.827+00:00

    Thanks Tibor for looking into.
    I can't start the job as this is a weekly job and it has multiple steps (Ola's Maintenance Solution), normally we run on Weekend due to all Index optimization and other maintenance.

    I also tried to run msdb.dbo.sp_sqlagent_refresh_job but it's still shows "In Progress".