介绍 (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:

需要以下软件:

  1. SSMS 17.2 and SQL Server installed. 已安装SSMS 17.2和SQL Server。
  2. 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” specify General 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 to Connect and select Azure 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 select Tasks>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 the New container button:

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

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 select Tasks>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验证创建。

翻译自: https://www.sqlshack.com/connect-azure-storage-account-sql-server-management-studio-ssms/

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

  1. ssms2008 代码自动提示_使用 SSMS 的提示和技巧 - SQL Server Management Studio (SSMS) | Microsoft Docs...

    使用 SQL Server Management Studio (SSMS) 的提示和技巧Tips and tricks for using SQL Server Management Studio ...

  2. SQL Server Management Studio (SSMS)

    SQL Server Management Studio (SSMS) 官网: https://docs.microsoft.com/zh-cn/sql/ssms/sql-server-managem ...

  3. 下载 SQL Server Management Studio (SSMS)

    SSMS 是一种集成环境,用于管理从 SQL Server 到 SQL 数据库的任何 SQL 基础结构. SSMS 提供用于配置.监视和管理 SQL 实例的工具. 使用 SSMS 部署.监视和升级应用 ...

  4. SQL Server Management Studio (SSMS)单独安装,仅安装连接工具

    简单来说,SSMS是用于远程连接数据库与执行管理任务的一个工具.当安装SQL SERVER时,会默认安装.但也可以单独安装在不是数据库服务器的主机上. SQL Server Management St ...

  5. 使用 SQL Server Management Studio (SSMS) 连接 SQL Server实例

    参考资料 微软官方教程https://docs.microsoft.com/zh-cn/sql/ssms/tutorials/connect-query-sql-server?view=sql-ser ...

  6. [Microsoft SQL Server Management Studio]SSMS查询年龄最大学生的姓名和年龄问题及查询最高的学生的学号问题分析及解决

    查询年龄最大学生的姓名和年龄问题 问题描述 使用以下语句查询年龄最大学生的姓名和年龄的时候系统报错,为什么?要如何修改? SELECT StName, MAX(YEAR(GETDATE())-YEAR ...

  7. Microsoft SQL Server Management Studio(SSMS)概述

    介绍 (Introduction) Microsoft SQL Server Server Management is an advanced development environment that ...

  8. 在SQL Server Management Studio(SSMS)中调试存储过程

    Debugging is one of the most important but painful parts of any software process. To find some error ...

  9. SQL Server Management Studio中SQL代码段

    Snippets are a great productivity feature to speed up typing of repetitive T-SQL. Snippets were intr ...

最新文章

  1. 传递函数极点与微分方程的解
  2. Spring Cloud构建微服务架构—服务消费Ribbon
  3. 《游戏设计师修炼之道:数据驱动的游戏设计》一3.8小结
  4. 计算机程序编辑器中文版,小说编辑器(Atomic Scribbler)
  5. 用户 'NT AUTHORITY\NETWORK SERVICE' 登录失败问题
  6. 生物医学基础--讲不明白12导联算我输
  7. 数组c语言什么时候学的,C语言学习之数组
  8. 统计学习方法(—)——统计学习方法概念
  9. 场景切换时清理缓存!!CCTextureCache、CCSpriteFrameCache、CCAnimationCache
  10. python爬取股票平均成本怎么算_用Python做股市数据分析(二)
  11. 谷歌VAD静音检测py-webrtcvad使用详解
  12. cad和html5哪个好,最好用的5个CAD软件 你用的是哪款呢
  13. OSChina 周日乱弹 —— 我们今天不上班!
  14. PHP数据跨行跨列处理
  15. 《青浦区加快发展跨境电子商务实施细则(审议稿)》
  16. [爬虫]字节跳动招聘爬取实战-csrf校验
  17. Python利用经纬度创建shpfile点图层并生成tif-问题
  18. MyEclipse更换主题皮肤
  19. 转载一篇知乎上的文章:抖音是如何毁掉我们的?(深度好文)
  20. ADuM磁隔离芯片与6N137光耦隔离比较

热门文章

  1. 是的,又一次立FLAG了
  2. MongDB之shard_主从,副本集,分片的理解
  3. css3导航渐变 滑过显示动画
  4. 动态生成的DOM不会触发onclick事件的原因及解决方法
  5. spring实战三装配bean之Bean的作用域以及初始化和销毁Bean
  6. 修改看板视图默认显示个数
  7. 【Android Developers Training】 20. 创建一个Fragment
  8. LINUX 循环fork()
  9. [导入]将asp.net usercontrol(用户控件页)转变为普通控件
  10. 解决Vue的history模式刷新页面出现404的问题