SLM Database Maintenance Guide
SLM database maintenance helps administrators maintain the performance, reliability and recoverability of the Microsoft SQL Server databases supporting Safety Lifecycle Manager. SQL Server maintenance plans can automate recurring administrative tasks and provide a structured approach to routine database maintenance.
The SLM training demonstrates two maintenance schedules: a daily plan covering backups, database integrity checks and cleanup tasks, and a weekly plan covering index and statistics maintenance. These tasks are configured through SQL Server Management Studio and scheduled for periods when database activity is low.
This guide explains the SLM database maintenance workflow, including daily and weekly maintenance plans, database backups, integrity checks, cleanup, index maintenance and monitoring maintenance-plan history.
Planning SLM Database Maintenance
SLM database maintenance uses Microsoft SQL Server maintenance plans to organize recurring database administration tasks. A maintenance plan provides a scheduled workflow for operations intended to maintain the health and efficiency of the database environment.
The training identifies several important maintenance activities:
- Regular database backups
- Index maintenance
- Database integrity checks
- Updating statistics
- Database and backup cleanup
These tasks address different aspects of database administration. Backups provide recoverable copies of data, integrity checks help identify database consistency problems, index and statistics maintenance support query processing, and cleanup tasks remove older files or history according to the organization’s retention requirements.
Administrators responsible for the underlying SQL Server environment should also review the SLM Database Configuration guide alongside these maintenance procedures.
Creating SQL Server Maintenance Plans
The SLM database maintenance workflow demonstrated in the training uses SQL Server Management Studio and the Maintenance Plan Wizard.
Within SQL Server Management Studio, expand the Management folder and locate Maintenance Plans. The Maintenance Plan Wizard can then be opened from the context menu.
If the wizard cannot run because SQL Server Agent is stopped, the training demonstrates starting SQL Server Agent before returning to the Maintenance Plan Wizard.
The example creates two separate plans:
- Daily Maintenance Plan
- Weekly Maintenance Plan
Separating the plans allows different database tasks to run on different schedules. The appropriate execution time should be selected according to the organization’s operating requirements and should ideally avoid periods of normal user activity.
Daily Backup and Integrity Tasks
The daily SLM database maintenance plan demonstrated in the training contains four principal tasks:
- Backup Database – Full
- Check Database Integrity
- Cleanup History
- Maintenance Cleanup Task
The order of the tasks can be adjusted within the Maintenance Plan Wizard. In the demonstrated plan, the full database backup is moved to the beginning, followed by the integrity check and cleanup operations.
The daily schedule should be configured for a suitable low-activity period. The training uses midnight as an example, while noting that the actual time should be determined by the organization.
The purpose is not to prescribe one universal maintenance time but to ensure that recurring database administration is scheduled appropriately for the SLM environment.
Configuring SLM Database Backups
For the demonstrated full-backup task, the maintenance plan is configured to include all user databases and to ignore databases whose state is not online.
The backup can be directed to disk or, where applicable, URL-based storage. The training example uses disk and the default SQL Server backup directory.
The demonstrated backup configuration also enables:
- Backup compression
- Backup checksum
- Continue on error
Where an environment contains a large number of databases, backup duration should be monitored. The training explains that administrators can divide databases between separate maintenance plans if processing all databases in one plan results in an unsuitable runtime.
For example, an environment with 20 databases could divide them between two maintenance plans rather than processing all 20 through a single schedule.
Integrity Checks and Database Cleanup
Database integrity checks form another part of the daily SLM database maintenance plan. The demonstrated configuration selects all user databases and ignores databases that are not online.
The integrity task uses the default options shown in the training.
The daily plan also contains cleanup operations. Cleanup History is configured with a retention period, with four weeks used as the demonstrated default. The appropriate period can be changed according to company policy and can be expressed in hours, days, weeks, months or years.
The Maintenance Cleanup Task removes old backup files after the configured period. In the training example, the task points to the SQL Server backup folder and targets files using the .bak extension.
Backup retention should therefore be configured according to the organization’s own backup, recovery and retention requirements rather than assuming that the example period is appropriate for every SLM installation.
Monitoring Maintenance Plan History
After the daily plan has been created, SQL Server Management Studio displays it within Maintenance Plans. Administrators can open the plan to review its individual steps and modify task settings where required.
Any modifications made to the maintenance plan should be saved before closing the configuration.
The maintenance-plan history provides useful operational information about previous executions. The training highlights information including:
- Execution date
- Plan and subplan information
- Duration
Duration is particularly useful when reviewing SLM database maintenance because it shows how long the scheduled work takes to complete.
If a plan containing all databases takes too long, administrators can consider splitting the database workload between multiple maintenance plans or adjusting schedules to prevent maintenance processes from overlapping.
Weekly Index and Statistics Maintenance
The second SLM database maintenance plan demonstrated in the training runs weekly and focuses on index and statistics maintenance.
As with the daily plan, it should be scheduled for a period when users are not actively working with the database. The example uses Saturday at 1:30 AM so that it does not run at the same time as the daily midnight plan.
The training demonstrates the following maintenance operations:
- Rebuild Index
- Reorganize Index
- Update Statistics
The appropriate index-maintenance strategy depends on the SQL Server environment and edition being administered. The training discusses different choices for Standard and Enterprise environments and demonstrates the available tasks within the Maintenance Plan Wizard.
Because SQL Server capabilities and online index-operation support can depend on SQL Server version, edition and index characteristics, administrators should confirm the appropriate approach for their deployed SQL Server environment rather than applying one maintenance configuration universally.
Microsoft provides current guidance on reorganizing and rebuilding SQL Server indexes, including considerations for fragmentation, statistics and resource usage.
Configuring Index Maintenance Tasks
The demonstrated weekly maintenance plan applies its index operations to the relevant user databases while excluding databases that are not online.
For the Rebuild Index task, the training also demonstrates an advanced option intended to keep the index online during the operation where the SQL Server environment supports that capability.
The Reorganize Index and Update Statistics tasks are then configured for the selected databases using the options demonstrated within the wizard.
After the required operations have been selected and configured, SQL Server Management Studio can write a maintenance-plan report to a text file. The wizard then provides a summary of the plan before it is created.
Once completed, refreshing the Maintenance Plans area shows both the daily and weekly plans available for administration.
Building a Reliable Database Maintenance Routine
SLM database maintenance should be treated as a recurring operational process rather than a one-time configuration task.
A practical maintenance routine should consider:
- When backups and other maintenance tasks run
- Whether maintenance overlaps with periods of normal SLM usage
- How long individual plans take to complete
- Which databases are included in each plan
- Backup and maintenance-history retention requirements
- The SQL Server version and edition in use
- Whether daily and weekly tasks overlap with one another
The maintenance-plan history can then be reviewed to determine whether schedules remain appropriate as database size and workload change.
Database maintenance is also only one layer of SLM administration. The SLM Application Maintenance guide covers IIS and PHP application logging, while the SLM Background Task Manager guide covers application background processing.
Together with appropriate SQL Server configuration, these maintenance practices help administrators establish a structured approach to supporting the SLM application and its underlying database environment.
Database Maintenance
0:06
Welcome to this IT Explainer video, part of our maintenance topic range.
0:10
In this video we will cover the subject of database maintenance for SLM.
0:15
In this section, we will discuss SQL Server database maintenance plans and explore various options available to the database administrator or IT Administrator.
0:25
A SQL Server database maintenance plan is a comprehensive strategy designed to ensure the optimal performance, reliability, and security of SQL Server databases.
0:36
This plan encompasses a variety of tasks and procedures aimed at maintaining the health and efficiency of the database environment.
0:43
Regular backups ensure that the database is regularly backed up to prevent loss in case of hardware failure, software issues, or other disasters.
0:53
Index maintenance involves rebuilding and reorganising the indexes to improve query performance and reduce fragmentation.
1:00
Integrity Checks involves running consistency checks to identify and repair any corruption or inconsistencies in the database.
1:08
Updating statistics to ensure the query optimizer has accurate information for generating efficient execution plans and database cleanup.
1:16
Removing unnecessary data such as old backup files and transaction logs to free up space and improve performance.
1:27
So for this task, we need to open Microsoft SQL Server Management Studio.
1:32
Once you’ve opened it, expand the Management folder.
1:35
Right click on Maintenance Plans and Maintenance Plan Wizard.
1:39
You may get this error message.
1:41
Not to worry.
1:43
If we come down to the SQL Server Agent, right click and click Start message pops up.
1:50
Click OK, Right click on the SQL Server Agent and click Start.
1:57
Then back to the Maintenance plan.
1:58
Right click and Maintenance Plan Wizard.
2:01
Click Next.
2:04
We’re going to create 2 maintenance plans.
2:06
One will be the daily maintenance plan and 1:00 will be the weekly plan.
2:12
So we’ll name this daily maintenance plan.
2:14
Under schedule, click on change.
2:17
We’re going to select daily and for the time that it’s going to occur, you need to select a time when that people won’t be using the system.
2:26
It could be 10:00 PM or it could be 12:00 AM.
2:30
You have to go whatever’s best for your organization.
2:32
Just click OK, click Next.
2:36
So on the daily plan, we’re going to select Backup database full, Check database integrity, cleanup History, and Maintenance cleanup Task, and then click on Next.
2:54
In this window, we can change the order.
2:56
So we’re going to go with backup database first.
2:59
So we need to click on there and move it up to the top.
3:02
Then we’ll have Check database, integrity, cleanup History, and maintenance cleanup task.
3:08
That’s fine.
3:08
Click Next for the backup.
3:10
Under the General tab, we’re going to select all user databases, and we’re going to tick this box for Ignore databases where the state is not online.
3:19
Now if you have a lot of databases, this may take a while.
3:22
There is a way to see how long this will take to run, and depending on how long it’s taking, you could come back and actually select individual databases rather than all of the databases.
3:36
Let’s say for example, you have 20 databases.
3:39
You can select 10 databases for the first plan and then the other 10 databases for a second plan.
3:45
But in this case, we don’t have very many, so we’re just going to select all databases and click OK, The backup to you have a URL, you can select that here.
3:56
We’re going to go with disk and click on destination.
4:01
If you’re backing up to URL, you can enter the URL in here, but as we’re going with disk, we’re going to go with the default backup folder extension is not back under the Options tab for the compression, we’re going with a compressed backup.
4:14
We do want a performance checksum and continue on error because if there is an error when running a backup, you want it to continue with the process.
4:22
Let’s click next, and this is the integrity task.
4:27
So let’s select all user databases and you can check this box again and click OK.
4:34
The default options are fine in here.
4:36
So click next.
4:37
So this is the clean up task.
4:39
Now 4 weeks is the default, so we’re going to go with that.
4:42
But depending on your company policy, you can obviously edit this and it could be hours, days, weeks, months or years.
4:48
But we’re going to go with the default and click next.
4:51
So now we’re on the clean up task.
4:53
So this will delete the old backups after a certain period of time.
4:57
If you have Azure storage or URL based storage, you can put in the URL here.
5:02
So for us, we’re going to find the SQL backup folder under Program Files SQL Server.
5:12
Go into the SQL folder and select Backup folder.
5:17
Click OK under the extension.
5:21
It’s going to be BAK file age is something again that will depend on your company policy and click on next.
5:28
We can leave this as the default to write a report to a text file.
5:32
Here is an overview of all the actions that we have set up.
5:36
So we’re going to click on finish.
5:38
The maintenance plan is now successfully set up.
5:42
Let’s right click on the maintenance plans and click refresh.
5:48
And here we can see the daily maintenance plan.
5:50
Now if you double click on that, we can see all the steps that are in the plan.
5:58
Here if you want to change something, you can directly click on it to make to edit the plan.
6:04
So for example, if we double click on the database backup, we’re back into this view again where we can make modifications.
6:13
When you make any modifications, make sure you click save.
6:17
If you right click on the maintenance plan, you can go to view history.
6:23
Here we can see the date that it runs the plan.
6:25
Name the sub plan.
6:29
The important thing here really is the duration.
6:31
We want to see how long the plan is taking to run.
6:34
If it takes a long time and you’ve selected all the databases, you might want to create multiple maintenance plans, splitting up the databases into different tasks.
6:43
But here it’s obviously currently empty because we haven’t run the maintenance plan yet.
6:46
Let’s click close.
6:49
So now let’s go back and create the second maintenance plan.
6:53
So let’s right click and go to the maintenance plan wizard again.
6:57
Click next.
6:59
So we’re going to name this the weekly maintenance plan.
7:05
Click on change.
7:07
It’s going to run weekly.
7:10
You want to select a day where it’s going to run when no users will be using the database.
7:15
So let’s go with Saturday.
7:16
So we have the daily maintenance plan running at 12.
7:19
So depending on how long it takes, you may want to change this time so as they don’t run at the same time.
7:23
So let’s just change this to 1:30 AM and that’s it.
7:29
And click on OK, select the default options for the plan properties.
7:35
Now in this one, we’re going to do some reindexing.
7:37
Now based on a data space server that you have.
7:40
If you have standard edition or anything but the Enterprise Edition, then you can select Reorganize and update statistics.
7:48
But if you have Enterprise Edition, you don’t want to select these two options.
7:51
You just want to select rebuild the index.
7:54
The reason is because Enterprise Edition, when it rebuilds the index, it doesn’t take the database offline, which is the aim, because we don’t want the databases to be taken offline.
8:04
In the standard edition, it doesn’t do that.
8:06
For the purpose of this video, I’ll select Reorganise Index, update Statistics, and Rebuild Index.
8:13
But again, if you have Enterprise Edition, you just want to select Rebuild Index.
8:18
It’s not necessary.
8:19
But since we’re producing this video for the standard and enterprise editions, let’s just move the enterprise task to the top here and click on Next.
8:30
And now we have the options for rebuilding the index for the databases.
8:35
Again, we want to select all and ignore databases where the state is not online.
8:41
On the advanced options, we want to keep index.
8:45
This is one that keeps the index online.
8:47
Everything else is default.
8:50
So now click on Next.
8:52
So this is for the standard edition when we reorganize the index, so we’re going to select all databases and ignore the databases where it’s offline.
9:02
Everything else is default.
9:03
Click on next and this is again for standard edition.
9:09
Select all databases and ignore databases that are not online.
9:14
Click on Next, write the report is fine.
9:16
Click on Next.
9:18
That’s an overview of the plan.
9:19
Now click finish.
9:23
If we right click maintenance plans and refresh we can see we now have a daily maintenance plan which involves daily backups and daily checks and cleanups and we have the weekly maintenance plan also.