快速入門:使用 Azure 入口網站建立和查詢 Azure Synapse Analytics 中的專用 SQL 集區 (先前稱為 SWL DW)Quickstart: Create and query a dedicated SQL pool (formerly SQL DW) in Azure synapse Analytics using the Azure portal

使用 Azure 入口網站快速建立和查詢 Azure Synapse Analytics 中的專用 SQL 集區 (先前稱為 SWL DW)。Quickly create and query a dedicated SQL pool (formerly SQL DW) in Azure Synapse Analytics using the Azure portal.

必要條件Prerequisites

  1. 如果您沒有 Azure 訂用帳戶,請在開始前建立免費帳戶If you don't have an Azure subscription, create a free account before you begin.

    注意

    在 Azure Synapse 中建立專用 SQL 集區 (先前稱為 SQL DW) 可能會產生新的可計費服務。Creating a dedicated SQL pool (formerly SQL DW) in Azure Synapse may result in a new billable service. 如需詳細資訊,請參閱 Azure Synapse Analytics 定價For more information, see Azure Synapse Analytics pricing.

  2. 下載並安裝最新版的 SQL Server Management Studio (SSMS)。Download and install the newest version of SQL Server Management Studio (SSMS). 注意: SSMS 僅適用于以 Windows 為基礎的平臺,請參閱 支援平臺的完整清單Note: SSMS is only available on Windows based platforms, see the full list of supported platforms.

登入 Azure 入口網站Sign in to the Azure portal

登入 Azure 入口網站Sign in to the Azure portal.

建立 SQL 集區Create a SQL pool

使用專用 SQL 集區 (先前稱為 SQL DW),在 Azure Synapse Analytics 中建立資料倉儲 。Data warehouses are created using dedicated SQL pool (formerly SQL DW) in Azure Synapse Analytics. 專用 SQL 集區 (先前稱為 SQL DW) 會使用一組已定義的計算資源來建立。A dedicated SQL pool (formerly SQL DW) is created with a defined set of compute resources. 此資料庫建立於 Azure 資源群組邏輯 SQL 伺服器內。The database is created within an Azure resource group and in a logical SQL server.

請遵循下列步驟來建立包含 AdventureWorksDW 範例資料的專用 SQL 集區 (先前稱為 SQL DW)。Follow these steps to create a dedicated SQL pool (formerly SQL DW) that contains the AdventureWorksDW sample data.

  1. 選取 Azure 入口網站左上角的 [建立資源] 。Select Create a resource in the upper left-hand corner of the Azure portal.

    在 Azure 入口網站中建立資源

  2. 在搜尋列中,輸入「專用 SQL 集區」,選取專用的 SQL 集區 (先前稱為 SQL DW)。In the search bar type "dedicated SQL pool" select dedicated SQL pool (formerly SQL DW). 在開啟的頁面上,選取 [建立]。Select Create on the page that opens.

    建立空的資料倉儲

  3. 基本資料 中,提供您的訂用帳戶、資源群組、專用 SQL 集區 (先前稱為 SQL DW) 名稱和伺服器名稱:In Basics, provide your subscription, resource group, dedicated SQL pool (formerly SQL DW) name, and server name:

    設定Setting 建議的值Suggested value 描述Description
    訂用帳戶Subscription 您的訂用帳戶Your subscription 如需訂用帳戶的詳細資訊,請參閱訂用帳戶For details about your subscriptions, see Subscriptions.
    資源群組Resource group myResourceGroupmyResourceGroup 如需有效的資源群組名稱,請參閱命名規則和限制For valid resource group names, see Naming rules and restrictions.
    SQL 集區名稱SQL pool name 任何全域唯一名稱 (例如 mySampleDataWarehouse)Any globally unique name (An example is mySampleDataWarehouse) 如需有效的資料庫名稱,請參閱資料庫識別碼For valid database names, see Database Identifiers.
    ServerServer 任何全域唯一名稱Any globally unique name 選取現有的伺服器,或建立新的伺服器名稱,然後選取 [新建]。Select existing server, or create a new server name, select Create new. 如需有效的伺服器名稱,請參閱命名規則和限制For valid server names, see Naming rules and restrictions.

    建立資料倉儲的基本詳細資料

  4. 在 [效能等級] 中,選取 [選取效能等級],以選擇性地使用滑桿來變更您的設定。Under Performance level, select Select performance level to optionally change your configuration with a slider.

    變更資料倉儲效能等級

    如需效能等級的詳細資訊,請參閱管理 Azure Synapse Analytics 中的計算能力For more information about performance levels, see Manage compute in Azure Synapse Analytics.

  5. 選取 [其他設定],在 [使用現有資料] 底下選擇 [範例],以將 AdventureWorksDW 建立為範例資料庫。Select Additional Settings, under Use existing data, choose Sample so that AdventureWorksDW will be created as the sample database.

    選取 [使用現有資料]

  6. 現在您已完成 Azure Synapse Analytics 表單的 [基本] 索引標籤,接下來請選取 [檢閱 + 建立],然後選取 [建立] 以建立 SQL 集區。Now that you've completed the Basics tab of the Azure Synapse Analytics form, select Review + Create and then Create to create the SQL pool. 佈建需要幾分鐘的時間。Provisioning takes a few minutes.

    選取 [檢閱 + 建立]

    選取 [建立]

  7. 在工具列上選取 [通知],以監視部署程序。On the toolbar, select Notifications to monitor the deployment process.

    此螢幕擷取畫面顯示部署進行中的通知。

建立伺服器層級防火牆規則Create a server-level firewall rule

Azure Synapse 服務會在伺服器層級建立防火牆。The Azure Synapse service creates a firewall at the server-level. 此防火牆會防止外部應用程式和工具連線到伺服器或伺服器上的任何資料庫。This firewall prevents external applications and tools from connecting to the server or any databases on the server. 若要啟用連線,您可以新增防火牆規則以啟用特定 IP 位址之連線。To enable connectivity, you can add firewall rules that enable connectivity for specific IP addresses. 遵循以下步驟建立用戶端 IP 位址的伺服器層級防火牆規則Follow these steps to create a server-level firewall rule for your client's IP address.

注意

Azure Synapse 會透過連接埠 1433 進行通訊。Azure Synapse communicates over port 1433. 如果您嘗試從公司網路內進行連線,您網路的防火牆可能不允許透過連接埠 1433 的輸出流量。If you are trying to connect from within a corporate network, outbound traffic over port 1433 might not be allowed by your network's firewall. 若是如此,除非 IT 部門開啟連接埠 1433,否則您無法連線到您的伺服器。If so, you cannot connect to your server unless your IT department opens port 1433.

  1. 完成部署之後,請從左側功能表選取 [所有服務]。After the deployment completes, select All services from the left-hand menu. 選取 [資料庫],選取 [Azure Synapse Analytics] 旁的星號,將 Azure Synapse Analytics 新增至您的最愛。Select Databases, select the star next to Azure Synapse Analytics to add Azure Synapse Analytics to your favorites.

  2. 從左側功能表中選取 [Azure Synapse Analytics],然後在 [Azure Synapse Analytics] 頁面上選取 [mySampleDataWarehouse]。Select Azure Synapse Analytics from the left-hand menu and then select mySampleDataWarehouse on the Azure Synapse Analytics page. 資料庫的概觀頁面隨即開啟,其中會顯示完整的伺服器名稱 (例如 sqlpoolservername.database.windows.net),並提供進一步設定的選項。The overview page for your database opens, showing you the fully qualified server name (such as sqlpoolservername.database.windows.net) and provides options for further configuration.

  3. 在這個及其他快速入門中,請複製此完整伺服器名稱,才能用來連線到伺服器及其資料庫。Copy this fully qualified server name for use to connect to your server and its databases in this and other quick starts. 若要開啟伺服器設定,請選取伺服器名稱。To open server settings, select the server name.

    尋找伺服器名稱

  4. 選取 [顯示防火牆設定]。Select Show firewall settings.

    伺服器設定

  5. 伺服器的 [防火牆設定] 頁面會隨即開啟。The Firewall settings page for the server opens.

    伺服器防火牆規則

  6. 若要將目前的 IP 位址新增至新的防火牆規則,請選取工具列上的 [新增用戶端 IP]。To add your current IP address to a new firewall rule, select Add client IP on the toolbar. 防火牆規則可以針對單一 IP 位址或 IP 位址範圍開啟連接埠 1433。A firewall rule can open port 1433 for a single IP address or a range of IP addresses.

  7. 選取 [儲存]。select Save. 系統便會為目前的 IP 位址建立伺服器層級防火牆規則,在伺服器上開啟連接埠 1433。A server-level firewall rule is created for your current IP address opening port 1433 on the server.

  8. 選取 [確定],然後關閉 [防火牆設定] 頁面。select OK and then close the Firewall settings page.

您現在可以使用這個 IP 位址,連線到伺服器及其 SQL 集區。You can now connect to the server and its SQL pools using this IP address. 可從 SQL Server Management Studio 或您選擇的另一個工具來運作連線。The connection works from SQL Server Management Studio or another tool of your choice. 當您連線時,請使用先前建立的 ServerAdmin 帳戶。When you connect, use the ServerAdmin account you created previously.

重要

根據預設,已對所有 Azure 服務啟用透過 SQL Database 防火牆存取。By default, access through the SQL Database firewall is enabled for all Azure services. 在此頁面上選取 [關閉],然後選取 [儲存] 以停用所有 Azure 服務的防火牆。select OFF on this page and then select Save to disable the firewall for all Azure services.

取得完整的伺服器名稱Get the fully qualified server name

請在 Azure 入口網站中取得伺服器的完整伺服器名稱。Get the fully qualified server name for your server in the Azure portal. 稍後您在連線到伺服器時,會使用完整伺服器名稱。Later you use the fully qualified name when connecting to the server.

  1. 登入 Azure 入口網站Sign in to the Azure portal.

  2. 從左側功能表中選取 [Azure Synapse Analytics],然後在 [Azure Synapse Analytics] 頁面上選取您的。Select Azure Synapse Analytics from the left-hand menu, and select your on the Azure Synapse Analytics page.

  3. 在 Azure 入口網站中您資料庫的 [基本資訊] 窗格中,找到後複製 [伺服器名稱]。In the Essentials pane in the Azure portal page for your database, locate and then copy the Server name. 在此範例中,完整名稱是 sqlpoolservername.database.windows.net。In this example, the fully qualified name is sqlpoolservername.database.windows.net.

    連線資訊

以伺服器系統管理員身分連線到伺服器Connect to the server as server admin

本節使用 SQL Server Management Studio (SSMS) 建立與伺服器的連線。This section uses SQL Server Management Studio (SSMS) to establish a connection to your server.

  1. 開啟 SQL Server Management Studio。Open SQL Server Management Studio.

  2. 在 [連線至伺服器] 對話方塊中,輸入下列資訊:In the Connect to Server dialog box, enter the following information:

    設定Setting 建議的值Suggested value 描述Description
    伺服器類型Server type 資料庫引擎Database engine 這是必要值This value is required
    伺服器名稱Server name 完整伺服器名稱The fully qualified server name 範例如下:sqlpoolservername.database.windows.netHere's an example: sqlpoolservername.database.windows.net.
    驗證Authentication SQL Server 驗證SQL Server Authentication SQL 驗證是本教學課程中設定的唯一驗證類型。SQL Authentication is the only authentication type that is configured in this tutorial.
    登入Login 伺服器系統管理員帳戶The server admin account 您在建立伺服器時所指定的帳戶。Account that you specified when you created the server.
    密碼Password 伺服器系統管理員帳戶的密碼The password for your server admin account 這是您在建立伺服器時所指定的密碼。Password that you specified when you created the server.

    連線至伺服器

  3. 選取 [連線]。select Connect. [物件總管] 視窗會在 SSMS 中開啟。The Object Explorer window opens in SSMS.

  4. 在 [物件總管] 中展開 [資料庫]。In Object Explorer, expand Databases. 然後展開 [mySampleDatabase] 可檢視新資料庫中的物件。Then expand mySampleDatabase to view the objects in your new database.

    資料庫物件

執行一些查詢Run some queries

不建議在以伺服器管理員身分登入時執行大型查詢,因為這麼做會使用有限的資源類別It is not recommended to run large queries while being logged as the server admin, as it uses a limited resource class. 請改為設定工作負載隔離,如教學課程所述Instead configure Workload Isolation as illustrated in the tutorials.

Azure Synapse Analytics 使用 T-SQL 作為查詢語言。Azure Synapse Analytics uses T-SQL as the query language. 若要開啟查詢視窗並執行一些 T-SQL 查詢,請使用下列步驟:To open a query window and run some T-SQL queries, use the following steps:

  1. 以滑鼠右鍵選取 [mySampleDataWarehouse],然後選取 [新增查詢]。Right-select mySampleDataWarehouse and select New Query. 隨即開啟 [新增查詢] 視窗。A new query window opens.

  2. 在新的查詢視窗中,輸入下列命令可查看資料庫清單。In the query window, enter the following command to see a list of databases.

    SELECT * FROM sys.databases
    
  3. 選取 [執行]。select Execute. 查詢結果顯示兩個資料庫:mastermySampleDataWarehouseThe query results show two databases: master and mySampleDataWarehouse.

    查詢資料庫

  4. 若要查看一些資料,請使用下列命令以查看姓氏為 Adams 且家裡有三個孩子的客戶數目。To look at some data, use the following command to see the number of customers with last name of Adams that have three children at home. 結果列出 6 個客戶。The results list six customers.

    SELECT LastName, FirstName FROM dbo.dimCustomer
    WHERE LastName = 'Adams' AND NumberChildrenAtHome = 3;
    

    查詢 dbo.dimCustomer

清除資源Clean up resources

您需對資料倉儲單位和專用 SQL 集區 (先前稱為 SQL DW) 中儲存的資料付費。You're being charged for data warehouse units and data stored your dedicated SQL pool (formerly SQL DW). 這些計算和儲存體資源會分開計費。These compute and storage resources are billed separately.

  • 如果您需要將資料保留在儲存體中,可以在您不使用專用 SQL 集區 (先前稱為 SQL DW) 時暫停計算。If you want to keep the data in storage, you can pause compute when you aren't using the dedicated SQL pool (formerly SQL DW). 暫停計算,您只需支付資料儲存體的費用。By pausing compute, you're only charged for data storage. 當您準備要使用資料時,您可以繼續計算。You can resume compute whenever you're ready to work with the data.

  • 如果您想要移除未來的費用,可以將專用 SQL 集區 (先前稱為 SQL DW) 刪除。If you want to remove future charges, you can delete the dedicated SQL pool (formerly SQL DW).

遵循下列步驟,清除不再需要的資源。Follow these steps to clean up resources you no longer need.

  1. 登入 Azure 入口網站,然後選取您的專用 SQL 集區 (先前稱為 SQL DW)。Sign in to the Azure portal, select your dedicated SQL pool (formerly SQL DW).

    清除資源

  2. 若要暫停計算,請選取 [暫停] 按鈕。To pause compute, select the Pause button. 專用 SQL 集區 (先前稱為 SQL DW) 暫停時,您會看到 [繼續] 按鈕。When the dedicated SQL pool (formerly SQL DW) is paused, you see a Resume button. 若要繼續計算,請選取 [繼續]。To resume compute, select Resume.

  3. 若要移除專用 SQL 集區 (先前稱為 SQL DW) 並不再支付計算或儲存體的費用,請選取 [刪除]。To remove the dedicated SQL pool (formerly SQL DW) so you aren't charged for compute or storage, select Delete.

  4. 若要移除所建立的伺服器,請選取上圖中的 [sqlpoolservername.database.windows.net],然後選取 [刪除]。To remove the server you created, select sqlpoolservername.database.windows.net in the previous image, and then select Delete. 請謹慎使用刪除,因為刪除伺服器也會刪除所有指派給伺服器的資料庫。Be careful with this deletion, since deleting the server also deletes all databases assigned to the server.

  5. 若要移除此資源群組,請選取 [myResourceGroup],然後選取 [刪除資源群組]。To remove the resource group, select myResourceGroup, and then select Delete resource group.

想要最佳化並節省您的雲端費用嗎?Want to optimize and save on your cloud spending?

Azure 服務成本費用。Azure services cost money. Azure 成本管理可協助您設定預算和設定警示以控制費用。Azure Cost Management helps you set budgets and configure alerts to keep spending under control. 使用成本管理來分析、管理和最佳化您的 Azure 成本。Analyze, manage, and optimize your Azure costs with Cost Management. 若要深入了解,請參閱分析成本的快速入門To learn more, see the quickstart on analyzing your costs.

後續步驟Next steps

若要深入了解如何將資料載入到專用 SQL 集區 (先前稱為 SQL DW),請繼續將資料載入專用 SQL 集區一文。To learn more about loading data into your dedicated SQL pool (formerly SQL DW), continue to the Load data into a dedicated SQL pool article.