tailieunhanh - Brad’s Sure Guide to SQL Server Maintenance Plans- P45

Brad’s Sure Guide to SQL Server Maintenance Plans- P45: SQL Server has a reputation as being a simple database application to install, configure, and maintain. This is a little misleading. SQL Server is a powerful relational database that can handle the needs of the largest organizations and, as such, its proper maintenance almost certainly requires the attention of an experienced DBA. | Chapter 17 Configuring Maintenance Tasks Using the Designer The Execution time out option on this screen is set to zero which means that the T-SQL code you add can run as long as it takes to complete. If you want to prevent the code from taking an inordinate amount of time to run you can set a value here in seconds which determines when the T-SQL code in this task times out and the task is aborted. Of course if your T-SQL code takes a long time to run then it is probably not appropriate for use from within the Execute T-SQL Statement task. Another point to notice about this task is that you can t specify a database as you can with most of the other Maintenance Plan tasks. Because of this this task is best suited to T-SQL code designed to run in any database such as T-SQL code to run a custom form of the DBCC command as described earlier. Or if you are a clever T-SQL coder you can write code that can check for existing databases and based on some criteria you specify perform specific actions. You can write database-specific code if you want but if you do you should keep in mind that if you add or remove a database to a SQL Server instance you may break your code requiring you to go back and modify the code to take into account the change in the databases on the instance. Overall if you have complex database maintenance needs that can only be satisfied using custom T-SQL then you may be better off creating your maintenance plans using custom T-SQL or PowerShell scripts in the first place. The Maintenance Plan Designer is intended to make database maintenance easier and faster if you overcomplicate things by adding a lot of custom T-SQL tasks then you are defeating its very purpose. Notify Operator Task The Notify Operator task is one of the main reasons why you may decide to create your Maintenance Plans using the Maintenance Plan Designer instead of the Maintenance Plan Wizard. What this simple task does is to notify a designated operator or several operators when a