Applicable Products
- HDP for PC/VM
- HDP PC Agent
- Microsoft SQL Server
Starting from version 2.3.1, the product previously known as HDP has been renamed to HDP for PC/VM.
Starting from version 1.3.0, the product previously known as NetBak PC Agent has been renamed to HDP PC Agent.
Prerequisites
To back up and restore your Microsoft SQL Server using the methods outlined in this guide, you need to install HDP for PC/VM on your NAS or install HDP PC Agent on your physical server. Ensure that you install the appropriate application before proceeding.
HDP Installation
- Log in to your NAS as an administrator.
- Open App Center.
- Click
, and then enter "HDP for PC/VM". - Click Install.
HDP PC Agent Installation
Before installing HDP PC Agent, ensure that you meet the system requirements. For details, see HDP PC Agent Quick Start Guide.
- Install HDP following the steps above. HDP PC Agent requires HDP to be running on your NAS to back up or restore your server.
- Download and install HDP PC Agent.
Details
This section provides step-by-step instructions on how to back up and restore Microsoft SQL Server using HDP and HDP PC Agent.
Back up Microsoft SQL Server
Choose the backup method based on your Microsoft SQL Server environment.HDP (for Virtual Machines)
- Add the hypervisor hosting the Microsoft SQL Server to the HDP inventory.
- Create a backup job.
- Configure the backup settings.
- Start the backup job.
For detailed instructions, see Using HDP for PC/VM to Back Up Hypervisors to a QNAP NAS.
HDP PC Agent (for Physical Servers)
- Create a repository to store your backup data on your NAS.
- Create a backup job.
- Configure the backup settings.
- Start the backup job.
For detailed instructions, see HDP PC Agent Quick Start Guide.
Restore Your Entire Microsoft SQL Server
Depending on your server environment, you can use HDP to restore your virtual machine to a hypervisor or use HDP PC Agent to restore your physical server with a USB boot drive.
HDP (for Virtual Machines)
- Create a restore job.
- Select the source to restore.
- Configure the restore settings.
- Start the restore process.
For detailed instructions, see Using HDP for PC/VM to Back Up Hypervisors to a QNAP NAS.
HDP PC Agent (for Physical Servers)
- Create a USB boot drive.
- Insert the USB boot drive into your server.
- Configure the BIOS boot order.
- Follow the Restore Wizard to restore your server.
For detailed instructions, see the HDP PC Agent Quick Start Guide.
Restore a Microsoft SQL Database
To restore your Microsoft SQL database to a precise point in time using .mdf and .ldf files, follow the steps below.
- View database file paths.
- Open Microsoft SQL Server Management Studio (SSMS).
- Complete the fields in the Connect to Server dialog box if it appears. For instructions, see this tutorial.
If SSMS automatically connects to your desired server, proceed to the next step. Otherwise, go to Object Explorer > Connect > Database Engine to connect manually. - In the Object Explorer pane, expand Databases.
- Right-click the database you want to restore.
- Click Properties.
The Database Properties dialog box appears. - Click Files on the left panel to view file paths.

- Download database files.
- Open Backup Explorer in HDP.
- Select the database version you want to restore.
- Locate and download the
.mdf and .ldf files to the desired restore destination.
For detailed instructions, see How do I restore files to my Windows PC or server with HDP Backup Explorer?.
- Configure file permissions.
- Open Command Prompt as Administrator.
- Run the following command twice, once for the
.mdf file and once for the .ldffile.icacls File_Path /grant MSSQLSERVER:(F)
- First, replace
File_Path with the .mdf file path obtained in the "View database file paths" section. - Then, replace
File_Path with the .ldf file path obtained in the "View database file paths" section.
- Attach the database.
- Run the following command to open the SQL command-line interface.
sqlcmd -S localhost
- Run the following SQL.
USE [master]GOCREATE DATABASE [Database_Name] ON( FILENAME = N'Disk:\Path\File_Name.mdf' ),( FILENAME = N'Disk:\Path\File_Name.ldf' )FOR ATTACHGO
- Replace the following placeholders.
[Database_Name] with your database name.Disk:\Path\File_Name.mdf with the .mdf file path obtained in the "View database file paths" section. Disk:\Path\File_Name.ldf with the .ldf file path obtained in the "View database file paths" section.
- The image below shows the typical output after executing the command.

Once completed, your database will be restored and available for use.
Further Reading
適用產品
- HDP for PC/VM
- HDP PC Agent
- Microsoft SQL Server
從版本 2.3.1 開始,之前稱為 HDP 的產品已更名為 HDP for PC/VM。
從版本 1.3.0 開始,之前稱為 NetBak PC Agent 的產品已更名為 HDP PC Agent。
先決條件
要使用本指南中列出的方法備份和還原您的 Microsoft SQL Server,您需要在 NAS 上安裝 HDP for PC/VM 或在實體伺服器上安裝 HDP PC Agent。在繼續之前,請確保您已安裝適當的應用程式。
HDP 安裝
- 以系統管理員身分登入您的 NAS。
- 開啟 App Center。
- 按一下
,然後輸入 "HDP for PC/VM"。 - 按一下 安裝。
HDP PC Agent 安裝
在安裝 HDP PC Agent 之前,請確保您符合系統要求。詳細資訊請參閱HDP PC Agent 快速入門指南。
- 按照上述步驟安裝 HDP。HDP PC Agent 需要在您的 NAS 上執行 HDP 才能備份或還原您的伺服器。
- 下載並安裝HDP PC Agent。
詳細資訊
本節提供如何使用 HDP 和 HDP PC Agent 備份和還原 Microsoft SQL Server 的逐步說明。
備份 Microsoft SQL Server
根據您的 Microsoft SQL Server 環境選擇備份方法。HDP (適用於虛擬機器)
- 將承載 Microsoft SQL Server 的虛擬機器管理程式新增到 HDP 清單中。
- 建立備份工作。
- 配置備份設定。
- 啟動備份工作。
如需詳細說明,請參閱使用 HDP for PC/VM 將 Hypervisors 備份至 QNAP NAS。
HDP PC Agent (適用於實體伺服器)
- 建立儲存備份資料的 NAS 儲存庫。
- 建立備份工作。
- 設定備份。
- 啟動備份工作。
如需詳細說明,請參閱HDP PC Agent 快速入門指南。
還原整個 Microsoft SQL Server
根據您的伺服器環境,您可以使用 HDP 將虛擬機器還原至虛擬機器管理程式,或使用 HDP PC Agent 透過 USB 開機碟還原您的實體伺服器。
HDP(適用於虛擬機器)
- 建立還原工作。
- 選擇要還原的來源。
- 設定還原。
- 啟動還原過程。
如需詳細說明,請參閱使用 HDP for PC/VM 將 Hypervisors 備份至 QNAP NAS。
HDP PC Agent(適用於實體伺服器)
- 建立 USB 開機碟。
- 將 USB 開機碟插入伺服器。
- 設定 BIOS 開機順序。
- 按照還原精靈還原伺服器。
如需詳細說明,請參閱HDP PC Agent 快速入門指南。
還原 Microsoft SQL 資料庫
要將 Microsoft SQL 資料庫還原至精確的時間點,請使用.mdf 和.ldf檔案,請按照以下步驟。
- 檢視資料庫檔案路徑。
- 開啟 Microsoft SQL Server Management Studio (SSMS)。
- 如果出現連接到伺服器對話框,請完成欄位。如需說明,請參閱此教程。
如果 SSMS 自動連接到您想要的伺服器,請進行下一步。否則,請前往物件瀏覽器 > 連接 > 資料庫引擎手動連接。 - 在物件瀏覽器窗格中,展開資料庫。
- 右鍵點選您要還原的資料庫。
- 點擊屬性。
出現資料庫屬性對話框。 - 在左側面板上點擊檔案以查看檔案路徑。

- 下載資料庫檔案。
- 在 HDP 中開啟備份總管。
- 選擇您要還原的資料庫版本。
- 定位並下載
.mdf和.ldf檔案至所需的還原目的地。
如需詳細說明,請參閱如何透過 HDP Backup Explorer 還原檔案至我的 Windows PC 或伺服器?。
- 設定檔案許可權。
- 以系統管理員身份開啟命令提示字元。
- 執行以下命令兩次,一次用於
.mdf檔案,一次用於.ldf檔案。icacls File_Path /grant MSSQLSERVER:(F)
- 首先,替換
File_Path 為 .mdf 在「檢視資料庫檔案路徑」部分獲得的檔案路徑。 - 然後,替換
File_Path 為 .ldf 在「檢視資料庫檔案路徑」部分獲得的檔案路徑。
- 附加資料庫。
- 執行以下命令以開啟 SQL 命令列介面。
sqlcmd -S localhost
- 執行以下 SQL。
USE [master]GOCREATE DATABASE [Database_Name] ON(FILENAME = N'Disk:\Path\File_Name.mdf'),(FILENAME = N'Disk:\Path\File_Name.ldf')FOR ATTACHGO
- 替換以下佔位符。
[Database_Name] 為您的資料庫名稱。Disk:\Path\File_Name.mdf 為 .mdf 在「檢視資料庫檔案路徑」部分獲得的檔案路徑。 Disk:\Path\File_Name.ldf 為 .ldf 在「檢視資料庫檔案路徑」部分獲得的檔案路徑。
- 下圖顯示了執行命令後的典型輸出。

完成後,您的資料庫將被恢復並可供使用。
進一步閱讀