Skip to content

Copy-DbaDatabase more errors after #10389 #10512

Description

@virtualdreams

Verified issue does not already exist?

I have searched and found no existing issue

What error did you receive?

Now that the errors from the Copy-Database ( see #10389 ) command should actually be fixed, new errors are popping up that are even stranger. I think your AI messed something up.

Steps to Reproduce

I tried to copy three databases (CopyTest, CopyTest2 and CopyTest3), which resulted in the output shown below. Databases that were not selected at all are being affected here, especially on the destination server.

$source_instance = "server12"
$target_instance = "server11"
$SharedPath = "\\server.example.com\mssqlbackup\Migrations"

Get-DbaDatabase -SqlInstance $source_instance |
	Out-GridView -Title "Select databases to copy" |
	Copy-DbaDatabase -Source $source_instance -Destination $target_instance -BackupRestore -SharedPath $SharedPath -WithReplace -NumberFiles 1

In the GridView, only the three databases CopyTest, CopyTest2, and CopyTest3 are selected.

WARNING: [10:57:00][Set-DbaDbOwner] AdventureWorksDW2022 on server11\TEST is not in an updateable state and can not be altered. It will be skipped.
WARNING: [10:57:00][Set-DbaDbOwner] AdventureWorks2022 on server11\TEST is not in an updateable state and can not be altered. It will be skipped.
WARNING: [10:57:00][Set-DbaDbOwner] TEST_CONTAINED_msdb on server11\TEST is not in an updateable state and can not be altered. It will be skipped.
WARNING: [10:57:00][Set-DbaDbOwner] Database1 on server11\TEST is not in an updateable state and can not be altered. It will be skipped.
WARNING: [10:57:00][Set-DbaDbOwner] Database [Database2] is not accessible. Skipping.
WARNING: [10:57:00][Set-DbaDbOwner] Database3 on server11\TEST is not in an updateable state and can not be altered. It will be skipped.
WARNING: [10:57:00][Set-DbaDbOwner] Database [Database4] is not accessible. Skipping.
WARNING: [10:57:00][Set-DbaDbOwner] Database5 on server11\TEST is not in an updateable state and can not be altered. It will be skipped.
WARNING: [10:57:00][Set-DbaDbOwner] Database6 on server11\TEST is not in an updateable state and can not be altered. It will be skipped.
WARNING: [10:57:01][Set-DbaDbOwner] TEST_CONTAINED_master on server11\TEST is not in an updateable state and can not be altered. It will be skipped.
WARNING: [10:57:01][Copy-DbaDatabase] Failed to update DatabaseOwnershipChaining for False on  on server11\TEST.
WARNING: [10:57:01][Copy-DbaDatabase] Failed to update Trustworthy to False for  on server11\TEST.
WARNING: [10:57:01][Copy-DbaDatabase] Failed to update BrokerEnabled to False for  on server11\TEST.

WARNING: [10:57:03][Copy-DbaDatabase] Failure attempting to restore CopyTest2 to server11\TEST | Microsoft.Data.SqlClient.SqlError: Das Sicherungsmedium "\\server.example.com\mssqlbackup\Migrations\CopyTest2_202608041057.bak" kann nicht geöffnet werden. Betriebssystemfehler 2(Das System kann die angegebene Datei nicht finden.).
Type     Name      Status     Notes
----     ----      ------     -----
Database CopyTest  Successful Failed to apply the following properties: Ownership chaining, Trustworthy, Message broker, Read only
Database CopyTest2 Failed     Microsoft.Data.SqlClient.SqlError: Das Sicherungsmedium "\\server.example.com\mssqlbackup\Migrations\CopyTest2_202608041057.…

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

2.8.3

Other details or mentions

No response

What PowerShell host was used when producing this error

PowerShell Core (pwsh.exe)

PowerShell Host Version

Name Value


PSVersion 7.6.3
PSEdition Core
GitCommitId 7.6.3
OS Microsoft Windows 10.0.20348
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.4
SerializationVersion 1.1.0.1
WSManStackVersion 3.0

SQL Server Edition and Build number

Microsoft SQL Server 2022 (RTM-CU24-GDR) (KB5083252) - 16.0.4250.1 (X64) Mar 13 2026 00:15:17 Copyright (C) 2022 Microsoft Corporation Enterprise Edition: Core-based Licensing (64-bit) on Windows Server 2022 Standard 10.0 (Build 20348: )

.NET Framework Version

PSChildName Version


Client 4.8.04161
Full 4.8.04161
Client 4.0.0.0

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugs lifetriage requiredNew issue that has not been reviewed by maintainers

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions