Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add-DbaAgDatabase - Conversion error #5742

Closed
brunobbc opened this issue Jun 13, 2019 · 2 comments
Closed

Add-DbaAgDatabase - Conversion error #5742

brunobbc opened this issue Jun 13, 2019 · 2 comments

Comments

@brunobbc
Copy link

Environmental information

SQL Server:

sql Microsoft SQL Server 2016 (SP2) (KB4052908) - 13.0.5026.0 (X64) Mar 18 2018 09:11:49 Copyright (c) Microsoft Corporation Developer Edition (64-bit) on Windows Server 2016 Standard 10.0 (Build 14393: ) (Hypervisor)
/* REPLACE WITH output of @@Version */


### Report

<!--
Things to consider:
- Conversions errors when try to run ADD-DbaAGDatabase
--> 

#### Errors Received

<!-- 
WARNING: [17:44:39][Add-DbaAgDatabase] Failure | Cannot convert the "[SVR2]" value of type
"Microsoft.SqlServer.Management.Smo.Server" to type "Microsoft.SqlServer.Management.Smo.Server".
Fin du script : 2019-06-13 5:44:39 PM

-->

#### Steps to Reproduce

<!--
$InstanceName = $env:computername
$AvailabilityGroup = Get-DbaAvailabilityGroup -SqlInstance $InstanceName | select -ExpandProperty Name
$PrimaryServer = "SVR1"
$SecondaryServer = "SVR2"
$Database = "Test"
$SharedPath = "\\" + $PrimaryServer + "\E$\MSSQL\Backup"

$DatabaseBackupFile = $SharedPath + "\" + $Database + ".bak"
$LogBackupFile = $SharedPath + "\" + $Database + ".trn"

Backup-SqlDatabase -Database $Database -BackupFile $DatabaseBackupFile -ServerInstance $PrimaryServer -Verbose
Backup-SqlDatabase -Database $Database -BackupFile $LogBackupFile -ServerInstance $PrimaryServer -BackupAction Log -Verbose

Restore-SqlDatabase -Database $Database -BackupFile $DatabaseBackupFile -ServerInstance $SecondaryServer -NoRecovery -Verbose 
Restore-SqlDatabase -Database $Database -BackupFile $LogBackupFile -ServerInstance $SecondaryServer -RestoreAction Log -NoRecovery -Verbose

Add-DbaAgDatabase -AvailabilityGroup $AvailabilityGroup -Database $Database -Secondary $SecondaryServer -SharedPath $SharedPath -SqlInstance $PrimaryServer -UseLastBackup
-->

#### Expected Behavior

<!--
I expect to have a DB syncronized and added to the secondary.
-->

#### Actual Behavior

<!--
Primary Server = DB is in sycronized State and availability Database is created (Correct !!)
Secondary = DB is in restoring state and availability Database is created  with error. 
-->
@potatoqualitee
Copy link
Member

thanks for the report. unfortunately, it was not completed properly, specifically i dont know what version of dbatools you are using. please ensure you are on the latest version because some things have been fixed recently. Please list what version you are using by using code included in the bug report template.

@potatoqualitee
Copy link
Member

The fix is included in #5753 which will be released with dbatools 1.0 on Thursday morning 💯

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants