SQL database maintenance
For any SQL database, we strongly recommend regular maintenance by a qualified IT professional to ensure continuing performance at optimal levels. A database that is not adequately maintained could eventually result in degraded performance or potentially even downtime for applications that use SQL. An effective SQL database maintenance plan addresses the following areas of concern.
Data and log file management
First, as stated above, the data and log files for an SQL database should be kept separate whenever possible, and the data and log files should be monitored regularly to ensure proper and unimpeded growth. Select appropriate autogrow settings in SQL Server Management Studio, preferably using specific MB size amounts for growth rather than percentages. Allowing the autogrow settings to grow data and log files in small and frequent increments would negatively impact performance and could randomly interrupt application processes or could cause file fragmentation. Ideally, your firm should avoid relying on intermittent autogrowth for these files and instead arrange alerts for occasional, proactive manual growth of the files.
Your firm's qualified IT professional who is proficient in SQL can shrink a database automatically or manually to remove unused pages from both data and transaction log files when they no longer need to be as large as they are. While there are exceptions, your IT professional should perform database shrinks in a manual process only after careful consideration and as a last resort when disk space needs to be returned to your OS. We don’t recommend database shrinks as a part of an effective maintenance plan; the process consumes many resources, causes index fragmentation, and adversely affects performance in the long run. Furthermore, an expanding database often needs to grow back to fill the space that the shrink had released. In contrast to using a database shrink, more conducive to efficient and long-term database performance would be to provide ample disk space for the machine that runs SQL Server and to allow for proper growth of data and log files.
Index fragmentation is an avoidable condition that can occur when the server needs more than the optimal disk I/O to access a database table. This condition can be due to data pages in the table having excessive empty space or to a mismatch between the logical order of the pages in a table and their physical order. As index fragmentation increases over time, it can degrade performance by taking up more memory and disk space on the machine that runs SQL Server, by creating larger backup files, and by causing the index not to perform/respond as fast as expected due to the unnecessary logical reads that are required.
Many issues with index fragmentation can be avoided by following the best practices for data and log file maintenance. In addition to proactively preventing this condition and defragmenting the physical disk where the transaction log file resides, a good SQL database maintenance plan includes relying on your firm's qualified IT professional to detect and address any SQL database fragmentation.
The SQL Server Query Optimizer uses statistical information to determine the most accurate and thus the quickest way to retrieve requested data from the database. Those statistics track a multitude of items such as page density, number of records, available indexes, and so forth, and they enable the Query Optimizer to determine the most effective ways to access data. Outdated or missing statistics would cause the Query Optimizer to wait for updated statistics, which could noticeably slow down performance within the application you are using with SQL Server.
While statistics don’t play a role in improving any degradation of performance caused by data issues, part of your firm's maintenance plan for the SQL databases should include making sure that statistics are set to auto-update and checking to see when manual updates of the statistics may be necessary.
In Accounting CS and Practice CS, in addition to managing statistics through queries and via SQL Server Management Studio, you can use the
Update Statistics
command within the application if users experience slow performance after making significant changes in the SQL database.
Accounting CS,
Help > Update Statistics
Practice CS,
Tools > Update Statistics
Data corruption in an SQL database refers to any error that occurs during the reading or writing of SQL and creates unintended modifications to the data. While rare, this corruption affects data integrity and can cause issues ranging from unexpected errors and degraded performance, to data loss and even downtime. While the root cause can widely vary, nearly all data corruption is due to platform issues, driver/firmware bugs, hardware faults (especially in relation to disk subsystems), or security software. Your SQL database maintenance plan should include a process for early detection of any potential hardware issues and corruption in the database, as well as a commitment to follow best practices for avoiding any interference from your security software and other application processes.
Your firm's IT professional should run hardware diagnostics and should constantly monitor the Windows Event Logs for any disk or hardware-related errors. Contact your hardware vendor and your qualified IT professional immediately if you find any hardware issues. Because data corruption could occur in the database well before becoming apparent in the application itself, your IT professional should regularly review the SQL Error logs in SQL Server Management Studio and should occasionally perform database integrity checks (through the
DBCC CHECKDB query). To limit data loss if data corruption were to occur, be sure to keep periodic backups of the database.
Regularly backing up your SQL database is an imperative component of your firm's disaster recovery strategy and maintenance plan, even when redundancies are in place. Because SQL databases are always running and most likely reside in a location that is separate from your firm's flat-file data, during an emergency downtime your firm should not depend solely on any image backups of live SQL data. In addition to creating database backups through SQL Server Management Studio, most SQL-based CS Professional Suite applications provide the ability to schedule periodic backups, and these scheduled backup features should be used whenever possible instead of using SQL Server Management Studio for backups.
Special information for backups
Be sure your SQL database backups are
not
stored on the same physical location as the actual database files. In case of damage to the physical drive where the live data resides, you should still be able to access and use the separate drive or remote location so that you can restore data.
Keep an appropriate backup schedule of your SQL database in accordance with your firm's needs and the needs of the application. The longer you go between backups, the higher the risk of significant data loss.
Test backups occasionally by restoring them on a separate server or standalone machine. This will enable you to verify that the backups are being created properly and could be used during any unplanned downtime.
SQL database maintenance items should be discussed with and performed by a qualified IT professional who is proficient in using SQL Server.