dbatools icon indicating copy to clipboard operation
dbatools copied to clipboard

Restore-DbaDatabase path string length limitation?

Open JanPaija opened this issue 1 year ago • 2 comments

Verified issue does not already exist?

I have searched and found no existing issue

What error did you receive?

PS U:> Restore-DbaDatabase -SqlInstance srv1 -Path Z:\SQLBKUP\srv1 -MaintenanceSolutionBackup -NoRecovery -Continue -ReuseSourceFolderStructure WARNING: [11:04:37][Read-DbaBackupHeader] File Z:\SQLBKUP\srv2\Search_Service_Application___eDiscovery___xyzd_AnalyticsReportingStoreDB_af41a178d9d74a21834bc2361ed81046\FULL\srv1_Search_Service_Application___ eDiscovery___xyzd_AnalyticsReportingStoreDB_af41a178..._FULL_20241004_041002.bak does not exist or access denied. The SQL Server service account may not have access to the source directory.

Steps to Reproduce

# provide your command(s) executed pertaining to dbatools
# please include variable values (redacted or fake if needed) for reference

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

2024.4.12

Other details or mentions

All other SharePoint databases restored successfully from the backup path, this one got to be 1044 characters in total length. Changed server name in the error msg to srv1, real is longer.

What PowerShell host was used when producing this error

Windows PowerShell (powershell.exe)

PowerShell Host Version

Name Value


PSVersion 5.1.17763.6189
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.17763.6189
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 2019 (RTM-CU28) (KB5039747) - 15.0.4385.2 (X64) Jul 25 2024 21:32:40 Copyright (C) 2019 Microsoft Corporation Enterprise Edition: Core-based Licensing (64-bit) on Windows Server 2019 Datacenter 10.0 <X64> (Build 17763: ) (Hypervisor)

.NET Framework 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.7.03190 Full 4.7.03190 Client 4.0.0.0

JanPaija avatar Oct 04 '24 15:10 JanPaija

@JanPaija what do you get when you run below with the respective server and file path?

$backupinfo = Read-DbaBackupHeader -SqlInstance . -Path C:\temp\myfile.bak
$backupinfo.FileList

Is this a real path, returned by the restore command, or something you shortened for the issue (the ellipsis)? ..._FULL

MikeyBronowski avatar Oct 09 '24 21:10 MikeyBronowski

The path I pasted was shortened with the … in the original output from dbatools/powershell. The only thing I changed was the server names. I got it working when I moved the files to a one character folder on the root, so it was just some string limitation in creating the full path for what was initially 1044 characters for this one database with the SharePoint extra-long added hash name.

Thanks, Jan

From: Mikey Bronowski @.> Sent: Wednesday, October 9, 2024 5:45 PM To: dataplat/dbatools @.> Cc: Jan Paija (SHRSS) @.>; Mention @.> Subject: [External Email] Re: [dataplat/dbatools] Restore-DbaDatabase path string length limitation? (Issue #9489)

@JanPaijahttps://urldefense.com/v3/__https:/github.com/JanPaija__;!!BeC6CIU!LyPz3NEDzHbbuWw8aP_B8VuYKfFSxFNQqy5SKZBlnNrXsnWpTrVg-_qUq1LJwGvTcsdy5IFohmqn9XIuQPMf7Qs$ what do you get when you run below with the respective server and file path?

$backupinfo = Read-DbaBackupHeader -SqlInstance . -Path C:\temp\myfile.bak

$backupinfo.FileList

Is this a real path, returned by the restore command, or something you shortened for the issue (the ellipsis)? ..._FULL

— Reply to this email directly, view it on GitHubhttps://urldefense.com/v3/__https:/github.com/dataplat/dbatools/issues/9489*issuecomment-2403486700__;Iw!!BeC6CIU!LyPz3NEDzHbbuWw8aP_B8VuYKfFSxFNQqy5SKZBlnNrXsnWpTrVg-_qUq1LJwGvTcsdy5IFohmqn9XIuLQZz3dA$, or unsubscribehttps://urldefense.com/v3/__https:/github.com/notifications/unsubscribe-auth/BA4QQW22YKRTFQTH56FZ4VLZ2WPXPAVCNFSM6AAAAABPMDNWLGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMBTGQ4DMNZQGA__;!!BeC6CIU!LyPz3NEDzHbbuWw8aP_B8VuYKfFSxFNQqy5SKZBlnNrXsnWpTrVg-_qUq1LJwGvTcsdy5IFohmqn9XIu0BL7NjA$. You are receiving this because you were mentioned.Message ID: @.***>


CAUTION: EXTERNAL EMAIL Please exercise additional caution when clicking on links, replying to, or opening attachments from this sender.


DISCLAIMER: This e-mail message and any attachments are intended solely for the use of the individual or entity to which it is addressed and may contain information that is confidential or legally privileged. If you are not the intended recipient, you are hereby notified that any dissemination, distribution, copying or other use of this message or its attachments is strictly prohibited. If you have received this message in error, please notify the sender immediately and permanently delete this message and any attachments.

JanPaija avatar Oct 10 '24 17:10 JanPaija

I don't reeeeeeally have time to test, but is this a problem on sqlserver's side or on dbatools' side ? seeing noone else reporting this and this being uncommented since October, I'm gonna close this, but @JanPaija feel free to reopen if needed

niphlod avatar Feb 10 '25 23:02 niphlod