Azure SQL 数据库克隆问题

发布于 2025-01-17 11:32:18 字数 2722 浏览 0 评论 0原文

我正在尝试在同一 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

剩余の解释 2025-01-24 11:32:18

您可以通过增加目标数据库的大小来解决此问题。

您可以使用以下命令来增加目标数据库的大小。

-DatabaseMaxSizeBytes “DB_Size_in_bytes”

You can resolve this issue by increasing the size of Target Database.

You can increase the size of your Target Database using below command.

-DatabaseMaxSizeBytes “DB_Size_in_bytes”
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文