dataplat / dbatools

🚀 SQL Server automation and instance migrations have never been safer, faster or freer
https://dbatools.io
MIT License
2.39k stars 787 forks source link

Get-DbaDbBackupHistory - exception on data source length in connection #9351

Open Venkat20241985 opened 1 month ago

Venkat20241985 commented 1 month ago

Verified issue does not already exist?

No, I did not search

What error did you receive?

WARNING: [03:57:55][Get-DbaDbBackupHistory] Failure | The value's length for key 'Data Source' exceeds its limit of '128'. PS>TerminatingError(): "System error."

DBATools version 2.1.14

Steps to Reproduce

# provide your command(s) executed pertaining to dbatools
# please include variable values (redacted or fake if needed) for reference
    $FullSync    = $null
    $FullSync    = @()
    $minusdays   = 14;
    $minus14days = (Get-Date).Adddays(-($minusdays))
         $FullSync    += Get-DbaDbBackupHistory -SqlInstance $src -Database $SouceDatabase -Last -IncludeCopyOnly -Since  $minus14days

Please confirm that you are running the most recent version of dbatools

PS G:\PS\DB Restores DBA Tools> Get-InstalledModule dbatools

Version Name Repository Description


2.1.14 dbatools PSGallery The community module that enables SQL Server Pros to automate database development and server administration

Other details or mentions

No response

What PowerShell host was used when producing this error

Windows PowerShell (powershell.exe)

PowerShell Host Version

PS G:\PS\DB Restores DBA Tools> $PSVersionTable

Name Value


PSVersion 5.1.17763.5696
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.17763.5696
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

SQL Server Edition and Build number

Microsoft SQL Server 2022 (RTM-CU12-GDR) (KB5036343) - 16.0.4120.1 (X64) Mar 18 2024 12:02:14 Copyright (C) 2022 Microsoft Corporation Developer Edition (64-bit) on Windows Server 2019 Datacenter 10.0 (Build 17763: ) (Hypervisor)

.NET Framework Version

PS G:\PS\DB Restores DBA Tools> Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP' -Recurse | Get-ItemProperty -Name version -EA 0 | Where PSChildName -Match '^(?!S)\p{L}' | Select PSChildName, version

PSChildName Version


v2.0.50727 2.0.50727.4927 v3.0 3.0.30729.4926 Windows Communication Foundation 3.0.4506.4926 Windows Presentation Foundation 3.0.6920.4902 v3.5 3.5.30729.4926 Client 4.8.03761
Full 4.8.03761
Client 4.0.0.0

niphlod commented 1 month ago

What’s your “$src” ?

From: Venkat20241985 @.> Sent: Wednesday, May 15, 2024 11:11 To: dataplat/dbatools @.> Cc: Subscribed @.***> Subject: [dataplat/dbatools] [Get-DbaDbBackupHistory] Failure | The value's length for key 'Data Source' exceeds its limit of '128'. (Issue #9351)

Verified issue does not already exist?

No, I did not search

What error did you receive?

WARNING: [03:57:55][Get-DbaDbBackupHistory] Failure | The value's length for key 'Data Source' exceeds its limit of '128'. PS>TerminatingError(): "System error."

DBATools version 2.1.14

Steps to Reproduce

provide your command(s) executed pertaining to dbatools

please include variable values (redacted or fake if needed) for reference

$FullSync    = $null
$FullSync    = @()
$minusdays   = 14;
$minus14days = (Get-Date).Adddays(-($minusdays))
     $FullSync    += Get-DbaDbBackupHistory -SqlInstance $src -Database $SouceDatabase -Last -IncludeCopyOnly -Since  $minus14days

Please confirm that you are running the most recent version of dbatools

PS G:\PS\DB Restores DBA Tools> Get-InstalledModule dbatools

Version Name Repository Description


2.1.14 dbatools PSGallery The community module that enables SQL Server Pros to automate database development and server administration

Other details or mentions

No response

What PowerShell host was used when producing this error

Windows PowerShell (powershell.exe)

PowerShell Host Version

PS G:\PS\DB Restores DBA Tools> $PSVersionTable

Name Value


PSVersion 5.1.17763.5696 PSEdition Desktop PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...} BuildVersion 10.0.17763.5696 CLRVersion 4.0.30319.42000 WSManStackVersion 3.0 PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1

SQL Server Edition and Build number

Microsoft SQL Server 2022 (RTM-CU12-GDR) (KB5036343) - 16.0.4120.1 (X64) Mar 18 2024 12:02:14 Copyright (C) 2022 Microsoft Corporation Developer Edition (64-bit) on Windows Server 2019 Datacenter 10.0 (Build 17763: ) (Hypervisor)

.NET Framework Version

PS G:\PS\DB Restores DBA Tools> Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP' -Recurse | Get-ItemProperty -Name version -EA 0 | Where PSChildName -Match '^(?!S)\p{L}' | Select PSChildName, version

PSChildName Version


v2.0.50727 2.0.50727.4927 v3.0 3.0.30729.4926 Windows Communication Foundation 3.0.4506.4926 Windows Presentation Foundation 3.0.6920.4902 v3.5 3.5.30729.4926 Client 4.8.03761 Full 4.8.03761 Client 4.0.0.0

— Reply to this email directly, view it on GitHub https://github.com/dataplat/dbatools/issues/9351 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AAA52B5UQIUPBXDD2OWDXM3ZCMRAVAVCNFSM6AAAAABHXXQWSOVHI2DSMVQWIX3LMV43ASLTON2WKOZSGI4TOMZQGE3DSMY . You are receiving this because you are subscribed to this thread. https://github.com/notifications/beacon/AAA52B5HVU2EYKSXWOE7GULZCMRAVA5CNFSM6AAAAABHXXQWSOWGG33NNVSW45C7OR4XAZNFJFZXG5LFVJRW63LNMVXHIX3JMTHIR3QKXU.gif Message ID: @. @.> >

Venkat20241985 commented 1 month ago

$src is source sql server which is same version as specified above

niphlod commented 1 month ago

Did you try using a simple string rather than a variable ? “data source” is the place in the connection string where the hostname lives.

From: Venkat20241985 @.> Sent: Wednesday, May 15, 2024 17:52 To: dataplat/dbatools @.> Cc: Simone Bizzotto @.>; Comment @.> Subject: Re: [dataplat/dbatools] [Get-DbaDbBackupHistory] Failure | The value's length for key 'Data Source' exceeds its limit of '128'. (Issue #9351)

$src is source sql server which is same version as specified above

— Reply to this email directly, view it on GitHub https://github.com/dataplat/dbatools/issues/9351#issuecomment-2112911379 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AAA52BZT4VUXIMEPQEJULJLZCOADJAVCNFSM6AAAAABHXXQWSOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMJSHEYTCMZXHE . You are receiving this because you commented. https://github.com/notifications/beacon/AAA52B6FXYPWZWHN32NS7DLZCOADJA5CNFSM6AAAAABHXXQWSOWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTT56B4BG.gif Message ID: @. @.> >

wsmelton commented 1 month ago

Please provide an example value of your $src variable, will allow us to test and verify if there's a bug or not.

Venkat20241985 commented 3 weeks ago

Any update on this? We have experiencing same issue with SQL server 2022 fresh installation and new VM, installed latest DBATools too however still getting same error, possibly is it with ODBC version? How it connect to SQL which diver it uses?

RogerNelson66 commented 1 week ago

I have the same Error. Turns out when i'm issuing new-dbaconnectionstring -sqlinstance $MySqlServer i get a connectionstring that is over 200 characters long. Is there a way to shorten it? My Connectionstring on SQL Server 2022 is Data Source=XXXXXXXXXXXXX;Initial Catalog=XXXXX;Integrated Security=True;MultipleActiveResultSets=False;Connect Timeout=15;TrustServerCertificate=True;Packet Size=4096;Application Name="dbatools PowerShell module - dbatools.io"

RogerNelson66 commented 1 week ago

Workaround is to put

right after import-module dbatools

RogerNelson66 commented 1 week ago

Today it failed again :-(

RogerNelson66 commented 1 week ago

I think i finally solved it! Get rid of the old SQLPS (remove.module sqlps) and install-module sqlserver Now its working