28
Migrating your SQL Server database to SQL Azure Database CLOUD

Migrating your SQL Server database tomycrm.intcomex.com/sugarcrm/images/XUS/Intocomexcloud/... · 2019. 10. 15. · Moving your SQL Server database to Azure SQL Database is as simple

  • Upload
    others

  • View
    40

  • Download
    1

Embed Size (px)

Citation preview

Page 1: Migrating your SQL Server database tomycrm.intcomex.com/sugarcrm/images/XUS/Intocomexcloud/... · 2019. 10. 15. · Moving your SQL Server database to Azure SQL Database is as simple

Migrating your SQL Server database to SQL Azure Database

CLOUD

Page 2: Migrating your SQL Server database tomycrm.intcomex.com/sugarcrm/images/XUS/Intocomexcloud/... · 2019. 10. 15. · Moving your SQL Server database to Azure SQL Database is as simple

In this tutorial, you will learn how to:

Create an empty Azure SQL Database instance in the Azure Portal (through a new or pre-existing SQL Azure

Database server)

Create a server-level firewall in Azure Portal (if you have not previously created one)

Use Data Migration Assistant (DMA) to import the SQL Server database in the empty SQL Azure Database

instance.

Use SQL Server Management Studio (SSMS) to change the database properties.

Moving your SQL Server database to Azure SQL Database is as simple as creating an empty SQL database in Azure and, afterwards, using Database base Migration Assistant (DMA) to import the database in Azure.

If you do not already have an Azure subscription, please create a free account before you begin.

Page 3: Migrating your SQL Server database tomycrm.intcomex.com/sugarcrm/images/XUS/Intocomexcloud/... · 2019. 10. 15. · Moving your SQL Server database to Azure SQL Database is as simple

Previousrequirements

You have installed the most recent version of SQL Server Management Studio (SSMS).

You have installed the Data Migration Assistant (DMA) has been installed.

You have identified and gained access to a database to migrate. This tutorial uses the OLTP AdventureWorks SQL Server 2008R2 database in an SQL Server 2008R2 instance or newer versions, but can be used as referen-ce for any database of your choice. To fix compatibility problems, use SQL Server Data Tools.

To complete this tutorial, make sure you meet these prerequisites:

Page 4: Migrating your SQL Server database tomycrm.intcomex.com/sugarcrm/images/XUS/Intocomexcloud/... · 2019. 10. 15. · Moving your SQL Server database to Azure SQL Database is as simple

Create a blank instance in SQL Database

Create an SQL Azure Database instance using a defined set of process and storage resources. The database is created within a group of Azure resources and on a logical Azure SQL Database server.

Follow these steps to create a blank SQL Database.

1. Click “Resource Creation” in the left upper corner of the Azure Portal

2. Select “Databases” in the new page, and select “Create in SQL Database” in the new page.

Page 5: Migrating your SQL Server database tomycrm.intcomex.com/sugarcrm/images/XUS/Intocomexcloud/... · 2019. 10. 15. · Moving your SQL Server database to Azure SQL Database is as simple

Fill in the SQL Database form with the following information, as shown in the above image:

Configuration

Name of the database

mySampleDatabase To learn about valid database names, please consult Database Identifiers.

Suggested Value Description

Subscription Your Subscription For more information about your subscription, please refer to Subscriptions.

Resourcegroups

myResourceGroup To learn more about valid group resource names, please refer to the Naming Conventions article.

Selectorigin

Blank database Specifies that you must create a blankdatabase.

Page 6: Migrating your SQL Server database tomycrm.intcomex.com/sugarcrm/images/XUS/Intocomexcloud/... · 2019. 10. 15. · Moving your SQL Server database to Azure SQL Database is as simple

Click on “Server” to create and configure a new server for the new database. Fill in again the new server form with the following information

Set up

Server name Any globally unique name

To learn more about valid group resource names, please refer to the Naming Conventions article.

Suggested Value DESCRIPTION

The serveradministrator login

Any valid name To learn about valid login names, please con-sult Database Identifiers.

Password Any valid password The password must have a minimum of eight characters and must contain characters from three of the following categories: uppercase characters, lowercase characters, numbers and non-alphanumeric characters.

Location Any valid location For more information about regions, please refer to Azure Regions.

Page 7: Migrating your SQL Server database tomycrm.intcomex.com/sugarcrm/images/XUS/Intocomexcloud/... · 2019. 10. 15. · Moving your SQL Server database to Azure SQL Database is as simple

5. Click the “Select” button

6. Click on “Rate Plan” to specify the level of service, the DTU number and the amount of storage. Explore the storage amounts and DTU options that are available to you for each level of service.

Page 8: Migrating your SQL Server database tomycrm.intcomex.com/sugarcrm/images/XUS/Intocomexcloud/... · 2019. 10. 15. · Moving your SQL Server database to Azure SQL Database is as simple

7. For this tutorial, select the Standard level of service, and then use the slider to select 100 DTU (S3) and 400 GB of storage

Page 9: Migrating your SQL Server database tomycrm.intcomex.com/sugarcrm/images/XUS/Intocomexcloud/... · 2019. 10. 15. · Moving your SQL Server database to Azure SQL Database is as simple

Agree to the preliminary terms accessory storage option.

Important

* Storage sizes greater than the included storage amount can be found in your previous version, and can generate additional costs.To learn more about this, please refer to the SQL Database prices

* At the Premium level, over 1 TB of storage is currently available in the following regions: East of Australia, Southeast of Australia, South of Brazil, Canada Center, East of Canada, USA, France Center, Center of Germany, this center of Japan, West of Japan, Korea Center, Central and Northern U.S., Europe North, Center and South of USA, Southeast Asian, southern United Kingdom, West of United Kingdom, East of U.S. 2, West of the U.S., Virginia Gob. USA. And Western Europe. Please refer to current limitations P11-P15.

Page 10: Migrating your SQL Server database tomycrm.intcomex.com/sugarcrm/images/XUS/Intocomexcloud/... · 2019. 10. 15. · Moving your SQL Server database to Azure SQL Database is as simple

9. After selecting the server level, DTU number and storage amount, click “Apply”

10. You select a collation for the blank database (for purposes of this tutorial, use the default value)For more information about collation, please refer to Collations.

11. Once the SQL Database form is filled, click on “Create” to deploy the database. Provisioning can take several minutes.

12. On the toolbar, click on “Notifications” to monitor the implementation process.

Page 11: Migrating your SQL Server database tomycrm.intcomex.com/sugarcrm/images/XUS/Intocomexcloud/... · 2019. 10. 15. · Moving your SQL Server database to Azure SQL Database is as simple

The SQL Database service creates a firewall at the server level, which prevents external tools and applications from connecting to the server or the server’s databases, unless you create a firewall rule that would allow access to specific IPs. Follow these steps to create a SQL Database server level firewall rule for your client’s IP address, and enable external connectivity through said firewall only to your IP address.

1. Once deployment is completed, click on “SQL Databases” in the left-hand menu and then click on “mySampleDatabase” in the SQL databases page. The database’s general information will be displayed, showing the full server name (for example, mynewserver-20170824.database.windows.net) and provides options for other configurations.

Create a firewall rule at the server level

Note

SQL Database communicates over port 1433. If you try to connect from within a corporate network, it is possible that the network’s firewall will not permit the outbound traffic through port 1433. In that case, you cannot connect to the SQL Azure Database Server, unless the IT department opens port 1433

Page 12: Migrating your SQL Server database tomycrm.intcomex.com/sugarcrm/images/XUS/Intocomexcloud/... · 2019. 10. 15. · Moving your SQL Server database to Azure SQL Database is as simple

2. Copy this name to connect to quickly connect to your server and your databases in the future.

3. Click on “Server Firewall Setup” on the toolbar. The SQL Database server firewall configuration page will open.

Page 13: Migrating your SQL Server database tomycrm.intcomex.com/sugarcrm/images/XUS/Intocomexcloud/... · 2019. 10. 15. · Moving your SQL Server database to Azure SQL Database is as simple

4. Click on “Add client IP” on the toolbar to add the current IP address to the new firewall rule. The firewall rule can open port 1433 for a single IP address or a range of IP addresses.

5. Click on “Save”. A server-level firewall rule will be created, opening port 1433 of the cu-rrent OP address in the logical server.

6. Click OK and then close the firewall settings page.

You can now connect to the SQL Database Server and your databases using SQL Server Management Studio, Data Migration Assistant or any other tool you choose from this IP address using the server administrator account created in the previous procedure.

Important

By default, access through SQL Database firewall is disables for all Azure services. Click “OFF” in this page to disable all Azure services.

Page 14: Migrating your SQL Server database tomycrm.intcomex.com/sugarcrm/images/XUS/Intocomexcloud/... · 2019. 10. 15. · Moving your SQL Server database to Azure SQL Database is as simple

Get the full name of the Azure Portal’s Azure SQL Database Server. Use the full name of the server to connect to your Azure SQL server using client tools, including Data Migration Assistance and SQL Server Management Studio

1. Log in to the Azure Portal.

2. Select SQL Database from the menu on the left and click “Database” in the SQL Database page

3. In the “Essentials” dashboard of the database’s Azure Portal page, locate and copy the name of the server.

SQL Server connection information

Page 15: Migrating your SQL Server database tomycrm.intcomex.com/sugarcrm/images/XUS/Intocomexcloud/... · 2019. 10. 15. · Moving your SQL Server database to Azure SQL Database is as simple

Follow these steps to use the Data Migration Assistant to evaluate the database preparation for migration to the SQL Azure Database and complete the migration.

1. Open Data Migration Assistant. You can run DMA on any computer connected to the SQL Server instance that contains the database you wish to migrate, as well as internet access. It is not necessary toperform the installation on the computer that hosts the SQL Server instance that you are migrating. It should be the firewall rule that you created in a previous procedure for the system in which the Data Migration Assistan is running.

Database migration

Page 16: Migrating your SQL Server database tomycrm.intcomex.com/sugarcrm/images/XUS/Intocomexcloud/... · 2019. 10. 15. · Moving your SQL Server database to Azure SQL Database is as simple

2. In the menu of left, click on “+ New” to create an Evaluation project. Complete the requested values, and then click “Create”:

Configuration

Project Type Migration Choose if you want to evaluate the database for migration or choose “evaluate” and perform the migration as part of the same workflow.

Suggested Value Description

Project Name

Migration Tutorial

A descriptive name

Type of origin server

SQL Server This is the only origin currently admitted.

Type of target server

Azure SQL Database

Options include: Azure SQL Database, SQL Server and SQL Server in Azure virtual machines.

Migration scope Outline and data

Options include: Outline and data, outli-ne-only, and data-only.

Page 17: Migrating your SQL Server database tomycrm.intcomex.com/sugarcrm/images/XUS/Intocomexcloud/... · 2019. 10. 15. · Moving your SQL Server database to Azure SQL Database is as simple

3. In the Select origin page, fill the required fields and click on Connect:

Configuration

Server name Server name or IP address.

Server name or IP address.

Suggested value Description

Authentication type

Preferred authentication type.

Options: Windows Authentication, SQL Server authentication, Active Directory integrated Authentication and Active Directory password Authentication.

Username Login name. When logging in, make sure to have the necessary CONTROL SERVER permissions.

Password Password Password

Connection properties

Select Encode Connection and Trusted Server Certificate as appropriate.

Choose the preferred properties of the server connection.

Page 18: Migrating your SQL Server database tomycrm.intcomex.com/sugarcrm/images/XUS/Intocomexcloud/... · 2019. 10. 15. · Moving your SQL Server database to Azure SQL Database is as simple

4. Select a single database in the origin server to migrate to Azure SQL Database, and then click “Next”. For this tutorial, there is only a single database.

5. In the page where you choose where you wish to save your file, fill the required fields and then click Connect:

Configuration

Server name Full name of the Azure Database server.

Full name of the previous proceeding’s Azure Database.

Suggested value Description

Type of authentication

SQL Server authentication

SQL Server Authentication is the only option available at the time of this tutorial’s writing; however, Active Directory’s integrated Authentication and Active Directory’s Password Authentication are also compatible with Azure Database.

Username Login name When logging in, you must have CONTROL DATABASE permissions for the origin database.

Password Password Password

Connection properties

Select Encode Connection and Trusted Server Certificate as appropriate.

Choose the necessary properties for Server Connection.

Page 19: Migrating your SQL Server database tomycrm.intcomex.com/sugarcrm/images/XUS/Intocomexcloud/... · 2019. 10. 15. · Moving your SQL Server database to Azure SQL Database is as simple

6. Select the end server database that was created in the previous proceeding and, afterwards, click “Next” to begin the outline assessment evaluation of the origin databa-se. This tutorial is written using a single database as an example. Make sure that the level of compatibility for this database sets at 140, the default compatibility level for all Azure SQL Database databases.

Important

After migrating the database to the Azure SQL Database, you may choose to start the database with a specified compatibility level for the purpose of maximum compatibility with previous versions. For more information about the implications and options for the use of a database with a specified level of compatibility, consult ALTER DATABASE (Transact-SQL) Compatibility Level. See also ALTER DATABASE SCOPED CONFIGURA-TION to obtain more information about the added level database values related to the compatibility levels.

Page 20: Migrating your SQL Server database tomycrm.intcomex.com/sugarcrm/images/XUS/Intocomexcloud/... · 2019. 10. 15. · Moving your SQL Server database to Azure SQL Database is as simple

7. In the Select Objects page, once the assessment process of the origin database outline has ended, review the files selected for the purposes of migration, as well as the files that present issues. For example, make sure that the dbo.uspSearchCandidateResumes file for the SERVERPROPERTY(‘LCID’) command chan-ges, and that the HumanResourcesJobCandidate for the Whole Text Search changes as well.

Important

Depending on the size of the app and the databa-se, when migrating the origin database, you will have to modify the app, the database or both once the migration is finished (and, on some cases, before the migration starts). To learn more about the differences between Transact-SQL that can affect object migration, please read Transact-SQL Solutions for Compatibility Issues during SQL Data-base migration.

Page 21: Migrating your SQL Server database tomycrm.intcomex.com/sugarcrm/images/XUS/Intocomexcloud/... · 2019. 10. 15. · Moving your SQL Server database to Azure SQL Database is as simple

8. Click on SQL Script Generator to generate the origin database’s objects’ outline script.

9. Review the generated scrip and click Next Problem, if applicable, to review recommendations and identified assess-ment problems. For example, for the Whole Text Search, it is recommended that, when updating, test-run the apps that use Whole Text. You may save or copy the script if you so wish.

Page 22: Migrating your SQL Server database tomycrm.intcomex.com/sugarcrm/images/XUS/Intocomexcloud/... · 2019. 10. 15. · Moving your SQL Server database to Azure SQL Database is as simple

10. Click Deploy Schema and observe the process of outline migration.

Page 23: Migrating your SQL Server database tomycrm.intcomex.com/sugarcrm/images/XUS/Intocomexcloud/... · 2019. 10. 15. · Moving your SQL Server database to Azure SQL Database is as simple

11. Once the outline migration has finalized, review the results in case any errors show; if none are present, click on “Migrate data.”

12. In the Select Tables page, review the selected tables for migration and, afterwards, click Start Data Migration.

Page 24: Migrating your SQL Server database tomycrm.intcomex.com/sugarcrm/images/XUS/Intocomexcloud/... · 2019. 10. 15. · Moving your SQL Server database to Azure SQL Database is as simple

13. Review the migration process.

Page 25: Migrating your SQL Server database tomycrm.intcomex.com/sugarcrm/images/XUS/Intocomexcloud/... · 2019. 10. 15. · Moving your SQL Server database to Azure SQL Database is as simple

Use SQL Server Management Studio to establish a connection with an Azure SQL Database server.

1. Open SQL Server Management Studio.2. In the Connect with Server window, specify the following information:

Connect to the database with SSMS

Configuration

Server type Database search engine

This value is necessary

Suggested value Description

Server name Full server name Said name must follow this format:mynewserver20170824.database.windows.net.

Authentication SQL Server Authentication

SQL Authentication is the only type of authentication that this tutorial covers.

Login Serveradministrator account

The account that was selected when the server was created.

Password The serveradministrator’spassword.

The password that was selected when the server was created.

Page 26: Migrating your SQL Server database tomycrm.intcomex.com/sugarcrm/images/XUS/Intocomexcloud/... · 2019. 10. 15. · Moving your SQL Server database to Azure SQL Database is as simple

3. Click the Options button in the Connect with Server window. In the Connect with Database section, write mySampleDatabase to connect with this database.

4. Click on Connect. The file explorer window will appear in SSMS.

5. In the file explorer, open Database and, afterwards, open mySampleDatabase to see the sample database files.

Page 27: Migrating your SQL Server database tomycrm.intcomex.com/sugarcrm/images/XUS/Intocomexcloud/... · 2019. 10. 15. · Moving your SQL Server database to Azure SQL Database is as simple

Changes to the database properties

You can modify the level of service, performance and

compatibility with SQL Server Management Studio. During the

import phase, it is recommended to import a database of superior

level of performance to improve efficiency, but once the import

has finalized, vertically minimize in order to save money until you

are ready to actively use the imported database. When you

change the compatibility level, you can obtain a better

performance and access the newest Azure SQL Database

functions. When a previous database is migrated, the database

compatibility level will remain in the lowest compatible number

with the database to be imported. To learn more, please refer to

Improved Query Performance with Compatibility Level 130 in

Azure SQL Database.

1. In the fil explorer, right-click on mySampleDatabase and the click on New Query. A search window, connected to the data-base, will appear.

2. Run the following command to stablish the standard service level and the S1 performance level.

SQL

ALTER DATABASE mySampleDatabase MODIFY ( EDITION = 'Standard' , MAXSIZE = 250 GB , SERVICE_OBJECTIVE = 'S1');

Copiar

Page 28: Migrating your SQL Server database tomycrm.intcomex.com/sugarcrm/images/XUS/Intocomexcloud/... · 2019. 10. 15. · Moving your SQL Server database to Azure SQL Database is as simple

CLOUD