Maintenance Plan modify to a script?

  • I have created a maintenance plan using the wizard in SSMS.

    It creates a full backup on my DB 4 times a day. When it runs this backup, it is created in a subfolder called backup with its respective Database name.

    Lets say, I backup to a folder called C:\Backup\MyDB.

    If my current server has a HD failure, I would like to have another area to retrieve the DB Backup. I would like to be able to have the ability when it does a backup, not only it copy to the C:\backup\MyDB,

    I would like to copy to a network drive from another server called S:\Backup\MirrorFile\MyDB.

    I have no idea where I can modify the maintenance plan via the script method.

    I saw a script that looks like what I need:

    BACKUP DATABASE SampleDB

    TO DISK = 'C:\Backup\DB\SampleDB.bak'

    MIRROR TO DISK = 'S:\Backup\MirrorFile\MyDB\SampleDB.bak'

    WITH FORMAT

    GO

    Is there somewhere in the Maintenance plan that I can modify the script to backup and mirror to another location?

  • You can't modify anywhere in the maintenance plan but you can add another step to the jobs which created by maintenance plan and add your script to it.

    -----------------------------------------------------------
    I am here to learn from all SQL Server masters. 😀

  • another reason why I ( and many of my peers ) don't like maintenance plans.

    So I schedule my own backup jobs, including an extra step to copy the bak files to a safe zone location.

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

  • maliqiakbar (1/30/2015)


    You can't modify anywhere in the maintenance plan but you can add another step to the jobs which created by maintenance plan and add your script to it.

    ALZDBA (1/30/2015)


    another reason why I ( and many of my peers ) don't like maintenance plans.

    So I schedule my own backup jobs, including an extra step to copy the bak files to a safe zone location.

    Thank you for your replies.

    So how do I modify the script as posted above as a new step after the initial backup has been completed?

Viewing 4 posts - 1 through 3 (of 3 total)

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