Import-sqmDatabaseSettings
SQL ConfigurationsqmSQLTool v1.9.88+ · Import🔓 ALTER on the target databases
Export-sqmDatabaseSettings. Reads the JSON snapshot at -InputPath and, for every database it contains that also exists on -SqlInstance, compares each captured Options setting (from Get-sqmDatabaseSettingsDefinition) against the live value and applies only the ones that actually differ, as one ALTER DATABASE ... SET statement per changed setting, so a partial failure never blocks the remaining settings (see -ContinueOnError). Two properties of the definitions are respected. Settings with AlterOption = $null (CollationName, ContainmentDesc, StateDesc, UserAccessDesc) are informational only and are never applied, regardless of any switch. Settings marked Exclusive (ReadOnly, ReadCommittedSnapshot, BrokerEnabled) need WITH ROLLBACK IMMEDIATE and can terminate active connections, so they are applied only with -IncludeExclusiveOptions; without it a differing exclusive setting is reported as Skipped, so it stays visible instead of silently vanishing.Parameters
| Parameter | Type | Required | Default | Notes |
|---|---|---|---|---|
| -SqlInstance | string | Required | , | Target instance the snapshot is applied to. |
| -SqlCredential | PSCredential | Optional | , | SQL or Windows credential. Without it: Windows authentication. |
| -InputPath | string | Required | , | Path to the JSON file produced by Export-sqmDatabaseSettings. Validated to exist. |
| -Database | string[] | Optional | every database in the snapshot | Restrict the import to these database names from the snapshot (wildcards allowed). |
| -ExcludeDatabase | string[] | Optional | , | Additional database names to exclude (wildcards allowed). |
| -IncludeExclusiveOptions | switch | Switch | $false | Also apply ReadOnly / ReadCommittedSnapshot / BrokerEnabled. These use WITH ROLLBACK IMMEDIATE and terminate other active connections. |
| -ContinueOnError | switch | Switch | $false | Continue with the next setting/database if one fails instead of aborting the whole run. |
| -EnableException | switch | Switch | $false | Throw exceptions immediately. Overrides -ContinueOnError. |
| -WhatIf / -Confirm | switch | Switch | ConfirmImpact = Medium | Show or confirm what would be applied per database before anything changes. |
Execution Flow
Examples
Apply every differing, non-exclusive Options setting from a snapshot
Import-sqmDatabaseSettings -SqlInstance 'SQL01' -InputPath 'C:\Backups\SQLSnapshots\DatabaseSettings_SQL01_20260810_120000.json'
Restore one database fully, including the exclusive options
Import-sqmDatabaseSettings -SqlInstance 'SQL01' -InputPath '.\baseline.json' -Database 'Frontarena' -IncludeExclusiveOptions
Dry run before a maintenance window
Import-sqmDatabaseSettings -SqlInstance 'SQL01' -InputPath '.\baseline.json' -WhatIf
Capture a baseline first, restore it later
Export-sqmDatabaseSettings -SqlInstance 'SQL01' -OutputPath 'C:\Backups\SQLSnapshots' # ... changes happen ... Import-sqmDatabaseSettings -SqlInstance 'SQL01' -InputPath 'C:\Backups\SQLSnapshots\DatabaseSettings_SQL01_20260810_120000.json' -ContinueOnError