Module 4

1)     Migrate AdventureWorks database from SQL Server instance to Azure SQL using DMA.
2)     Update WebApp connection strings to use Azure SQL.
Links:
· How to create Database project;
· https://www.youtube.com/watch?v=K1BJ43GAPQk
https://docs.microsoft.com/en-us/azure/devops-project/azure-devops-project-sql-database

 

1. 在本地PC安装 SQL Server 2017 Developer 或 Express 版

2. 在本地PC下载和安装 数据迁移助手 Overview of Data Migration Assistant 

3. 在本地PC下载和安装 Download SQL Server Management Studio (SSMS)

4. 按照 AdventureWorks Installation and configuration 中的 "Install to SQL Server",通过“恢复备份”的方式在本地 SQL Server 安装数据库 AdventureWorks。

5. 通过在 SSMS 等处执行 “select @@Version” 可以查看 SQL Server 的具体版本。在SQL Server中怎么查看版本号?

6. 怎样解决问题 A network-related or instance-specific error occurred while establishing a connection to SQL Server

Open "SQL Server Configuration Manager"

Now Click on "SQL Server Network Configuration" and Click on "Protocols for Name"

Right Click on "TCP/IP" (make sure it is Enabled) Click on Properties

Now Select "IP Addresses" Tab -and- Go to the last entry "IP All"

Enter "TCP Port" 1433.

Now Restart "SQL Server .Name." using "services.msc" (winKey + r)
View Code

7. SQL Server的起步  Getting Started with SQL Server

8. 参照 Move Local SQL Server Database to SQL Azure or Move SQL Azure Database to Local SQL Server,可以完成任务1)。

9. 通过 Data Migration Assistant,一样可以完成任务1)。

A)

 

B)

 

C)

 

D)

 

E)

F)

10. 其实我们公司的 Tutor 已经提供 https://github.com/epam-lab/adventure-forks/tree/initial ,需要把解决方案下的项目 AdventureWorks.Web 里的 Web.config 里的  connectionStrings 进行修改。

  <connectionStrings>
    <add name="AdventureWorks" connectionString="Data Source=chenjo0503.database.windows.net;Initial Catalog=AdventureWorks;Integrated Security=False;User ID=dbadmin;Password=**********;" providerName="System.Data.SqlClient" />
    <add name="Entities" connectionString="metadata=res://*/;provider=System.Data.SqlClient;provider connection string=&quot;data source=chenjo0503.database.windows.net;initial catalog=AdventureWorks;integrated security=False;User ID=dbadmin;Password=**********;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
  </connectionStrings>

特别需要注意的是,需要把 integrated security 设置为 False,否则会遇到“SqlException: Windows logins are not supported in this version of SQL Server”。

原文地址:https://www.cnblogs.com/chenjo/p/10815493.html