---
title: DatabaseMaintenance System Parameter – Nightly Log Database Maintenance
description: "DatabaseMaintenance turns the Nodinite Logging Service's nightly Log Database maintenance on or off with a JSON value: reorganize indexes above 15% fragmentation and shrink archive Log Databases. Default {\"Enabled\":true}."
---

# DatabaseMaintenance - System Parameter

**DatabaseMaintenance** turns the nightly [Log Database][Log Databases] maintenance of the [Logging Service][] on or off: reorganizing fragmented indexes and shrinking archive Log Databases. Turn it off only when your own SQL Server maintenance takes care of the <span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> Log Databases.

![DatabaseMaintenance opened from the System Parameters list: the JSON value {"Enabled":true} with Json model is valid and Data type json, changed to {"Enabled":false} and saved, then back to {"Enabled":true} and saved; Log Audit Search for the operation shrink shows last night's runs, Start shrink of 2 Log database(s) and Completed shrink of Log databases, by the Database Cleanup Worker of the Nodinite Logging Service, animated walkthrough (7.12)][1]  
*Animated walkthrough: the value is JSON, not a plain boolean. `{"Enabled":false}` makes the Logging Service skip the next maintenance window; the [Log Audit][Log Audits] shows each night's run.*

<h2 id="at-a-glance"><i class="fal fa-table" aria-hidden="true"></i> At a Glance</h2>

| Property | Value |
| --- | --- |
| Key | `DatabaseMaintenance` |
| Data type | json |
| Default | `{"Enabled":true}` |
| Read by | [Logging Service][] |
| Takes effect | The Logging Service reads the value every 10 minutes; a change applies in the next maintenance window. No restart needed. |
| Status | ✅ Active |
| Since | Nodinite 3 |

## <i class="fal fa-gears" aria-hidden="true"></i> How It Works

When `Enabled` is `true`, the Logging Service runs maintenance once a day between 03:00 and 04:00, in the local time of the server it runs on. Its loop wakes every 10 minutes, so the start falls somewhere in that hour. The "once" is kept in memory: a Logging Service restart inside the window runs the maintenance again.

An empty value also means enabled. A value that isn't valid JSON turns maintenance off for that run, and the Logging Service logs it as critical.

| Log Database | Maintenance |
| --- | --- |
| Online Log Database | **Reorganize** indexes above 15% fragmentation. |
| Archive Log Databases | **Reorganize** indexes above 15% fragmentation. **Shrink** to return unused disk space to the operating system. |

* Read-only archive Log Databases and Log Databases in an [Always On Availability Group][AlwaysOn] are skipped.
* The [Log Audit][Log Audits] records each run under the Function *Database Cleanup Worker*: *Start shrink of N Log database(s)*, *Reorganized of database: '…' changed N indexes to increase performance*, *Shrink of … saved N MB*, and *Completed shrink of Log databases*. The *Start shrink* list also names the online Log Database, although only archives are shrunk.
* Shrink is a privileged operation: the Logging Service account needs the `sysadmin` role. Take regular backups before you rely on it.
* This parameter does not control retention. The removal of old data per [Message Type][Message Types] runs separately; see [Data Retention][Logging Service - Data Retention] on the Logging Service page and [CleanUpTimerInterval][].

When `Enabled` is `false`, the Logging Service skips this maintenance, and your DBA must maintain the indexes and shrink the Log Databases.

## <i class="fal fa-lightbulb" aria-hidden="true"></i> Choosing a Value

* Keep `{"Enabled":true}` (recommended), and **exclude the <span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> databases from your own maintenance jobs**. Two maintenance processes on the same databases overlap and compete.
* Set `{"Enabled":false}` only when your own jobs are meant to maintain the <span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> Log Databases.
* Set `{"Enabled":false}` when the Logging Service account is not `sysadmin`; otherwise the shrink fails every night. See [SQL Server Sysadmin Requirements][].

### Example: Exclude Nodinite Databases in IndexOptimize

If you use Ola Hallengren's `IndexOptimize` and every <span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> database name starts with `Nodinite` (the default [LogDatabaseName][] pattern), exclude them with a wildcard:

```sql
EXECUTE dbo.IndexOptimize
    @Databases = 'USER_DATABASES,-Nodinite%',
    @FragmentationLow = NULL,
    @FragmentationMedium = 'INDEX_REORGANIZE,INDEX_REBUILD_ONLINE,INDEX_REBUILD_OFFLINE',
    @FragmentationHigh = 'INDEX_REBUILD_ONLINE,INDEX_REBUILD_OFFLINE',
    @UpdateStatistics = 'ALL';
```

This excludes, for example, `Nodinite_DEMO_Config` and `Nodinite_DEV_Log_20241108`. Adjust the pattern if you changed [LogDatabaseName][].

## <i class="fal fa-hand-point-right" aria-hidden="true"></i> Next Steps

* <i class="fal fa-database" aria-hidden="true"></i> [Log Databases][]  
* <i class="fal fa-list" aria-hidden="true"></i> [Manage Log Databases][]  
* <i class="fal fa-shield-halved" aria-hidden="true"></i> [SQL Server Sysadmin Requirements][]  
* <i class="fal fa-pen-to-square" aria-hidden="true"></i> [Manage System Parameters][]  

## <i class="fal fa-link-horizontal" aria-hidden="true"></i> Related Topics

* <i class="fal fa-sort-size-up-alt" aria-hidden="true"></i> [SizeToSplitDatabaseOn][]  
* <i class="fal fa-calendar-day" aria-hidden="true"></i> [DaysToSplitDatabaseOn][]  
* <i class="fal fa-database" aria-hidden="true"></i> [LogDatabaseName][]  
* <i class="fal fa-disc-drive" aria-hidden="true"></i> [LogLocations][]  
* <i class="fal fa-life-ring" aria-hidden="true"></i> [LogDatabaseRecovery][]  
* <i class="fal fa-user-secret" aria-hidden="true"></i> [LogAccessRoles][]  
* <i class="fal fa-users-class" aria-hidden="true"></i> [LogServiceUsers][]  
* <i class="fal fa-server" aria-hidden="true"></i> [AvailabilityGroupBackupPath][]  
* <i class="fal fa-clock" aria-hidden="true"></i> [CleanUpTimerInterval][]  
* <i class="fal fa-hard-drive" aria-hidden="true"></i> [Logging Service][]  
* <i class="fal fa-sliders" aria-hidden="true"></i> [System Parameters][]  

[1]:https://docs.nodinite.com/media/Documentation%20Pictures/IM/CoreServices/ConfigurationDatabase/SystemParameters/SystemParameters_DatabaseMaintenance.gif

[AlwaysOn]:https://docs.nodinite.com/install-and-update/troubleshooting/sql-server/always-on-availability-groups/
[AvailabilityGroupBackupPath]:https://docs.nodinite.com/administration/settings/system-parameters/availabilitygroupbackuppath/
[CleanUpTimerInterval]:https://docs.nodinite.com/administration/settings/system-parameters/cleanuptimerinterval/
[DaysToSplitDatabaseOn]:https://docs.nodinite.com/administration/settings/system-parameters/daystosplitdatabaseon/
[Log Audits]:https://docs.nodinite.com/administration/tools/log-audit-search/
[Log Databases]:https://docs.nodinite.com/core-services/log-databases/overview/
[LogAccessRoles]:https://docs.nodinite.com/administration/settings/system-parameters/logaccessroles/
[LogDatabaseName]:https://docs.nodinite.com/administration/settings/system-parameters/logdatabasename/
[LogDatabaseRecovery]:https://docs.nodinite.com/administration/settings/system-parameters/logdatabaserecovery/
[Logging Service]:https://docs.nodinite.com/core-services/logging-service/overview/
[Logging Service - Data Retention]:https://docs.nodinite.com/core-services/logging-service/overview/#data-retention
[LogLocations]:https://docs.nodinite.com/administration/settings/system-parameters/loglocations/
[LogServiceUsers]:https://docs.nodinite.com/administration/settings/system-parameters/logserviceusers/
[Manage Log Databases]:https://docs.nodinite.com/administration/settings/log-databases/overview/
[Manage System Parameters]:https://docs.nodinite.com/administration/settings/system-parameters/manage-system-parameters/
[Message Types]:https://docs.nodinite.com/repository-model/message-types/overview/
[SizeToSplitDatabaseOn]:https://docs.nodinite.com/administration/settings/system-parameters/sizetosplitdatabaseon/
[SQL Server Sysadmin Requirements]:https://docs.nodinite.com/install-and-update/troubleshooting/sql-server/sql-server-sysadmin-requirements/
[System Parameters]:https://docs.nodinite.com/administration/settings/system-parameters/overview/