Wednesday, March 7, 2012

Question on db maintenance scripts

Relatively new to SQL Server, running both 2000 and 2005.

I have to set up database maintenance scripts, db and log backups, optimizations etc in batch files so that they can be run by an external scheduler.

When I produce a script from the SQL Server database maintenance wizards and save it off in a bat file, the script will not work when run manually, probably due to the difference in syntax.

I have some examples of backup scripts using sqlmaint.exe, but can't find anything on how to script optimization/reorg jobs so that they can be run by an external scheduler.

Can anybody point me to any docs or guidance on how to produce backup and reorg scripts that can be run externally?

Thanks in advance.
GerryIt sounds like you want to use the osql utility. Go to BOL and look it up uner the index tab. When you double-click on the index utility, chose the "osql utility" under the Command Pronpt Utilities.

No comments:

Post a Comment