How can i know wheather my job is running or not ?

Hi ,
   I have migrated one Server 'A' database to server 'B' and after completion of this, i have scheduled a job in 'B' server.  Usually in 'A' server, it takes 30 min, but in 'B' server it is keep on running and not coming out.  Is there a way to monitor whether my job is really doing something inside or not ?

Thanks in advance

Sridhar.B
bethamsettyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

udayshankarCommented:
run a trace in sql profiler to see whats happening on the server
0
Kevin HillSr. SQL Server DBACommented:
Look in master..sysprocesses (assuming SQL 2000)
0
knightEknightCommented:
CREATE PROCEDURE spIsJobRunning
   @jobName nvarchar(256)
 AS
  begin

    declare @returnStep tinyint

    CREATE TABLE #tmp_Job_Data
    (
      job_id                UNIQUEIDENTIFIER NOT NULL,
      last_run_date         INT              NOT NULL,
      last_run_time         INT              NOT NULL,
      next_run_date         INT              NOT NULL,
      next_run_time         INT              NOT NULL,
      next_run_schedule_id  INT              NOT NULL,
      requested_to_run      INT              NOT NULL,
      request_source        INT              NOT NULL,
      request_source_id     sysname          COLLATE database_default NULL,
      running               INT              NOT NULL,
      current_step          INT              NOT NULL,
      current_retry_attempt INT              NOT NULL,
      job_state             INT              NOT NULL
    )


    SET NOCOUNT ON

    INSERT INTO #tmp_Job_Data
    EXECUTE master.dbo.xp_sqlagent_enum_jobs 1, ''

    SET NOCOUNT OFF

    select @returnStep = current_step
    from   #tmp_Job_Data X (nolock) inner join
           msdb..sysjobs J (nolock) on J.job_id = X.job_id
    where J.name = @jobName
      and X.running = 1

    drop table #tmp_Job_Data

--    select IsNull(@returnStep,0) as current_step_id

    return IsNull(@returnStep,0)

  end
GO
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

knightEknightCommented:
the above will return 0 if the job is not running, otherwise it will return the current step number of the running job.

declare @step tinyint

exec @step= spIsJobRunning 'myJobName'

select @step
0
bethamsettyAuthor Commented:
Thanks....i created SP and ran the small statement .  It is showing '1' but how can we relate this number with the step executing in our DTS package.  Because i see many "Execute SQL Tasks".  If it could shows us the description of the task then it would be nice to identify it very easily..

any help 'KnightEknight'
0
David ToddSenior DBACommented:
Hi,

One of the problems is that SQL Agent can't see inside a DTS package, and will only show the one step - starting DTS package.

My guess is that your next step is to open the DTS package on Server 'B' and run it interactively, and see where it stalls/errors.

Regards
  David
0
bethamsettyAuthor Commented:
Yes! I can do that ..but before that i want to know how much process done.. otherwise it's big trouble for me to look in to each table and to identify how much process done.

Thanks
0
Scott PletcherSenior DBACommented:
Add separate steps between each major step in the pkg that just write info to a table; that will give you a type of trace of the pkg.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.