SQL Maintenance script for the Symantec Management Platform database
book
Article ID: 158633
calendar_today
Updated On:
Products
IT Management SuiteClient Management Suite
Issue/Introduction
Fragmentation of indexes is a large concern and performance impact on the Symantec Management Platform database (Symantec_CMDB).
It can affect many areas of the product including console performance, replication and client data processing.
Environment
ITMS 8.x
Cause
Index fragmentation is a normal process that happens as data is added and removed from a database. Maintenance needs to be in place to address it.
Resolution
Note: The attached script can be run using any available method, such as a SQL Job, SQL Maintenance Plan for Scripts, Task Server task from the product, etc.
The attached script has the following benefits:
Only defragment tables that are being used and have at least 20% (Configurable) fragmentation
Rebuild for greater than 50% (Configurable) fragmentation and use the more efficient Reorganize for 20-49% (Configurable)
Contains a list of tables to always Reorganize to help avoid deadlocking
Continue if any table fails rather than aborting like a typical Maintenance Plan
Updates the Statistics using Microsoft's sp_updatestats
IMPORTANT: If the name of the database is not the default Symantec_CMDB. Please make sure to change the top line of the script from USE Symantec_CMDB to USE < Non-Default DB Name>
Example steps for creating a SQL Job on SQL Server 2012 - 2019
Open SQL Management Studio
Open Object Explorer if it is not and expand "SQL Server Agent"
Right-click on the "Jobs" folder and select "New Job"
In the Select a page pane
General
Name: "Defragmentation and statistics Maintenance"
Owner: Change if needed
Category: does not need to be changed
Steps
Click "New"
Name it "Run Script"
Type: should be Transact-SQL script (T-SQL)
Run as: can be left blank
Database: Select the correct Database
Paste the script attached to the KB for the appropriate version
Click "OK"
Schedules
Click "New"
Name: Schedule
Schedule Type: Recurring
Occurs: Daily
Pick an appropriate time for the server based on other scheduled tasks.