在服务器之间移动 Azure Synapse DB

问题描述

我在 azure 的同一订阅下有 2 个 sql 服务器,它们都有一个 azure 突触数据库。我想将一个突触数据库移动/复制到另一台服务器。我在网上找不到任何文档来做这件事,我发现的所有东西都是指正常的 sql 数据库,而复制 Tsql 或该方法似乎不起作用。谁能给我推荐一篇解释我如何做到这一点的文章,或者解释我如何在 azure 中做到这一点?

亲切的问候

格林

解决方法

执行此操作的最简单方法是通过还原点,类似于您在 SQL Server 中使用备份文件执行此操作的方式。您可以在门户中或通过 Powershell create a restore point

config(
[
    'database.connections.tenant' => 
    [
        'driver'    => 'mysql','host'      => 'localhost','port'      => 3306,'database'  => 'the_database_name','username'  => env('DB_USERNAME'),'password'  => env('DB_PASSWORD'),'charset'   => 'utf8mb4','collation' => 'utf8mb4_unicode_ci',],]);

$data = DB::connection('tenant')->select('Your sql');

创建点后,可以再次使用门户网站或通过 Powershell 脚本restore it to a different server。他们不需要在同一个资源组中才能工作。

$SubscriptionName="<YourSubscriptionName>"
$ResourceGroupName="<YourResourceGroupName>"
$ServerName="<YourServerNameWithoutURLSuffixSeeNote>"  # Without database.windows.net
$DatabaseName="<YourDatabaseName>"
$Label = "<YourRestorePointLabel>"

Connect-AzAccount
Get-AzSubscription
Select-AzSubscription -SubscriptionName $SubscriptionName

# Create a restore point of the original database
New-AzSqlDatabaseRestorePoint -ResourceGroupName $ResourceGroupName -ServerName $ServerName -DatabaseName $DatabaseName -RestorePointLabel $Label

这不包括服务器防火墙设置之类的内容,因此如果您希望这些设置匹配,则必须单独移动它。服务器是 Azure SQL,因此迁移 Azure SQL 防火墙的指南也应适用于 Synapse 专用池。

如果表的数量很少,那么 Pipelines 中的复制活动可能是一个不错的备份选项,但由于每个表需要一个活动,因此为大型数据库设置它比使用还原点要复杂得多。