How can restore deleted sql job

  • Hi,

    Unfortunately i delete my sql job.but right now i would like to restore it.

    So how can i restore my deleted sql job any one can help me

    Thank you.;-)

  • If you have a backup of msdb, you can restore it in a development box and try scripting out the job.

    ----------------------------------------------------------------------------------------------------------------------------------------------------
    Roshan Joe

    Jeff Moden -Forum Etiquette: How to post data/code on a forum to get the best help[/url]

  • Could you please expalin...

    Back of database or msdb ?

  • The agent jobs and schedules are stored in msdb database. So if you can restore the msdb, you can get the job back.

    ----------------------------------------------------------------------------------------------------------------------------------------------------
    Roshan Joe

    Jeff Moden -Forum Etiquette: How to post data/code on a forum to get the best help[/url]

  • No i dont have any back....

    So what will be the next way to restore becuase i can see my deleted job through the following query;

    select * from msdb.dbo.sysjobhistory order by instance_id desc

    But i dont know how to restore it

  • If you don't have a backup, and you didn't have the job scripted out, then I'm afraid you've lost it. The sysjobhistory entries will only show that the job existed and when it ran, but it won't help with the definition of the job.

    John

  • If you don't have any backups, then you've got a much bigger potential problem on your hands than a lost job. You should define a backup strategy and implement it as soon as you can. What if this had been a production database?

  • I'll also add that the idea of source control for jobs and all other code on your server should become a concern... right after you get your backups setup so this doesn't happen again.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

Viewing 8 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic. Login to reply