Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Commit 89dfae7

Browse files
authored
Merge pull request #23182 from dzsquared/dac-overview
updating dac article
2 parents 1222599 + 2cae188 commit 89dfae7

9 files changed

Lines changed: 350 additions & 200 deletions

File tree

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
title: Deploy SQL Server in a container via Notebook
3+
description: This tutorial shows how you can deploy SQL Server in a container.
4+
author: dzsquared
5+
ms.author: drskwier
6+
ms.reviewer: markingmyname
7+
ms.topic: tutorial
8+
ms.prod: azure-data-studio
9+
ms.technology: azure-data-studio
10+
ms.custom:
11+
- intro-deployment
12+
ms.date: 7/22/2022
13+
---
14+
15+
# Deploy SQL Server in a container using Azure Data Studio
16+
17+
You can deploy SQL Server in a container using Azure Data Studio through the deployment wizard and notebooks.
18+
19+
## Pre-requisites
20+
21+
- [Azure Data Studio](download-azure-data-studio.md) is installed
22+
- Docker Engine 1.8+ on any supported Linux distribution or Docker for Mac/Windows. For more information, see [Install Docker](https://docs.docker.com/engine/installation/)
23+
24+
## Use the deployment wizard
25+
26+
Follow these steps to use the deployment wizard, which will guide you through the required settings in a simple UI experience.
27+
28+
First, find and select Azure SQL Database in the deployment wizard.
29+
30+
1. In Azure Data Studio, select the Connections viewlet on the left-side navigation.
31+
2. Select the **...** button at the top of the Connections panel and choose **New Deployment...**
32+
3. In the deployment wizard, select the **SQL Server container image** tile and select **Select** to move to the next screen.
33+
4. In the Version dropdown, select which image of SQL Server you would like to deploy. The wizard will check whether you have a running instance of Docker at this time. Select **Select** to move to the next screen.
34+
5. Enter the container name, a password for the *sa* account of suitable complexity (at least eight characters long and contain characters from three of the following four sets: uppercase letters, lowercase letters, base-10 digits, and symbols), and the port in the host environment which the container will map to.
35+
6. Review the parameters you have entered and then select **Open Notebook**.
36+
37+
Once the Notebook opens, you can review the content and the code and make changes if you like. However, be aware that any changes you make to the Notebook could potentially cause validation errors.
38+
39+
The last step is to select **Run all** to run all cells in the Notebook. Once this completes you should have a fully created and running SQL Database that you can connect to and query from ADS.
40+
41+
## Next steps
42+
43+
After you've created your database, server, or pool, you can [connect and query](quickstart-sql-database.md) your database in Azure Data Studio.
44+
45+
For more information on deploying SQL Server in containers, see [Quickstart: Run SQL Server Linux container images with Docker](../linux/quickstart-install-connect-docker.md).

docs/azure-data-studio/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,8 @@
166166
href: deploy-azure-sql-edge.md
167167
- name: Deploy SQL Server on Azure Virtual Machines
168168
href: deploy-azure-sql-server-vm.md
169+
- name: Deploy SQL Server in a container
170+
href: deploy-sql-container.md
169171
- name: Dashboards & insight widgets
170172
href: insight-widgets.md
171173
- name: Code snippets

docs/relational-databases/data-tier-applications/data-tier-applications.md

Lines changed: 109 additions & 118 deletions
Large diffs are not rendered by default.

docs/relational-databases/data-tier-applications/validate-a-dac-package.md

Lines changed: 90 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
description: "Validate a DAC Package"
33
title: "Validate a DAC Package | Microsoft Docs"
44
ms.custom: ""
5-
ms.date: "03/14/2017"
5+
ms.date: 7/12/2022
66
ms.prod: sql
77
ms.technology:
88
ms.topic: conceptual
@@ -17,48 +17,73 @@ ms.assetid: 726ffcc2-9221-424a-8477-99e3f85f03bd
1717
author: WilliamDAssafMSFT
1818
ms.author: wiassaf
1919
---
20-
# Validate a DAC Package
20+
# Validate a DAC package
2121
[!INCLUDE [SQL Server Azure SQL Database Azure SQL Managed Instance](../../includes/applies-to-version/sql-asdb-asdbmi.md)]
22-
It is a good practice to review the contents of a DAC package before deploying it in production, and to validate the upgrade actions before upgrading an existing DAC. This is especially true when deploying packages that were not developed in your organization.
23-
24-
1. **Before you begin:** [Prerequisites](#Prerequisites)
25-
26-
2. **To upgrade a DAC, using:** [View the Contents of a DAC](#ViewDACContents), [View Database Changes](#ViewDBChanges), [View Upgrade Actions](#ViewUpgradeActions), [Compare DACs](#CompareDACs)
22+
It is a good practice to review the contents of a DAC package before deploying it in production, and to validate the upgrade actions before upgrading an existing DAC. This is especially true when deploying packages that were not developed in your organization.
2723

28-
## <a name="Prerequisites"></a> Prerequisites
29-
We recommend that you do not deploy a DAC package from unknown or untrusted sources. Such DACs could contain malicious code that might execute unintended [!INCLUDE[tsql](../../includes/tsql-md.md)] code or cause errors by modifying the schema. Before you use a DAC from an unknown or untrusted source, deploy it on an isolated test instance of the [!INCLUDE[ssDE](../../includes/ssde-md.md)], run [DBCC CHECKDB &#40;Transact-SQL&#41;](../../t-sql/database-console-commands/dbcc-checkdb-transact-sql.md) on the database, and also examine the code, such as stored procedures or other user-defined code, in the database.
24+
Methods to upgrade a DAC package include:
25+
- [View the Contents of a DAC](#ViewDACContents)
26+
- [View Database Changes](#ViewDBChanges)
27+
- [View Upgrade Actions](#ViewUpgradeActions)
28+
- [Compare DACs](#CompareDACs)
29+
30+
## Untrusted DAC packages
31+
We recommend that you do not deploy a DAC package from unknown or untrusted sources. Such DACs could contain malicious code that might execute unintended [!INCLUDE[tsql](../../includes/tsql-md.md)] code or cause errors by modifying the schema. Before you use a DAC from an unknown or untrusted source, deploy it on an isolated test instance of the [!INCLUDE[ssDE](../../includes/ssde-md.md)], run [DBCC CHECKDB &#40;Transact-SQL&#41;](../../t-sql/database-console-commands/dbcc-checkdb-transact-sql.md) on the database, and also examine the code, such as stored procedures or other user-defined code, in the database.
3032

3133
## <a name="ViewDACContents"></a> View the Contents of a DAC
32-
There are two mechanisms for viewing the contents of a data-tier application (DAC) package. You can import the DAC package to a DAC project in SQL Server Developer Tools. You can unpack the contents of the package to a folder.
33-
34-
**View a DAC in SQL Server Developer Tools**
35-
34+
There are two mechanisms for viewing the contents of a data-tier application (DAC) package:
35+
- import the DAC package to a SQL project in SQL Server Developer Tools
36+
- publish the DAC package to a test instance
37+
38+
### Import a DAC in SQL Server Developer Tools
39+
3640
1. Open the **File** menu, select **New**, and then select **Project...**.
37-
38-
2. Select the **SQL Server** project template, and specify a **Name**, **Location**, and **Solution name**.
39-
40-
3. In **Solution Explorer**, right click the project node and select **Properties...**.
41+
42+
2. Select the **SQL Server** project template, and specify a **Name**, **Location**, and **Solution name**.
43+
44+
3. In **Solution Explorer**, right click the project node and select **Properties...**.
4145

4246
4. On the **Project Settings** tab, in the **Output Types** section, select the **Data-tier Application (.dacpac File)** check box, and then close the properties dialog.
43-
47+
4448
5. In **Solution Explorer**, right click the project node and select **Import Data-tier Application...**.
45-
49+
4650
6. Use **Solution Explorer** to open all of the files in the DAC, such as the server selection policy and the pre- and post-deployment scripts.
47-
51+
4852
7. Use the **Schema View** to review all of the objects in the schema, particularly reviewing the code in objects such as functions or stored procedures.
4953

50-
**View a DAC in a Folder**
51-
52-
- Unpack the DAC package into a folder by following the instructions in [Unpack a DAC Package](../../relational-databases/data-tier-applications/unpack-a-dac-package.md).
53-
54-
- View the contents of the [!INCLUDE[tsql](../../includes/tsql-md.md)] scripts by opening them in the [!INCLUDE[ssDE](../../includes/ssde-md.md)] Query Editor in [!INCLUDE[ssManStudio](../../includes/ssmanstudio-md.md)].
55-
56-
- View the contents of the text files in tools such as notepad.
57-
58-
## <a name="ViewDBChanges"></a> View Database Changes
59-
After the current version of a DAC was deployed to production, changes may have been made directly to the associated database that might conflict with the schema defined in a new version of the DAC. Before upgrading to a new version of the DAC, check to see if such changes have been made to the database.
54+
### Publish the DAC package to a test instance
55+
Multiple tools are available to publish a DAC package to a test instance. The [SQL Server Dacpac extension](../../azure-data-studio/extensions/sql-server-dacpac-extension.md) for Azure Data Studio contains the **Data-tier Application Wizard**. We will walk through publishing a DAC package to a test instance.
56+
57+
1. If needed, deploy a test instance using the [deployment wizard](../../azure-data-studio/deploy-sql-container.md).
58+
59+
2. Connect to your test instance in Azure Data Studio and right-click on the server node. Select **Data-tier application wizard** from the context menu.
60+
61+
3. On step 1 of the wizard, select **Deploy a data-tier application .dacpac file to an instance of SQL Server**
62+
63+
4. One step 2 of the wizard, input the file location and select **New Database** for target database. Enter a database name.
64+
65+
5. On step 3 of the wizard, review the summary before selecting **Deploy**.
66+
67+
6. Once the deployment has completed, review the contents of the database in object explorer.
68+
69+
7. OPTIONAL: Right-click the database in object explorer and select **Create project from database** to generate a SQL project from the database.
6070

61-
**View Database Changes by Using a Wizard**
71+
## <a name="ViewDBChanges"></a> View database changes
72+
After the current version of a DAC was deployed to production, changes may have been made directly to the associated database that might conflict with the schema defined in a new version of the DAC. Before upgrading to a new version of the DAC, check to see if such changes have been made to the database.
73+
Under several scenarios you may want to view the difference between a database and a DAC package. For example, changes may have been made directly to the associated database that might conflict with the schema defined in a new version of the DAC.
74+
75+
### All databases
76+
**View database changes by using schema compare**
77+
- Using the [Schema Compare extension in Azure Data Studio](/sql/azure-data-studio/extensions/schema-compare-extension#compare-schemas), the schema differences between an existing *.dacpac* and a database or two of the same can be viewed on Windows, macOS, and Linux.
78+
79+
- Using [SQL Server Data Tools in Visual Studio](../../ssdt/how-to-use-schema-compare-to-compare-different-database-definitions.md), the schema differences between an existing *.dacpac* and a database or two of the same can be viewed on Windows.
80+
81+
**View database changes by using SqlPackage CLI**
82+
83+
The SqlPackage CLI can be used with the [DeployReport action](../../tools/sqlpackage/sqlpackage-deploy-drift-report.md) to view the differences between a *.dacpac* and a database through the actions that would be taken if the *.dacpac* were published to the database.
84+
85+
### Databases registered as a data-tier application
86+
**View database changes by using a wizard**
6287

6388
1. Run the **Upgrade Data-tier Application** wizard, specifying the currently deployed DAC and the DAC package containing the new version of the DAC.
6489

@@ -68,22 +93,19 @@ ms.author: wiassaf
6893

6994
4. For more information on using the wizard, see [Upgrade a Data-tier Application](../../relational-databases/data-tier-applications/upgrade-a-data-tier-application.md).
7095

71-
**View Database Changes by Using PowerShell**
72-
73-
1. Create a SMO Server object and set it to the instance that contains the DAC to be viewed.
74-
75-
2. Open a **ServerConnection** object and connect to the same instance.
76-
77-
3. Specify the DAC name in a variable.
78-
96+
**View database changes by using PowerShell**
97+
98+
1. Create a SMO Server object and set it to the instance that contains the DAC to be viewed.
99+
100+
2. Open a **ServerConnection** object and connect to the same instance.
101+
102+
3. Specify the DAC name in a variable.
103+
79104
4. Use the **GetDatabaseChanges()** method to retrieve a **ChangeResults** object, and pipe the object to a text file to generate a simple report of new, deleted, and changed objects.
80-
81-
### View Database Changes Example (PowerShell)
82-
**View Database Changes Example (PowerShell)**
83-
84-
The following example reports any database changes that have been made in a deployed DAC named MyApplicaiton.
85-
86-
```
105+
106+
The following example reports any database changes that have been made in a deployed DAC named MyApplication.
107+
108+
```powershell
87109
## Set a SMO Server object to the default instance on the local computer.
88110
CD SQLSERVER:\SQL\localhost\DEFAULT
89111
$srv = get-item .
@@ -99,11 +121,27 @@ $dacName = "MyApplication"
99121
## Generate the change list and save to file.
100122
$dacChanges = $dacstore.GetDatabaseChanges($dacName) | Out-File -Filepath C:\DACScripts\MyApplicationChanges.txt
101123
```
102-
103-
## <a name="ViewUpgradeActions"></a> View Upgrade Actions
124+
125+
**View database changes by using SqlPackage CLI**
126+
127+
The SqlPackage CLI can be used with the [DriftReport action](../../tools/sqlpackage/sqlpackage-deploy-drift-report.md) to view the changes that were made to a database since it was last registered.
128+
129+
## <a name="ViewUpgradeActions"></a> View upgrade actions
130+
131+
### All databases
132+
133+
**View database changes by using SQL project publish**
134+
- Using the [SQL Database Projects extension in Azure Data Studio](/sql/azure-data-studio/extensions/sql-database-project-extension-build), the actions to be taken when a SQL project will be published to a database can be viewed on Windows, macOS, and Linux by selecting "Generate Script" during the publish process.
135+
136+
- Using [SQL Server Data Tools in Visual Studio](/sql/ssdt/how-to-change-target-platform-and-publish-a-database-project#to-publish-a-database-project), the actions to be taken when a SQL project will be published to a database can be viewed on Windows as a deployment script.
137+
138+
**View upgrade actions by using SqlPackage CLI**
139+
The SqlPackage CLI can be used with the [DeployReport action](../../tools/sqlpackage/sqlpackage-deploy-drift-report.md) to view the differences between a *.dacpac* and a database through the actions that would be taken if the *.dacpac* were published to the database.
140+
141+
### Databases registered as a data-tier application
104142
Before using a new version of a DAC package to upgrade a DAC that was deployed from an earlier DAC package, you can generate a report that contains the [!INCLUDE[tsql](../../includes/tsql-md.md)] statements that will be run during the upgrade, and then review the statements.
105143

106-
**Report Upgrade Actions by Using a Wizard**
144+
**Report upgrade actions by using a wizard**
107145

108146
1. Run the **Upgrade Data-tier Application** wizard, specifying the currently deployed DAC and the DAC package containing the new version of the DAC.
109147

@@ -113,7 +151,7 @@ $dacChanges = $dacstore.GetDatabaseChanges($dacName) | Out-File -Filepath C:\DAC
113151

114152
4. For more information on using the wizard, see [Upgrade a Data-tier Application](../../relational-databases/data-tier-applications/upgrade-a-data-tier-application.md).
115153

116-
**Report Upgrade Actions by Using PowerShell**
154+
**Report upgrade actions by using PowerShell**
117155

118156
1. Create a SMO Server object and set it to the instance that contains the deployed DAC.
119157

@@ -126,11 +164,9 @@ $dacChanges = $dacstore.GetDatabaseChanges($dacName) | Out-File -Filepath C:\DAC
126164
5. Use the **GetIncrementalUpgradeScript()** method to get a list of the Transact-SQL statements an upgrade would run, and pipe the list to a text file.
127165

128166
6. Close the file stream used to read the DAC package file.
167+
129168

130-
### View Upgrade Actions Example (PowerShell)
131-
**View Upgrade Actions Example (PowerShell)**
132-
133-
The following example reports the Transact-SQL statements that would be run to upgrading a DAC named MyApplicaiton to the schema defined in a MyApplication2017.dacpac file.
169+
The following example reports the Transact-SQL statements that would be run to upgrading a DAC named MyApplication to the schema defined in a MyApplication2017.dacpac file.
134170

135171
```
136172
## Set a SMO Server object to the default instance on the local computer.

docs/tools/sqlpackage/sqlpackage-export.md

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ ms.assetid: 198198e2-7cf4-4a21-bda4-51b36cb4284b
99
author: "dzsquared"
1010
ms.author: "drskwier"
1111
ms.reviewer: "maghan"
12-
ms.date: 4/18/2022
12+
ms.date: 7/29/2022
1313
---
1414

1515
# SqlPackage Export parameters and properties
@@ -20,7 +20,23 @@ The SqlPackage.exe Export action exports a connected database to a BACPAC file (
2020
**SqlPackage.exe** initiates the actions specified using the parameters, properties, and SQLCMD variables specified on the command line.
2121

2222
```bash
23-
SqlPackage {parameters}{properties}{SQLCMD Variables}
23+
SqlPackage /Action:Export {parameters} {properties}
24+
```
25+
26+
### Examples
27+
28+
```bash
29+
# example export from Azure SQL Database using SQL authentication and a connection string
30+
SqlPackage /Action:Export /TargetFile:"C:\AdventureWorksLT.bacpac" \
31+
/SourceConnectionString:"Server=tcp:{yourserver}.database.windows.net,1433;Initial Catalog=AdventureWorksLT;Persist Security Info=False;User ID=sqladmin;Password={your_password};MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;"
32+
33+
# example export using short form parameter names, skips schema validation
34+
SqlPackage /a:Export /ssn:"{yourserver}.database.windows.net,1433" /sdn:"AdventureWorksLT" /su:"sqladmin" \
35+
/sp:"{your_password}" /tf:"C:\AdventureWorksLT.bacpac" /p:VerifyExtraction=False
36+
37+
# example export using Azure Active Directory Service Principal
38+
SqlPackage /Action:Export /TargetFile:"C:\AdventureWorksLT.bacpac" \
39+
/SourceConnectionString:"Server=tcp:{yourserver}.database.windows.net,1433;Initial Catalog=AdventureWorksLT;Authentication=Active Directory Service Principal;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;"
2440
```
2541

2642
## Parameters for the Export action
@@ -68,4 +84,5 @@ SqlPackage {parameters}{properties}{SQLCMD Variables}
6884

6985
## Next Steps
7086

71-
- Learn more about [SqlPackage](sqlpackage.md)
87+
- Learn more about [SqlPackage](sqlpackage.md)
88+
- [Troubleshooting Import/Export with SqlPackage](./troubleshooting-import-export-sqlpackage.md)

0 commit comments

Comments
 (0)