automate restore db

  • Hi All,

    I wanna automate restore what I automated backup before.

    Can I do this successfully?If can,then how can I do this?

    appriciate for your guys help

  • I don't know if I completely understand what you're asking for but perhaps you are interested in database mirroring. CLICK

    Take a look at the high-safety mode with automatic failover...

  • like from prod to dev ?

    make the .bak file available to your sqlagent service account on your dev-server and have a job restore the db.

    Alter database mydevdb set single_user with rollback immediate;

    -- NO go statement overhere because of single user setting !!

    Restore database mydevdb

    from DISK = '\\myserver\SQLBACKUPShare\mydb_prdFull.BAK'

    with MOVE N'mydb_data' TO N'thelocalpath\Data\XXX.mdf'

    , MOVE N'mydb_data_2' TO N'thelocalpath\Data\XXX_2.mdf'

    , MOVE N'mydb_log' TO N'thelocalpath\data\XXX_log.ldf'

    , RECOVERY

    Print "Now you need to resync the users !!"

    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

  • Use SSIS. Then you can automate the process to move a copy of your database backup from prod to where ever. If the backup is zipped, or if you want to zip it up first before you move, you can do that as well. And then automated the restore script listed earlier.

    I try to do this for all my clients, that way they have a fully automated process to test the full backups, and a recent version of the database they can use for reporting (or testing).

    The more you are prepared, the less you need it.

  • Thx for your help!

    yeah,I wanna restore the .bak files which I backup before.

    can you give me more details.

    sorry,I am a newbie of this.

    rgds,

    Shawn Qiu

  • AART (9/4/2008)


    I don't know if I completely understand what you're asking for but perhaps you are interested in database mirroring. CLICK

    Take a look at the high-safety mode with automatic failover...

    Sorry,I am not interested in database mirroring.what I am interested is that how to restore the .bak files.

    Do you know how to do this?

    Anyway,Thx for your help.

    Rgds,

    Shawn Qiu

  • Use SSIS?

    I wanna restore the .bak files,can I do this by using SSIS?

    sorry,I am a newbie of this,If can do,please let me know.

    Thx for your help anyway.

    Rgds

    Shawn Qiu

  • Unfortunately, this is not a topic that can be quickly addressed in a forum. But if you use SSIS (its part of SQL Server) you can automate the process to locate and move the files to your target server, and then do an automated restore. Start with the SSIS tutorial.

    The more you are prepared, the less you need it.

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

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