Giải pháp đồng bộ dữ liệu sql trên linux

Chuyển đến nội dung chính

Trình duyệt này không còn được hỗ trợ nữa.

Hãy nâng cấp lên Microsoft Edge để tận dụng các tính năng mới nhất, bản cập nhật bảo mật và hỗ trợ kỹ thuật.

Export and import a database on Linux with SSMS or SqlPackage.exe on Windows

  • Bài viết
  • 08/18/2022
  • 2 phút để đọc

Trong bài viết này

Applies to:

Giải pháp đồng bộ dữ liệu sql trên linux
SQL Server (all supported versions) - Linux

This article shows how to use SQL Server Management Studio (SSMS) and SqlPackage.exe to export and import a database on SQL Server on Linux. SSMS and SqlPackage.exe are Windows applications, so use this technique when you have a Windows machine that can connect to a remote SQL Server instance on Linux.

You should always install and use the most recent version of SQL Server Management Studio (SSMS) as described in Use SSMS on Windows to connect to SQL Server on Linux

Note

If you are migrating a database from one SQL Server instance to another, the recommendation is to use Backup and restore.

Export a database with SSMS

  1. Start SSMS by typing Microsoft SQL Server Management Studio in the Windows search box, and then select the desktop app.

    Giải pháp đồng bộ dữ liệu sql trên linux

  2. Connect to your source database in Object Explorer. The source database can be in Microsoft SQL Server running on-premises or in the cloud, on Linux, Windows or Docker and Azure SQL Database or Azure Synapse Analytics.

  3. Right-click the source database in the Object Explorer, point to Tasks, and click Export Data-Tier Application...

  4. In the export wizard, select Next, and then on the Settings tab, configure the export to save the BACPAC file to either a local disk location or to an Azure blob.

  5. By default, all objects in the database are exported. Select the Advanced tab and choose the database objects that you wish to export.

  6. Select Next and then select Finish.

The *.BACPAC file is successfully created at the location you chose and you are ready to import it into a target database.

Import a database with SSMS

  1. Start SSMS by typing Microsoft SQL Server Management Studio in the Windows search box, and then select the desktop app.

    Giải pháp đồng bộ dữ liệu sql trên linux

  2. Connect to your target server in Object Explorer. The target server can be Microsoft SQL Server running on-premises or in the cloud, on Linux, Windows or Docker and Azure SQL Database or Azure Synapse Analytics.

  3. Right-click the Databases folder in the Object Explorer and click Import Data-tier Application...

  4. To create the database in your target server, specify a BACPAC file from your local disk or select the Azure storage account and container to which you uploaded your BACPAC file.

  5. Provide the New database name for the database. If you are importing a database on Azure SQL Database, set the Edition of Microsoft Azure SQL Database (service tier), Maximum database size, and Service Objective (performance level).

  6. Select Next and then select Finish to import the BACPAC file into a new database in your target server.

The *.BACPAC file is imported to create a new database in the target server you specified.

SqlPackage command-line option

It is also possible to use the SQL Server Data Tools (SSDT) command-line tool, SqlPackage.exe, to export and import BACPAC files.

The following example command exports a BACPAC file:

SqlPackage.exe /a:Export /ssn:tcp: /sdn: /su: /sp: /tf:

Use the following command to import database schema and user data from a .BACPAC file:

SqlPackage.exe /a:Import /tsn:tcp: /tdn: /tu: /tp: /sf:

See also

For more information on how to use SSMS, see Use SQL Server Management Studio. For more information on SqlPackage.exe, see the SqlPackage reference documentation.

Phản hồi

Gửi và xem ý kiến phản hồi dành cho

Chuyển đến nội dung chính

Trình duyệt này không còn được hỗ trợ nữa.

Hãy nâng cấp lên Microsoft Edge để tận dụng các tính năng mới nhất, bản cập nhật bảo mật và hỗ trợ kỹ thuật.

  • Bài viết
  • 08/18/2022
  • 2 phút để đọc

Trong bài viết này

Applies to: SQL Server (all supported versions) - Linux

There are several ways to manage SQL Server on Linux. The following section provides a quick overview of different management tools and techniques with pointers to more resources.

mssql-conf

The mssql-conf tool configures SQL Server on Linux. For more information, see Configure SQL Server on Linux with mssql-conf.

Transact-SQL

Almost everything you can do in a client tool can also be accomplished with Transact-SQL statements. SQL Server provides Dynamic Management Views (DMVs) that query the status and configuration of SQL Server. There are also Transact-SQL commands for database management tasks. You can run these commands in any client tool that supports connecting to SQL Server and running Transact-SQL queries, for example sqlcmd or Visual Studio Code.

Azure Data Studio

The new Azure Data Studio is a cross-platform tool for managing SQL Server. For more information, see Azure Data Studio.

Named Pipes

The Named Pipes protocol is not supported for SQL Server on Linux.

SQL Server Management Studio on Windows

SQL Server Management Studio (SSMS) is a Windows application that provides a graphical user interface for managing SQL Server. Although it currently runs only on Windows, you can use it to remotely connect to your Linux SQL Server instances. For more information on using SSMS to manage SQL Server, see Use SSMS to Manage SQL Server on Linux.

mssql-cli (preview)

Microsoft has released a new cross-platform scripting tool for SQL Server, mssql-cli. This tool is currently in preview.

PowerShell

PowerShell provides a rich command-line environment to manage SQL Server on Linux. For more information, see Use PowerShell to Manage SQL Server on Linux.

Next steps

  • For more information about SQL Server on Linux, see SQL Server on Linux
  • Start, stop, and restart SQL Server services on Linux

Phản hồi

Gửi và xem ý kiến phản hồi dành cho