devonmanelski.com
 
Home | I.T. Management | Business Analysis & Project Management | VB.Net | SQL Server | About |

Database Maintenance

Summary
Routine database maintenance is necessary for every database. Every use of a database is fulfilled by some form of database transaction. Database usage causes the connections, transactions, locks, logs, relationships, size, and segments of a database to be less efficient over time. Routine maintenace tunes a database so that its performance is optimized. SQL Server has a built-in feature to create Database Maintenance Plans. For more information about the Database Maintenace Plan Wizard, click on Maintenance Plans in SQL Server's Object Explorer. Below is a summary of four SQL Server Database Maintenance Stored Procedures.

  1. DBCC SHRINKDATABASE ([Database_Name], Target_Percent)
    Larger databases require more processing power, more memory and are slower. Databases that are too small for the database transaction volume are allocated too few system resources to support the processing power, memory and data needs of the database. Optimizing the size of a database is one of the most effective ways to improve database performance. DBCC SHRINKDATABASE requires some research in terms of setting the value of the Target_Percent argument. Microsoft's support documentation as well as Database Administrator (dba) websites are a good source of information about setting the value of the Target_Percent parameter.

    It is also important to review the database's autogrowth settings. To view the current database settings, run the sp_helpdb command: sp_helpdb @dbname='[Database_Name]'. The default autogrowth and autoshrink settings work for most databases. However, certain databases require the settings to be manually configured. Microsoft's support documentation as well as Database Administrator (dba) websites are a good source of information about autogrowth and autoshrink settings.

  2. DBCC CLEANTABLE ([Database_Name], '[Table_Name]')
    DBCC CLEANTABLE runs a few fundamental clean up operations on database table transactions, locks and logs. DBCC CLEANTABLE also optimizes a database table's configuration after Data Definition Language (DDL) changes are made to the database table.

  3. DBCC DBREINDEX ('[Table_Name]', ' ', FillFactor)
    DBCC DBREINDEX re-indexes a database table's indices. Re-indexing optimizes index performance. DBCC DBREINDEX requires some research in terms of setting the value of the FillFactor parameter. Microsoft's support documentation as well as Database Administrator (dba) websites are a good source of information about setting the value of the FillFactor parameter.

  4. DBCC UPDATEUSAGE ([Database_Name], '[Table_Name]')
    DBCC UPDATEUSAGE updates the performance statics of a database table. Database Performance Statistics are used to tune the database table and the database.



Copyright © Devon Manelski