Backup db via ''bat'' file instead of db maint plan.

  • Currently I use the db maint plans to contol all of the database, trans backups and opt. jobs when they are run and deleting old backups. We have purchased BMCs Control-M Scheduling package and I have been asked to change all of my jobs to script files that this package can execute.  Question is, what do I need in a .bat file to call SQL Server to run a backup and delete old backups?  Any ideas? Do any of you backup dbs like this ? Any help would be appreciated.

  • Marcus,

    OSQL utility may run any reasonable T-SQL statement.

    You have to be very familiar with BACKUP DATABASE statement to do it by the script.

    The other idea is to use Job Object in SQL-DMO (SQL Server 2000) or something similar in SQL-SMO for SQL Server 2005 to start a job that already exist. You would use Job.Start method to start the job. Please, see "Job Object" article in Books Online

    Yelena

    Regards,Yelena Varsha

  • You can use sqlmaint utility too. Look in BOL for SQLMaint utility.

  • Oh yes, sqlmaint. Dave is totally correct.

    It is just the question was worded as "instead of db maint plan", and that probably send my mind away from sqlmaint.

    Regards,Yelena Varsha

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

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