300字范文,内容丰富有趣,生活中的好帮手!
300字范文 > 如何使用SQL Server Management Studio(SSMS)连接到Azure存储帐户

如何使用SQL Server Management Studio(SSMS)连接到Azure存储帐户

时间:2022-06-29 12:30:09

相关推荐

如何使用SQL Server Management Studio(SSMS)连接到Azure存储帐户

介绍 (Introduction)

In SQL Server Management Studio (SSMS), it is possible to connect to the Azure Storage. The Azure Storage Account is useful because it creates replicas automatically in the cloud. You only need to upload your file to the Azure Storage Account and the replication is automatic. You can have multiple replications in different regions and Datacenters with few clicks.

在SQL Server Management Studio(SSMS)中,可以连接到Azure存储。 Azure存储帐户很有用,因为它会在云中自动创建副本。 您只需要将文件上传到Azure存储帐户,复制就会自动进行。 只需单击几下,您就可以在不同的区域和数据中心进行多个复制。

That is why it is a common practice to Back up your local database to Azure.

这就是为什么将本地数据库备份到Azure是一种常见的做法。

In this article, we will show how to connect to Azure using SSMS and then we will store a backup file of a SQL Server database on-premises to the Azure Storage Account.

在本文中,我们将展示如何使用SSMS连接到Azure,然后将本地SQL Server数据库的备份文件存储到Azure存储帐户。

Finally, we will restore a database using the backup created.

最后,我们将使用创建的备份来还原数据库。

要求 (Requirements)

The following software is required:

需要以下软件:

SSMS 17.2 and SQL Server installed. 已安装SSMS 17.2和SQL Server。 An Azure Account Azure帐户

入门 (Getting started)

We will first create an Azure Account and containers and then we will back up a local database in the Azure container and finally, we will restore the database.

我们将首先创建一个Azure帐户和容器,然后将备份Azure容器中的本地数据库,最后,我们将还原数据库。

创建一个Azure帐户和容器 (Create an Azure Account and containers)

We will create an Azure Account first and then we will connect to it. To create an Azure Storage Account, go to the Azure Portal.

我们将首先创建一个Azure帐户,然后将其连接。 若要创建一个Azure存储帐户,请转到Azure门户。

In the Azure Portal, press the + icon and write storage account. Select the Storage Account -blob file -Table -Queue:

在Azure门户中,按+图标并写入存储帐户。 选择存储帐户-blob文件-表-队列:

You will receive access to links with an introduction and documentation. Press the create button:

您将获得对带有简介和文档的链接的访问。 按下创建按钮:

Specify a name. The system has validators. For example, the Storage name does not support numbers or uppercase letters:

指定一个名称。 系统具有验证器。 例如,存储名称不支持数字或大写字母:

Specify a name for the storage account. In the deployment model, use the default one (Resource manager). “Classic” is the older option. In “Account kind” specifyGeneral purpose. For some reason, blob storage is not supported in SSMS. In performance, we will use “Standard” because it is just a demo. In replication, the cheapest option is locally redundant storage. This option is used to replicate the information 3 times in the same region.

指定存储帐户的名称。 在部署模型中,使用默认模型(资源管理器)。 “经典”是较旧的选项。 在“帐户类型”中指定通用。 由于某些原因,SSMS不支持Blob存储。 在性能方面,我们将使用“标准”,因为它只是一个演示。 在复制中,最便宜的选择是本地冗余存储。 此选项用于在同一区域中将信息复制3次。

The Subscription is important if you have multiple subscriptions. You can use an existing group or create a new one. This is important if you want to administer multiple resources in groups. You can also select your location. Press the create button:

如果您有多个订阅,则订阅很重要。 您可以使用现有的组,也可以创建一个新的组。 如果要成组管理多个资源,这很重要。 您也可以选择您的位置。 按下创建按钮:

At the right top of the Azure Portal, there is a bell icon. It will inform the user if the storage creation is in progress and/or if it was created successfully. The Notifications can be used for any Azure resource:

在Azure门户的右上方,有一个响铃图标。 它将通知用户是否正在进行存储创建和/或创建成功。 通知可用于任何Azure资源:

When the creation is completed, a green message is displayed:

创建完成后,将显示绿色消息:

To check your Azure Account, go to more services and write storage to find Storage accounts. Click on Storage accounts:

若要检查您的Azure帐户,请转到更多服务并写入存储以查找存储帐户。 点击存储帐户:

Click on the storage account just created:

单击刚刚创建的存储帐户:

In the Azure Account, go to overview, click on Blobs:

在Azure帐户中,转到概述,单击Blob:

Click on the + Container to create containers:

单击+容器创建容器:

Create a container named backups or any name of your preference. The container is like a folder. We will store the backups here:

创建一个名为backups或您的首选项的名称的容器。 容器就像一个文件夹。 我们将备份存储在这里:

Repeat the steps and create a new container named logs:

重复这些步骤并创建一个名为logs的新容器:

In the Azure Account, in Access keys you will have two keys. Key1 and key2. You can use any of the keys to connect to your Azure Storage Account using SSMS:

在Azure帐户的“访问”键中,您将有两个键。 密钥1和密钥2。 您可以使用任何键通过SSMS连接到Azure存储帐户:

使用SSMS连接到Azure存储帐户 (Connect to Azure Storage Account using SSMS)

In previous steps, we created an Azure Storage Account with 2 containers. Now, we will connect to the Storage Account using SSMS.

在之前的步骤中,我们创建了具有2个容器的Azure存储帐户。 现在,我们将使用SSMS连接到存储帐户。

In the SSMS, go toConnectand selectAzure Storage:

在SSMS中,转到“连接”,然后选择“Azure存储”:

Specify the Azure Storage Account name created in the Azure Portal and the Account key. The account key can be the key1 or key2 that we saw in the Azure Portal in the Access Keys section:

指定在Azure门户中创建的Azure存储帐户名称和帐户密钥。 帐户密钥可以是我们在Azure门户的“访问密钥”部分中看到的key1或key2:

A common error is that the Authentication failed for account xxx and the provider key.

常见错误是帐户xxx和提供者密钥的身份验证失败。

If your problem is not the key, the problem can be the account kind. It must be general purpose. For some reason, it may fail with the Blob Storage option:

如果您的问题不是关键,那么问题可能出在帐户类型上。 它必须是通用的。 由于某些原因,使用Blob存储选项可能会失败:

If everything is OK, you will be able to connect to your Azure Account:

如果一切正常,您将能够连接到您的Azure帐户:

In SSMS 17.2, you cannot create new containers. However, you can delete and refresh your containers. This may change in future versions. You also do not have access to other Storage Account services like Queues, Tables and file storage.

在SSMS 17.2中,不能创建新容器。 但是,您可以删除和刷新容器。 在将来的版本中可能会有所变化。 您也无权访问其他存储帐户服务,例如队列,表和文件存储。

在Azure帐户中创建备份 (Create a backup in the Azure Account)

We will create a backup of a database on-premises into the Azure Account. Right click on your database and selectTasks>Back Up

我们将在本地将数据库的备份创建到Azure帐户中。 右键单击数据库,然后选择“任务”>“备份”

In the General page, select Back Up to URL. This option will let you store your backup in the Azure Storage Account. Press the Add button:

在“常规”页面中,选择“备份到URL”。 通过此选项,您可以将备份存储在Azure存储帐户中。 按添加按钮:

We will create a new container. Press theNew containerbutton:

我们将创建一个新的容器。 按“新建容器”按钮:

You will need to Sign in to Azure. Press the Signing In button and specify your Azure credentials:

您将需要登录到Azure。 按登录按钮并指定您的Azure凭据:

Once connected, you will be able to see your subscription. If you have multiple subscription, select the one used to create the Storage Account. Select the Azure Storage Account created in the portal and the container backups and press OK:

连接后,您将能够看到您的订阅。 如果您有多个订阅,请选择一个用于创建存储帐户的订阅。 选择在门户中创建的Azure存储帐户和容器备份,然后按OK:

You will be able to see the URL destination. Press OK to start the back up:

您将能够看到URL目标。 按确定开始备份:

If everything is OK, a successful message will be displayed:

如果一切正常,将显示一条成功消息:

You can verify in the Azure Storage Account that the backup was successfully created in Azure:

您可以在Azure存储帐户中验证已在Azure中成功创建备份:

使用Azure存储帐户中存储的备份在SQL Server内部部署中还原数据库 (Restore a database in SQL Server on-premises using a backup stored in an Azure Storage Account)

Restoring a local database from the Azure Storage is a straightforward process in SSMS 17.2.

从Azure存储还原本地数据库是SSMS 17.2中一个简单的过程。

To restore, right click the database that you want to restore and selectTasks>Restore>Database:

要还原,请右键单击要还原的数据库,然后选择“任务”>“还原”>“数据库”:

The backups created are already detected. You only need to select the backup that you want to use and press OK. The database will be restored using the Azure Backup:

已经检测到创建的备份。 您只需要选择要使用的备份,然后按OK。 将使用Azure备份还原数据库:

结论 (Conclusion)

As you can see, now it is easier to interact with the Azure Storage Account and verify your files. Today, we may have SQL Server on-premises, but we also want to store some information in the Cloud. In this example, we show how to back up our database on-premises to Azure and how to verify the creation using SSMS.

如您所见,现在可以更轻松地与Azure存储帐户进行交互并验证文件。 今天,我们可能已经在内部部署了SQL Server,但我们也想在云中存储一些信息。 在此示例中,我们展示了如何将我们的数据库本地备份到Azure以及如何使用SSMS验证创建。

翻译自: /connect-azure-storage-account-sql-server-management-studio-ssms/

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。