How to schedule a backup

  • I have a small database in SqlServerExpress and want to backup it on a daily base (simple recovery, full backup). How can I schedule the backup so that it automaticly backups a db at 18:00 hour.

    A backup with Management Studio Express by hand at the end of the day works fine. But how to automate it?

    Where can I find information on this subject (BOL, MS), or is it easy to tell?

  • There is no sql agent in SQL Express edition...

    I believe you can create a bactch file using OSQL utility and execute that batch file using the widows/Task scheduler...

     

    MohammedU
    Microsoft SQL Server MVP

  • Mohammed, thank you for your answer.

    I thought that maybe there is a "hidden" sql agent somewhere, and that I didn't found the way to activate the sql agent.

    So I have to create a osql batch file. And use the windows task schedular.

    Do you (or someone else) have an example of an osql code to make a full backup of a database?

    Or (as I am a delphi/pascal developper, not a dba)  an example of how to use the windows task schedular for this purpose.

     

  • osql -S<Sql InstanceName> -E -Q"Backup database pubs to disk = 'c:\pubs.bak' with init"

    See BOL for more details...

    Check the AT command in widows help...or you can check in control panel for task scheduler...

     

    MohammedU
    Microsoft SQL Server MVP

  • Mohammed, thank you for your help.

    I'll look in BOL.

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

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