Files
azuredatastudio/extensions/sql-migration/notebooks/SQL_Assessment_Notebook.ipynb
Aasim Khan b2eb0e6958 Adding notebooks to migration extension (#14189)
* Adding migration notebooks to extension

* Adding toast notification instead of printing error in the console

* removed localization info from the links in the notebook

* Removed localization info from the links 2

* Fixed comments, placeholder and letter cases.
2021-02-09 08:07:30 -08:00

153 lines
6.7 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{
"metadata": {
"kernelspec": {
"name": "powershell",
"display_name": "PowerShell",
"language": "powershell"
},
"language_info": {
"name": "powershell",
"codemirror_mode": "shell",
"mimetype": "text/x-sh",
"file_extension": ".ps1"
}
},
"nbformat_minor": 2,
"nbformat": 4,
"cells": [
{
"cell_type": "markdown",
"source": [
"# Perform a SQL Server migration assessment\n",
"\n",
"To perform a SQL Server migration assessment:\n",
"\n",
"0. Download the SqlAssessment utility\n",
"1. Set up notebook environment\n",
"2. Run the assessment action to get the recommended target platform\n",
"3. Run the data collection action\n",
"4. Run the SKU recommendation action to get the right Azure SQL Database/Managed Instance SKU based on the collected performance data"
],
"metadata": {
"azdata_cell_guid": "8ae742ab-7de7-457c-8b8b-28b342d6c854"
}
},
{
"cell_type": "markdown",
"source": [
"**1) Set up notebook environment**"
],
"metadata": {
"azdata_cell_guid": "6f04d64d-9fa2-4be4-9121-831ad764e5b9"
}
},
{
"cell_type": "code",
"source": [
"# The working folder where you downloaded the SqlAssessment utility\r\n",
"$workingDirectory = \"<folder containing SqlAssessment utility>\"\r\n",
"$fileName = \"SqlAssessment.exe\"\r\n",
"\r\n",
"# SQL Server connection string.\r\n",
"$connectionStrings =\"Data Source=.;Initial Catalog=master;Integrated Security=True\"\r\n",
"\r\n",
"# By default, collect the performance data every 30 seconds and saving into the file every 20 iterations.\r\n",
"$perfQueryIntervalInSec = 30\r\n",
"$numberOfIterations = 20"
],
"metadata": {
"azdata_cell_guid": "b2eec551-678e-4644-885f-319aa461833e",
"tags": [
"parameters"
]
},
"outputs": [],
"execution_count": null
},
{
"cell_type": "markdown",
"source": [
"**2) Run the assessment action to get the recommended target platform**"
],
"metadata": {
"azdata_cell_guid": "df3790c7-0677-427c-a82d-98e2404cd075"
}
},
{
"cell_type": "code",
"source": [
"$args = \"Assess --sqlConnectionStrings `\"$connectionStrings`\"\"\r\n",
"Start-Process -Wait -FilePath $fileName -ArgumentList $args -WorkingDirectory $workingDirectory\r\n",
"$json = Get-Content $workingDirectory\\SqlAssessmentReport.json | ConvertFrom-Json \r\n",
"\r\n",
"# Show high level target platform recommendations, for more detail please look at SqlAssessmentReport.json in the output folder\r\n",
"$json.Servers.TargetReadinesses.AzureSqlDatabase | Select-Object -Property AppliesToMigrationTargetPlatform, DatabasesListReadyForMigration, RecommendationStatus\r\n",
"$json.Servers.TargetReadinesses.AzureSqlManagedInstance | Select-Object -Property AppliesToMigrationTargetPlatform, DatabasesListReadyForMigration, RecommendationStatus"
],
"metadata": {
"azdata_cell_guid": "b2e2733a-a3cc-430d-8f88-170ace82f4b4",
"tags": []
},
"outputs": [],
"execution_count": null
},
{
"cell_type": "markdown",
"source": [
"**3) Run the data collection action**\n",
"\n",
"     You can end the collection process by pressing the Enter key or by closing the collection process. \n",
"\n",
"     Keep the process running for longer durations, preferably during both peak and off-peak hours, to improve recommendation accuracy."
],
"metadata": {
"azdata_cell_guid": "bc76c698-c2f2-4aff-a388-f3a9c81ef99a"
}
},
{
"cell_type": "code",
"source": [
"$args = \"PerfDataCollection --outputFolder $outputFolder --sqlConnectionStrings `\"$connectionStrings`\" --perfQueryIntervalInSec $perfQueryIntervalInSec --numberOfIterations $numberOfIterations\"\r\n",
"Start-Process -FilePath $fileName -ArgumentList $args -WorkingDirectory $workingDirectory"
],
"metadata": {
"azdata_cell_guid": "51466298-63af-4eee-8fca-b862b5ce2920",
"tags": []
},
"outputs": [],
"execution_count": null
},
{
"cell_type": "markdown",
"source": [
"**4) Run the SKU recommendation action to get the right Azure SQL Database/Managed Instance SKU based on the collected performance data**"
],
"metadata": {
"azdata_cell_guid": "3b6ad488-8eea-4434-bcb9-f6b37da3136a"
}
},
{
"cell_type": "code",
"source": [
"# Select your desired target platform here\r\n",
"$targetPlatform = \"AzureSqlDatabase\"\r\n",
"# $targetPlatform = \"AzureSqlManagedInstance\"\r\n",
"# $targetPlatform = \"AzureSqlVirtualMachine\"\r\n",
"\r\n",
"$args= \"GetSkuRecommendation --targetPlatform $targetPlatform --perfQueryIntervalInSec $perfQueryIntervalInSec\"\r\n",
"\r\n",
"Start-Process -Wait -FilePath $fileName -ArgumentList $args -WorkingDirectory $workingDirectory \r\n",
"\r\n",
"# Show high level target SKU recommendations, for more detail + reasoning please look at SkuRecommendationReport.json in the output folder\r\n",
"$json = Get-Content $workingDirectory\\SkuRecommendationReport.json | ConvertFrom-Json \r\n",
"$json | Select-Object -ExpandProperty RecommendedSku -Property SqlInstanceName, DatabaseName "
],
"metadata": {
"azdata_cell_guid": "e208e132-c3e2-4975-bc4c-c3810f2b74c5",
"tags": []
},
"outputs": [],
"execution_count": null
}
]
}