Azure SQL 数据库克隆问题
我正在尝试在同一 Azure SQL 服务器上克隆 Azure SQL 数据库,但存在一些问题。我不知道是什么引起了问题。
$SubscriptionId = "**********"
$SourceResourceGroupName = "rg"
$SourceServerName = "sql"
$SourceDatabaseName = "sql_test"
$TargetResourceGroupName = "rg"
$TargetServerName = "sql"
$TargetDatabaseName = "sql_dev"
$UserName = "*****"
$Password = ConvertTo-SecureString –String "**********" –AsPlainText -Force
$Timestamp = Get-Date -Format "yyyy-MM-dd-hh-mm"
$DatabaseToBackup = $SourceDatabaseName
$StorageUri = "**********"
$BackupDestination = $StorageUri + $DatabaseToBackup + "_" + $Timestamp + ".bacpac"
$StorageAccountName = "**********"
Set-AzContext -Subscription $SubscriptionId
$StorageKey = "**************"
Write-Host $BackupDestination
$export=New-AzSqlDatabaseExport `
-ResourceGroupName $SourceResourceGroupName `
-ServerName $SourceServerName `
-DatabaseName $DatabaseToBackup `
-UseNetworkIsolation $true `
-SqlServerResourceIdForPrivateLink "********" `
-AuthenticationType AdPassword `
-AdministratorLogin $Username `
-AdministratorLoginPassword $Password `
-StorageKeyType StorageAccessKey `
-StorageUri $BackupDestination `
-StorageKey $StorageKey `
-StorageAccountResourceIdForPrivateLink "*******"
$exportstatus = Get-AzSqlDatabaseImportExportStatus -OperationStatusLink $export.OperationStatusLink
while ($exportstatus.Status -eq "InProgress") {
Get-AzSqlDatabaseImportExportStatus -OperationStatusLink $export.OperationStatusLink
$exportstatus = Get-AzSqlDatabaseImportExportStatus -OperationStatusLink $export.OperationStatusLink
Start-Sleep -Seconds 15
}
这是我第一次看到这种错误
错误代码:
New-AzSqlDatabaseExport : An unexpected error occured while processing the request. Tracking ID: '************'
At line:25 char:9
+ $export=New-AzSqlDatabaseExport `
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [New-AzSqlDatabaseExport], CloudException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Sql.ImportExport.Cmdlet.NewAzureSqlDatabaseExport
Get-AzSqlDatabaseImportExportStatus : Cannot bind argument to parameter 'OperationStatusLink' because it is null.
At line:40 char:74
+ ... seImportExportStatus -OperationStatusLink $export.OperationStatusLink
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-AzSqlDatabaseImportExportStatus], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.Azure.Commands.Sql.ImportExport.Cmdlet.GetAzureSqlDatabaseImportExportStatus
任何想法我必须改变什么。我几天来一直在努力解决这个问题,很难找到问题的答案。没有想法了:)
I'm trying to clone Azure SQL database on same Azure SQL server but there is some problems. I don't have any clue what is causing problem.
$SubscriptionId = "**********"
$SourceResourceGroupName = "rg"
$SourceServerName = "sql"
$SourceDatabaseName = "sql_test"
$TargetResourceGroupName = "rg"
$TargetServerName = "sql"
$TargetDatabaseName = "sql_dev"
$UserName = "*****"
$Password = ConvertTo-SecureString –String "**********" –AsPlainText -Force
$Timestamp = Get-Date -Format "yyyy-MM-dd-hh-mm"
$DatabaseToBackup = $SourceDatabaseName
$StorageUri = "**********"
$BackupDestination = $StorageUri + $DatabaseToBackup + "_" + $Timestamp + ".bacpac"
$StorageAccountName = "**********"
Set-AzContext -Subscription $SubscriptionId
$StorageKey = "**************"
Write-Host $BackupDestination
$export=New-AzSqlDatabaseExport `
-ResourceGroupName $SourceResourceGroupName `
-ServerName $SourceServerName `
-DatabaseName $DatabaseToBackup `
-UseNetworkIsolation $true `
-SqlServerResourceIdForPrivateLink "********" `
-AuthenticationType AdPassword `
-AdministratorLogin $Username `
-AdministratorLoginPassword $Password `
-StorageKeyType StorageAccessKey `
-StorageUri $BackupDestination `
-StorageKey $StorageKey `
-StorageAccountResourceIdForPrivateLink "*******"
$exportstatus = Get-AzSqlDatabaseImportExportStatus -OperationStatusLink $export.OperationStatusLink
while ($exportstatus.Status -eq "InProgress") {
Get-AzSqlDatabaseImportExportStatus -OperationStatusLink $export.OperationStatusLink
$exportstatus = Get-AzSqlDatabaseImportExportStatus -OperationStatusLink $export.OperationStatusLink
Start-Sleep -Seconds 15
}
This is first time when I'm seeing this kind error
Error code:
New-AzSqlDatabaseExport : An unexpected error occured while processing the request. Tracking ID: '************'
At line:25 char:9
+ $export=New-AzSqlDatabaseExport `
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [New-AzSqlDatabaseExport], CloudException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Sql.ImportExport.Cmdlet.NewAzureSqlDatabaseExport
Get-AzSqlDatabaseImportExportStatus : Cannot bind argument to parameter 'OperationStatusLink' because it is null.
At line:40 char:74
+ ... seImportExportStatus -OperationStatusLink $export.OperationStatusLink
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-AzSqlDatabaseImportExportStatus], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.Azure.Commands.Sql.ImportExport.Cmdlet.GetAzureSqlDatabaseImportExportStatus
Any ideas what I have to change. I have struggled with this problem now couple days and it is very hard to find answers to problem. Running out of ideas :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以通过增加目标数据库的大小来解决此问题。
您可以使用以下命令来增加目标数据库的大小。
You can resolve this issue by increasing the size of Target Database.
You can increase the size of your Target Database using below command.