dataplat / dbatools

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

-StandbyDirectory parm not restoring DB in Standby mode #8499

Closed skreebydba closed 2 years ago

skreebydba commented 2 years ago

Verified issue does not already exist?

I have searched and found no existing issue

What error did you receive?

No error encountered. Command not behaving as expected.

Steps to Reproduce

# provide your command(s) executed pertaining to dbatools
# please include variable values (redacted or fake if needed) for reference
$files = Get-ChildItem C:\temp\ftp;
$params = @{
SqlInstance = 'localhost'
DestinationFilePrefix = 'FTP'
DatabaseName ='WWI_FTP'
NoRecovery = $true
WithReplace = $true
Continue = $true
StandbyDirectory = 'C:\temp\ftp\standby'
}

$files | Restore-DbaDatabase @params ;

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

1.1.81

Other details or mentions

According to the documentation, including parm -StandbyDirectory should restore the database in standby mode. I've generated the scripts and the STANDBY = stanbydirectory parm is not being added.

What PowerShell host was used when producing this error

Windows PowerShell ISE (powershell_ise.exe)

PowerShell Host Version

Name Value


PSVersion 5.1.19041.1682
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.19041.1682
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-CU16-GDR) (KB5014353) - 15.0.4236.7 (X64) May 29 2022 15:55:47 Copyright (C) 2019 Microsoft Corporation Developer Edition (64-bit) on Windows 10 Pro 10.0 (Build 19044: ) (Hypervisor)

.NET Framework Version

.NET Framework 4.8.4510.0

ALZDBA commented 2 years ago

Remove the "norecovery=true" parameter in your splatting variable and standby can kick in !

With TSQL Backup, keywords standby and norecovery are mutually exclusive, so cannot be used together !

You probably started from "Example: 10" to build your test script. This example currently contains this error: ">> NoRecovery = $true". The value must be $false !

skreebydba commented 2 years ago

I did start from that example and removing the norecovery parm worked. I get blinded by the power of DBATools! :) Thanks much for the reply.