How do I clean up.?
I have a job every n minutes that says
"Hey master table. Has that package been executing for longer than it
should (Do you have a start time no finish and the start time is Now() -
whatever)"
if the answer is yes I can mail myself and say
"I think something went wrong with package X which started at this time"
It can also insert an end time or I can do it myself.
--
----------------------------
Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.allisonmitchell.com - Expert SQL Server Consultancy.
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals -
http://www.sqlpass.org [quoted text, click to view] "Kevin" <kwm2b@iwon.com> wrote in message
news:A3128FF7-D3C8-40F7-8503-33E364754049@microsoft.com...
> Hi Allan and Michael,
>
> Thanks for the advice. I appreciate the options you've suggested.
>
> Allan, how do you handle cleanup of the table, in the case that the
package ends unexpectedly?
>
> Unfortunately, Michael, the package can be executed outside of the job,
and I'd like to make sure the it is protected in that case, as well.
>
> Tell me, if you don't mind, what you think of this idea:
>
> I'm planning to add an Execute SQL Task to each package that performs data
manipulation. This task will execute sp_getapplock, creating an exclusive,
session-level lock with the package name as the resource. The task will
leave the connection open after executing, creating a lock for the entirety
of the package run. This way, the lock will be released whether the package
ends in error or reaches completion.
[quoted text, click to view] >
> What do you think?
>
> Regards,
> Kevin
>
> ----- \"Yuan Shao\" wrote: -----
>
> Hi Kevin,
>
> Thanks for your post. According to your description, I understand
that you
> have a job that executes a package every four hours. You want to
determine
> if the package is executing. If I have misunderstood, please feel
free to
> let me know.
>
> So far as I know, it seems there is not a built-in feature in SQL
Server
> can meet your requirements. If you only want to determine if the
package is
> executing, I think Allan's suggestions is good. However, I noticed
that
> your package is executed in a job. In that case, can you please try
to
> determine if the package is executing via checking the status of the
job.
> To check the status of a job, you can use stored procedure
sp_help_job.
>
> [@execution_status =] status
>
> Is the execution status for the jobs. status is int, with a default
of
> NULL, and can be one of these values. @execution_status =1 will help
you
> get the jobs which are executing. For example,
>
> Execute msdb..sp_help_job @execution_status = 1
>
> For more information regarding sp_help_job, please refer to the
article on
> SQL Server Books Online.
> Topic: "sp_help_job"
>
> Thanks for using MSDN newsgroup.
>
> Regards,
>
> Michael Shao
> Microsoft Online Partner Support
> Get Secure! -
www.microsoft.com/security > This posting is provided "as is" with no warranties and confers no
rights.
>
>