0

我正在使用 将日志传送应用到数据库Invoke-DbaDbLogShipping,并且我正在遵循文档中的示例。创建了作业,并且从显示的内容在辅助服务器实例上恢复了数据库,但作业失败了。这是备份作业日志的状态:

备份事务日志。主数据库:“Test14”日志备份文件:“C:\Users...\Documents\DB Log Shipping\Backups\Local\Test14\Test14_20210822193000.trn”错误:无法记录历史记录/错误消息。(Microsoft.SqlServer. Management.LogShipping)错误:无法将参数值从 SqlGuid 转换为字符串。(System.Data)错误:对象必须实现 IConvertible。(mscorlib)第一次尝试将数据库“Test14”备份到文件“C:\Users.. .\Documents\DB Log Shipping\Backups\Local\Test14\Test14_20210822193000.trn' 失败,因为无法打开备份设备'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
4

1 回答 1

0

我解决了这个问题!

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

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

于 2021-08-23T00:59:15.277 回答