解除封裝 DAC 封裝Unpack a DAC Package

適用於: 是SQL Server 是Azure SQL Database 否Azure Synapse Analytics (SQL DW) 否平行處理資料倉儲 APPLIES TO: yesSQL Server yesAzure SQL Database noAzure Synapse Analytics (SQL DW) noParallel Data Warehouse

使用 [解除封裝資料層應用程式] 對話方塊可從資料層應用程式 (DAC) 封裝解壓縮指令碼和檔案。Use the Unpack Data-tier Application dialog box to unzip the scripts and files from a data-tier application (DAC) package. 這些指令碼和檔案會放置在某個資料夾中,使用此封裝來將 DAC 部署到實際執行系統之前便可以進行檢閱。The scripts and files are placed in a folder where they can be reviewed before the package is used to deploy the DAC into a production system. DAC 的內容也可以與解除封裝到另一個資料夾的另一個封裝內容相比較。The contents of one DAC can also be compared with the contents of another package unpacked to another folder.

  1. 開始之前: 安全性Before you begin: Security

  2. 若要解除封裝 DAC,請使用下列方式: 解除封裝資料層應用程式對話方塊檢查 DAC 套件的內容To unpack a DAC, using: Unpack Data-tier Application Dialog, Examine the Contents of a DAC Package

安全性Security

建議您不要部署來源不明或來源不受信任的 DAC 封裝。We recommend that you do not deploy a DAC package from unknown or untrusted sources. 這類 DAC 可能包含惡意程式碼,因此可能會執行非預期的 Transact-SQLTransact-SQL 程式碼,或是修改結構描述而造成錯誤。Such DACs could contain malicious code that might execute unintended Transact-SQLTransact-SQL code or cause errors by modifying the schema. 在您使用來源不明或來源不受信任的 DAC 之前,請將它部署到 Database EngineDatabase Engine的隔離測試執行個體、解除封裝 DAC 並檢查程式碼,例如預存程序或其他使用者定義的程式碼。Before you use a DAC from an unknown or untrusted source, deploy it on an isolated test instance of the Database EngineDatabase Engine, unpack the DAC and examine the code, such as stored procedures or other user-defined code.

解除封裝資料層應用程式對話方塊Unpack Data-tier Application Dialog

解除封裝 DAC 封裝檔案To Unpack a DAC Package File

  • 在 Windows 檔案總管 中,巡覽至 DAC 封裝 (.dacpac) 檔案的位置。In Windows Explorer, navigate to the location of a DAC package (.dacpac) file.

  • 使用這兩種方法的其中一種,來開啟 [解除封裝資料層應用程式] 對話方塊:Use one of these two methods to open the Unpack Data-tier Application dialog:

    1. 以滑鼠右鍵按一下 DAC 封裝 (.dacpac) 檔案,並選取 [解除封裝] 。Right-click the DAC package (.dacpac) file and select Unpack.

    2. 按兩下 DAC 封裝檔案。Double-click the DAC package file.

  • 完成對話方塊:Complete the dialogs:

解除封裝 Microsoft SQL Server DAC 封裝檔案Unpack Microsoft SQL Server DAC Package File

使用此頁面可指定要放置解除封裝檔案的目的地資料夾,然後執行解除封裝作業。Use this page to specify the destination folder in which to place the unpacked files, and then run the unpack operation.

檔案將解除封裝至這個資料夾 - 指定放置解除封裝檔案之資料夾的完整路徑。Files will be unpacked to this folder: - Specify the full path to the folder for the unpacked files. 如果此資料夾已經存在,而且您知道完整路徑,請在方塊中輸入路徑。If the folder exists and you know the full path, type the path in the box. 如果不存在,請按一下 [瀏覽] 按鈕,導覽至資料夾或建立新的資料夾。If not, click the Browse button to navigate to a folder or create a new folder.

瀏覽 - 開啟 [瀏覽資料夾] 頁面,您可以在這裡導覽檔案階層來選擇資料夾或建立新的資料夾。Browse - Opens the Browse for Folder page where you can choose a folder by navigating the file hierarchy, or create a new folder.

解除封裝 - 開始解除封裝作業。Unpack - Starts the unpack operation.

取消 - 結束此對話方塊,而不解除封裝 DAC 封裝。Cancel - Terminates the dialog box without unpacking the DAC package.

瀏覽資料夾Browse for Folder

使用此頁面可選擇解除封裝作業的目的地資料夾。Use this page to choose the destination folder for the unpack operation. 您也可以選擇建立新的資料夾。Optionally, you can also create a new folder.

資料夾清單 - 顯示電腦的檔案階層。Folder list - Displays the file hierarchy for your computer. 展開節點,導覽至要解除封裝 DAC 封裝的資料夾。Expand the nodes to navigate to the folder in which to unpack the DAC package. 按一下此資料夾,然後按一下 [確定]Click on the folder and then click OK.

建立新資料夾 - 開啟對話方塊,您可以在其中指定您目前在資料夾階層中選取之資料夾內所要建立的新資料夾名稱。Make New Folder - Opens a dialog in which you can specify the name for a new folder to be created in the folder you have currently selected in the folder hierarchy.

確定 - 放置您在 [解除封裝 DAC 封裝檔案] 頁面之 [檔案將解除封裝至這個資料夾] 方塊內所選取之資料夾的路徑,並讓您回到這個頁面。OK - Places the path to the folder you selected in the Files will be unpacked to this folder box of the Unpack DAC Package File page and returns you to that page.

取消 - 結束此對話方塊,而不選取資料夾。Cancel - Terminates the dialog box without selecting a folder.

檢查 DAC 封裝的內容Examine the Contents of a DAC Package

在解除封裝之後,您可以檢查 [解除封裝資料層應用程式] 對話方塊所產生的檔案。After unpacking the package, you can examine the files produced by the Unpack Data-tier Application dialog. 此對話方塊會在選取的目的地資料夾中建置下列檔案:The dialog box builds the following files in the selected destination folder:

  1. Transact-SQL 指令碼,其中包含建立 DAC 中所定義之物件的陳述式。A Transact-SQL script that contains the statements for creating the objects defined in the DAC. 檔案名稱為 DACName.sql,其中 DACName 是 DAC 的名稱。The file name is DACName.sql, where DACName is the name of the DAC.

  2. 封裝中的所有 XML 檔案。All XML files from the package.

  3. DAC [其他檔案] 區段中的所有檔案,例如 DAC 預先部署或部署後的檔案。All files from the Extra Files section of the DAC, such as the DAC pre-deployment or post-deployment files.

如需詳細資訊,請參閱 Validate a DAC PackageFor more information, see Validate a DAC Package.

另請參閱See Also

資料層應用程式 Data-tier Applications
部署資料層應用程式 Deploy a Data-tier Application
升級資料層應用程式Upgrade a Data-tier Application