---
title: "Test-DbaBackupStorageCompatibility"
description: "Estimates whether recent database backups fit cloud storage limits."
url: "https://dbatools.io/Test-DbaBackupStorageCompatibility/"
availability: "Windows, Linux, macOS"
tags: ["Backup", "S3", "Cloud", "AWS"]
author: "the dbatools team + Claude"
source: "https://github.com/dataplat/dbatools/blob/master/public/Test-DbaBackupStorageCompatibility.ps1"
last_updated: "2024-01-01"
---

# Test-DbaBackupStorageCompatibility

## Synopsis

Estimates whether recent database backups fit cloud storage limits.

## Description

Evaluates the most recent full backup for each selected database against the limits of a cloud backup storage provider. The initial provider is S3-compatible object storage for SQL Server 2022 and later.  
  
S3-compatible SQL Server backups support at most 64 URLs and 10,000 multipart upload parts per URL. This command estimates parts per URL by evenly dividing the effective backup size across the backup file count. It uses compressed size when the backup history reports one, otherwise it uses the uncompressed size.  
  
The estimate helps identify backup configurations that need more URLs, a larger MAXTRANSFERSIZE, or compression before moving to S3-compatible storage. It does not validate credentials, network access, or a specific object storage implementation.

## Syntax

```powershell
Test-DbaBackupStorageCompatibility
    [-SqlInstance] <DbaInstanceParameter[]>
    [[-SqlCredential] <PSCredential>]
    [[-Database] <Object[]>]
    [[-ExcludeDatabase] <Object[]>]
    [[-Type] <String>]
    [[-MaxTransferSize] <Int64>]
    [[-Threshold] <Int32>]
    [-Monitor]
    [-EnableException]
    [<CommonParameters>]

```

## Examples

### Example 1: Evaluates the most recent full backup for every accessible database on sql2022 using the S3 default...

```powershell
PS C:\> Test-DbaBackupStorageCompatibility -SqlInstance sql2022
```

Evaluates the most recent full backup for every accessible database on sql2022 using the S3 default MAXTRANSFERSIZE of 10 MiB.  

### Example 2: Evaluates the Sales database using a 20 MiB MAXTRANSFERSIZE estimate

```powershell
PS C:\> Test-DbaBackupStorageCompatibility -SqlInstance sql2022 -Database Sales -MaxTransferSize 20971520
```

Evaluates the Sales database using a 20 MiB MAXTRANSFERSIZE estimate. A backup written with this value requires compression.  

### Example 3: Returns only databases at or above 80 percent of the S3 part limit or outside an S3 limit, and signals when...

```powershell
PS C:\> Test-DbaBackupStorageCompatibility -SqlInstance sql2022 -Threshold 80 -Monitor
```

Returns only databases at or above 80 percent of the S3 part limit or outside an S3 limit, and signals when any are found.  

### Required Parameters

##### -SqlInstance

The target SQL Server instance or instances. S3-compatible backup evaluation requires SQL Server 2022 or later.

| Property | Value |
| --- | --- |
| Alias |  |
| Required | True |
| Pipeline | true (ByValue) |
| Default Value |  |

### Optional Parameters

##### -SqlCredential

Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).  
Windows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.  
For MFA support, please use Connect-DbaInstance.

| Property | Value |
| --- | --- |
| Alias |  |
| Required | False |
| Pipeline | false |
| Default Value |  |

##### -Database

Specifies one or more databases to evaluate. By default, all accessible databases with full backup history are evaluated.

| Property | Value |
| --- | --- |
| Alias |  |
| Required | False |
| Pipeline | false |
| Default Value |  |

##### -ExcludeDatabase

Specifies one or more databases to exclude from evaluation.

| Property | Value |
| --- | --- |
| Alias |  |
| Required | False |
| Pipeline | false |
| Default Value |  |

##### -Type

Specifies the cloud backup storage provider. The only currently supported value, and the default, is S3.

| Property | Value |
| --- | --- |
| Alias |  |
| Required | False |
| Pipeline | false |
| Default Value | S3 |
| Accepted Values | S3 |

##### -MaxTransferSize

Specifies the MAXTRANSFERSIZE value in bytes used to estimate multipart upload parts. S3-compatible SQL Server backups support values from 5 MiB through 20 MiB. The default is 10 MiB (10485760 bytes).  
Values other than 10 MiB require backup compression when the backup is written.

| Property | Value |
| --- | --- |
| Alias |  |
| Required | False |
| Pipeline | false |
| Default Value | 10485760 |

##### -Threshold

Specifies the percentage of the 10,000-part limit at which a compatible backup is reported as Warning. The default is 90.

| Property | Value |
| --- | --- |
| Alias |  |
| Required | False |
| Pipeline | false |
| Default Value | 90 |

##### -Monitor

Returns only Warning or incompatible results. After returning those results, signals an InvalidResult through Stop-Function when one or more risks were found.

| Property | Value |
| --- | --- |
| Alias |  |
| Required | False |
| Pipeline | false |
| Default Value | False |

##### -EnableException

By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.  
This avoids overwhelming you with "sea of red" exceptions, but is inconvenient because it basically disables advanced scripting.  
Using this switch turns this "nice by default" feature off and enables you to catch exceptions with your own try/catch.

| Property | Value |
| --- | --- |
| Alias |  |
| Required | False |
| Pipeline | false |
| Default Value | False |

## Outputs

**PSCustomObject**

Returns one estimate per database with full backup history. With -Monitor, returns only Warning or incompatible estimates.

**Properties:**

- ComputerName: Computer name of the SQL Server instance (string)
- InstanceName: SQL Server service name (string)
- SqlInstance: Full SQL Server instance name (string)
- Database: Database evaluated (string)
- Type: Storage provider evaluated; currently S3 (string)
- LastFullBackup: Start time of the most recent full backup (DateTime)
- BackupSizeBytes: Uncompressed backup size in bytes (decimal)
- CompressedBackupSizeBytes: Compressed backup size in bytes, or zero when unavailable (decimal)
- EffectiveBackupSizeBytes: Size used for the estimate; compressed size when available, otherwise uncompressed size (decimal)
- BackupFileCount: Number of files in the backup set (int)
- MaxTransferSize: MAXTRANSFERSIZE used for the estimate, in bytes (long)
- EstimatedPartsPerFile: Estimated multipart upload parts for each evenly striped backup file (long)
- PercentOfLimit: Estimated parts as a percentage of the 10,000-part S3 limit (decimal)
- IsCompatible: Whether the estimate is within both the part and 64-URL limits (bool)
- Status: Compatible, Warning, ExceedsPartLimit, ExceedsFileLimit, or ExceedsLimits (string)
- RecommendedFileCount: Suggested number of backup URLs when calculable, otherwise null (int)
- RecommendedMaxTransferSizeBytes: Suggested MAXTRANSFERSIZE in bytes when calculable, otherwise null (long)
- Recommendation: Conservative configuration guidance for Warning or incompatible estimates, otherwise null (string)

---

Part of [dbatools](https://dbatools.io/), a free and open source PowerShell module for SQL Server administration. Full command index: https://dbatools.io/commands/
