The use of sqlmaint is for more than making backups; it can be used for running DBCC checks, updating statistics, rebuilding indexes, and making backups to the database(s) and their transaction logs. The sqlmaint utility is an SQL-DMO application. Before using it, make sure to register it by typing the following text at the command prompt:
If you have SQL Server or the Enterprise Manager then you don't need to worry about the registration of the utility, as it is already done.
The main idea of using this utility is to thoroughly examine the status of your database(s) and generate a report. (Note that if you use a PlanName or PlanID, the options that you specify will affect all the databases listed in the plan.) There are lot of options in sqlmaint, but let's just talk about some of them:
- Check for removed and unused space, and set a percent free for future use.
- Check the entire database (with CkDB).
- Update the statistics of each table included in your database (with UpdSts).
- Run backups for the database and the log file.
However, concerning that last option, sqlmaint backs up the entire databases and you don't have all the options like in BACKUP (T-SQL). Also, don't forget about BackUp, which enables you to do complex backup operations--even online backups--of the databases, files, filegroups and logs files. However, with BackUp, you cannot check the integrity of the database as well as you can with sqlmaint. To make your backup plan more effective, you might need to use a bit of both options, as each one has its own advantages and disadvantages.
For More Information
- What do you think about this answer? E-mail us at editor@searchDatabase.com with your feedback.
- The Best Microsoft SQL Server Web Links: tips, tutorials, scripts, and more.
- The Best SQL Web Links
- Have a SQL Server tip to offer your fellow DBA's and developers? The best tips submitted will receive a cool prize--submit your tip today!
- Ask your technical SQL Server questions--or help out your peers by answering them--in our live discussion forums.
- Ask the Experts yourself: Our SQL Server guru is waiting to answer your toughest questions.
Dig Deeper on Microsoft SQL Server Installation
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.