创建事务日志时无法将参数值从 SqlGuid 转换为字符串。(System.Data)

Failed to convert parameter value from a SqlGuid to a String.(System.Data) when creating transaction log

我正在使用 Invoke-DbaDbLogShipping 将日志传送应用到数据库,我正在按照 documentation 中的示例进行操作。作业已创建,数据库已从其显示的状态恢复到辅助服务器实例上,但作业失败了。这是备份作业日志的内容:

Backing up transaction log. Primary Database: 'Test14' Log Backup File: 'C:\Users...\Documents\DB Log Shipping\Backups\Local\Test14\Test14_20210822193000.trn' Error: Could not log history/error message.(Microsoft.SqlServer.Management.LogShipping) Error: Failed to convert parameter value from a SqlGuid to a String.(System.Data) Error: Object must implement IConvertible.(mscorlib) First attempt to backup database 'Test14' to file 'C:\Users...\Documents\DB Log Shipping\Backups\Local\Test14\Test14_20210822193000.trn' failed because Cannot open backup device 'C:\Users...\Documents\DB Log Shipping\Backups\Local\Test14\Test14_20210822193000.trn

为什么会失败?

这是我的脚本:

$params = @{
    SourceSqlInstance = $PrimaryServerInstance
    DestinationSqlInstance = $SecondaryServerInstance
    Database = $DatabaseName
    GenerateFullBackup = $true
    BackupNetworkPath = $SharedPath
    BackupLocalPath = $LocalPath
    CompressBackup = $true
    Standby = $true
    BackupScheduleFrequencyType = 'daily' 
    BackupScheduleFrequencyInterval = 1
    CopyScheduleFrequencyType = 'daily'
    CopyScheduleFrequencyInterval = 1
    RestoreScheduleFrequencyType = 'daily'
    RestoreScheduleFrequencyInterval = 1
    CopyDestinationFolder = $TransactionLogsCopyPath
    Force = $true #Ignore some errors in the parameters and assume defaults. It will also remove the any present schedules with the same name for the specific job.
}

Invoke-DbaDbLogShipping @params

我解决了这个问题!

C:\Users\...\Documents\DB Log Shipping\Backups\Local 时没有创建 Test14 目录。我手动创建了文件夹Test18,现在备份成功了。

但是,这太疯狂了,因为 Invoke-DbaDbLogShipping 应该在我执行命令时自动创建 Test18 文件夹 .显然它只在 $SharedPath$TransactionLogsCopyPath 下创建文件夹,但 NOT $LocalPath。 出于自动化目的,我最终只是将本地路径设置为 $SharedPath