Invoke-sqmSetDatabaseRecoveryMode
ConfigurationsqmSQLTool v1.8.2+ · Database Config⚠ High Impact ✓ Pre-checks
Parameters
| Parameter | Type | Required | Default | Notes |
|---|---|---|---|---|
| -SqlInstance | string | Optional | , | Target SQL Server instance. |
| -SqlCredential | PSCredential | Optional | , | Credentials for the connection. |
| -Database | string[] | Optional | , | Target databases (name or wildcard pattern). |
| -RecoveryMode | string | Required | , | Target mode: FULL | BULK_LOGGED | SIMPLE |
| -EnableException | switch | Switch | $false | Re-throw exceptions immediately. |
| -WhatIf / -Confirm | switch | Optional | , | ShouldProcess (ConfirmImpact: High) guards mode change. |
| -All | switch | Switch | $false | When set, changes the recovery mode for all user databases. |
Execution Flow
Examples
Change to SIMPLE recovery (with log backup first)
Invoke-sqmSetDatabaseRecoveryMode -SqlInstance "SQL01" -Database "MyDB" -RecoveryMode "SIMPLE" -BackupLogBefore
Change multiple databases with -WhatIf
Invoke-sqmSetDatabaseRecoveryMode -SqlInstance "SQL01" -Database "Dev*" -RecoveryMode "BULK_LOGGED" -WhatIf