Showing posts with label jobs. Show all posts
Showing posts with label jobs. Show all posts

Tuesday, March 20, 2012

Re-run all the failed jobs

I'm wondering if there's an elegant/efficient way to automatically
re-run all the failed jobs under a SQL server 2000 installation.

TIA."NickName" <dadada@.rock.com> wrote in message
news:1105369505.976361.73090@.c13g2000cwb.googlegro ups.com...
> I'm wondering if there's an elegant/efficient way to automatically
> re-run all the failed jobs under a SQL server 2000 installation.
> TIA.

There's no one-click solution, if that's what you want - you would need to
write something yourself. You could create a proc which uses sp_help_job to
get job statuses, then sp_start_job to restart them. Another approach would
be to set each step in every job to go to step 1 on failure, so the job
keeps running until it succeeds.

Personally, I would avoid doing something like this anyway - it's rather
heavy-handed, and if you have job dependencies, critical scheduling issues
and so on, then you don't want jobs just starting at random times. Even if
every job you have now is independent of all others and could run at any
time, you don't don't know what future jobs you might add. And if a job
fails, I would prefer to investigate why, rather than simply keep running it
until it succeeds.

Simon|||You're right I'm not looking for a one-click solution, however, some
sort of automated way but still with some flexibility (as you correctly
pointed out "you don't know what future jobs you might add". Good to
know about sp_help_job and sp_start_job, they seem handy for the task
at hand, however, sp_help_job does not seem to help me much, I would
like it to list all the failed jobs for a given server, then loop
sp_start_job for each failed one. It would be desirable for
sp_help_job or the like to perform something like the above, that is,
EXEC sp_help_job @.execution_status = 'failed' | 0 (btw, currently the
@.execution_status values seems to be weird)
lists all the failed jobs

I appreciate your sharing of your knowledge, though I'm not a dba, it's
good to pick up some skill like this.

Don|||"NickName" <dadada@.rock.com> wrote in message
news:1105455394.853671.239030@.f14g2000cwb.googlegr oups.com...
> You're right I'm not looking for a one-click solution, however, some
> sort of automated way but still with some flexibility (as you correctly
> pointed out "you don't know what future jobs you might add". Good to
> know about sp_help_job and sp_start_job, they seem handy for the task
> at hand, however, sp_help_job does not seem to help me much, I would
> like it to list all the failed jobs for a given server, then loop
> sp_start_job for each failed one. It would be desirable for
> sp_help_job or the like to perform something like the above, that is,
> EXEC sp_help_job @.execution_status = 'failed' | 0 (btw, currently the
> @.execution_status values seems to be weird)
> lists all the failed jobs
> I appreciate your sharing of your knowledge, though I'm not a dba, it's
> good to pick up some skill like this.
> Don

This will list all failed job executions:

exec sp_help_jobhistory @.run_status = 0

Note that this will show all failures of all jobs (whereas sp_help_job shows
only the last run status for all _current_ jobs), so you might be looking at
a failure from 6 months ago for a job which no longer exists. Querying
sysjobs and sysjobhistory directly would give you more control (both tables
are documented in BOL).

But you should really consider concentrating on making sure that jobs do run
and reacting quickly when they don't, otherwise you may allow a situation
where job failures are considered normal, and therefore you never notice any
more serious issues (such as your backup jobs failing).

Of course, you may already have a good reason for doing this, and perhaps in
a development situation it might be useful.

Simon|||It would be really nice for the parameter of @.start_run_date to support
none equality operation, for instance,

exec sp_help_jobhistory @.run_status = 0, @.start_run_date > 20050108
would return all the failed jobs since Jan 8, 2005 instead of possibly
hundreds of rows/failed jobs.

Otherwise, have to use two loops of INNER and OUTER, just less
efficient.

And you're correct job failures are rare but it happens.
Thanks, Simon.

Don

Saturday, February 25, 2012

Repost: sql7 maintenance jobs hang

Hi group,
the following has been posted and did not receive any response. In hope to
get some leads I am reposting it here.
we have a sql7 server,
Microsoft SQL Server 7.00 - 7.00.1094 (Intel X86)
May 29 2003 15:21:25
Copyright (c) 1988-2002 Microsoft Corporation
Standard Edition on Windows NT 4.0 (Build 1381: Service Pack 6)
For a while now, it has been seeing hanging db maintenance jobs. The jobs
are initiated, but never goes beyond that -- the maintenance task is not
done before the hanging of the job. EM shows that the jobs are running but
loses the ability of managing them. One needs to end the processes with the
windows task manager. When manually initiated, the jobs can run through.
The jobs are not necessarily the same(different days can have different jobs
experiencing the problem, some can be the same), but all came from db
maintenance plan. A job hung yesterday may not hang today. Recreating the
db maint plan does not solve the problem.
Any suggestions are appreciated.
QuentinQuentin
Are you using the repair minor errors option? That tends
to cause problems in maint plans.
Any other problems on the server, I had a similar problem
and it was being caused by another process clashing with
the checkpoint process, but that eventually killed the
whole system.
Regards
John|||John,
thanks for the response.
The repair minor errors option is not being used. We are aware of that
problem.
We are trying to identify other problems on the server but came out empty
handed so far.
Quentin
"John Bandettini" <anonymous@.discussions.microsoft.com> wrote in message
news:003201c3a86e$ccafad40$a301280a@.phx.gbl...
> Quentin
> Are you using the repair minor errors option? That tends
> to cause problems in maint plans.
> Any other problems on the server, I had a similar problem
> and it was being caused by another process clashing with
> the checkpoint process, but that eventually killed the
> whole system.
> Regards
> John

Tuesday, February 21, 2012

REPOST - Moving from 7.0 to 2000

Dear All,
I have a database 4.2 gb of data, 50 view, 618 sp, 31
functions 92 tables, 10 with image columns and 27 jobs in
SQL Server 7.0.
As the title sugests I am migrating to 2000 and would like
some tips / help ect. I have read the Microsoft Guide, but
was wondering there any tips, help and more
importantly 'Do not do even if MS tells you too' would be
greatly appriciated.
A
Hi
Test, Test and Test your applications. Yes, there is SQL 7.0 compatability
mode, but there are small differences between how 7 and 2000 would do
something, even in that mode.
The basic migration is easy. Make sure that the objects are owned correctly,
make sure that there are no objects referring to objects that have been
removed/renamed.
I move 7.0's to 2000's on daily basis and it just works. Best is if you
move onto new hardware at the same time as you don't keep any legacy
configuration mistakes.
Regards
Mike
"Alice" wrote:

> Dear All,
> I have a database 4.2 gb of data, 50 view, 618 sp, 31
> functions 92 tables, 10 with image columns and 27 jobs in
> SQL Server 7.0.
> As the title sugests I am migrating to 2000 and would like
> some tips / help ect. I have read the Microsoft Guide, but
> was wondering there any tips, help and more
> importantly 'Do not do even if MS tells you too' would be
> greatly appriciated.
> A
>
|||Thanks for your reply, it has been very helpful.
Unfortunatly we are installing it on an existing Server so
I was wondering what are the common legacy configuration
problems ?
Thanks

>--Original Message--
>Hi
>Test, Test and Test your applications. Yes, there is SQL
7.0 compatability
>mode, but there are small differences between how 7 and
2000 would do
>something, even in that mode.
>The basic migration is easy. Make sure that the objects
are owned correctly,
>make sure that there are no objects referring to objects
that have been
>removed/renamed.
>I move 7.0's to 2000's on daily basis and it just works.
Best is if you
>move onto new hardware at the same time as you don't keep
any legacy[vbcol=seagreen]
>configuration mistakes.
>Regards
>Mike
>"Alice" wrote:
in[vbcol=seagreen]
like[vbcol=seagreen]
but[vbcol=seagreen]
be
>.
>

REPOST - Moving from 7.0 to 2000

Dear All,
I have a database 4.2 gb of data, 50 view, 618 sp, 31
functions 92 tables, 10 with image columns and 27 jobs in
SQL Server 7.0.
As the title sugests I am migrating to 2000 and would like
some tips / help ect. I have read the Microsoft Guide, but
was wondering there any tips, help and more
importantly 'Do not do even if MS tells you too' would be
greatly appriciated.
AHi
Test, Test and Test your applications. Yes, there is SQL 7.0 compatability
mode, but there are small differences between how 7 and 2000 would do
something, even in that mode.
The basic migration is easy. Make sure that the objects are owned correctly,
make sure that there are no objects referring to objects that have been
removed/renamed.
I move 7.0's to 2000's on daily basis and it just works. Best is if you
move onto new hardware at the same time as you don't keep any legacy
configuration mistakes.
Regards
Mike
"Alice" wrote:
> Dear All,
> I have a database 4.2 gb of data, 50 view, 618 sp, 31
> functions 92 tables, 10 with image columns and 27 jobs in
> SQL Server 7.0.
> As the title sugests I am migrating to 2000 and would like
> some tips / help ect. I have read the Microsoft Guide, but
> was wondering there any tips, help and more
> importantly 'Do not do even if MS tells you too' would be
> greatly appriciated.
> A
>|||Thanks for your reply, it has been very helpful.
Unfortunatly we are installing it on an existing Server so
I was wondering what are the common legacy configuration
problems ?
Thanks
>--Original Message--
>Hi
>Test, Test and Test your applications. Yes, there is SQL
7.0 compatability
>mode, but there are small differences between how 7 and
2000 would do
>something, even in that mode.
>The basic migration is easy. Make sure that the objects
are owned correctly,
>make sure that there are no objects referring to objects
that have been
>removed/renamed.
>I move 7.0's to 2000's on daily basis and it just works.
Best is if you
>move onto new hardware at the same time as you don't keep
any legacy
>configuration mistakes.
>Regards
>Mike
>"Alice" wrote:
>> Dear All,
>> I have a database 4.2 gb of data, 50 view, 618 sp, 31
>> functions 92 tables, 10 with image columns and 27 jobs
in
>> SQL Server 7.0.
>> As the title sugests I am migrating to 2000 and would
like
>> some tips / help ect. I have read the Microsoft Guide,
but
>> was wondering there any tips, help and more
>> importantly 'Do not do even if MS tells you too' would
be
>> greatly appriciated.
>> A
>>
>.
>

REPOST - Moving from 7.0 to 2000

Dear All,
I have a database 4.2 gb of data, 50 view, 618 sp, 31
functions 92 tables, 10 with image columns and 27 jobs in
SQL Server 7.0.
As the title sugests I am migrating to 2000 and would like
some tips / help ect. I have read the Microsoft Guide, but
was wondering there any tips, help and more
importantly 'Do not do even if MS tells you too' would be
greatly appriciated.
AHi
Test, Test and Test your applications. Yes, there is SQL 7.0 compatability
mode, but there are small differences between how 7 and 2000 would do
something, even in that mode.
The basic migration is easy. Make sure that the objects are owned correctly,
make sure that there are no objects referring to objects that have been
removed/renamed.
I move 7.0's to 2000's on daily basis and it just works. Best is if you
move onto new hardware at the same time as you don't keep any legacy
configuration mistakes.
Regards
Mike
"Alice" wrote:

> Dear All,
> I have a database 4.2 gb of data, 50 view, 618 sp, 31
> functions 92 tables, 10 with image columns and 27 jobs in
> SQL Server 7.0.
> As the title sugests I am migrating to 2000 and would like
> some tips / help ect. I have read the Microsoft Guide, but
> was wondering there any tips, help and more
> importantly 'Do not do even if MS tells you too' would be
> greatly appriciated.
> A
>|||Thanks for your reply, it has been very helpful.
Unfortunatly we are installing it on an existing Server so
I was wondering what are the common legacy configuration
problems ?
Thanks

>--Original Message--
>Hi
>Test, Test and Test your applications. Yes, there is SQL
7.0 compatability
>mode, but there are small differences between how 7 and
2000 would do
>something, even in that mode.
>The basic migration is easy. Make sure that the objects
are owned correctly,
>make sure that there are no objects referring to objects
that have been
>removed/renamed.
>I move 7.0's to 2000's on daily basis and it just works.
Best is if you
>move onto new hardware at the same time as you don't keep
any legacy
>configuration mistakes.
>Regards
>Mike
>"Alice" wrote:
>
in[vbcol=seagreen]
like[vbcol=seagreen]
but[vbcol=seagreen]
be[vbcol=seagreen]
>.
>