教程:使用 Azure CLI 还原 Azure VM 中的 SAP HANA 数据库Tutorial: Restore SAP HANA databases in an Azure VM using Azure CLI

Azure CLI 用于从命令行或通过脚本创建和管理 Azure 资源。Azure CLI is used to create and manage Azure resources from the command line or through scripts. 本文档详细介绍了如何使用 Azure CLI 在 Azure VM 上还原已备份的 SAP HANA 数据库。This documentation details how to restore a backed-up SAP HANA database on an Azure VM - using Azure CLI. 还可以使用 Azure 门户执行这些步骤。You can also perform these steps using the Azure portal.

使用 Azure CLI 运行 CLI 命令。Use Azure CLI to run CLI commands.

本教程结束时,你将能够:By the end of this tutorial you'll be able to:

  • 查看已备份数据库的还原点View restore points for a backed-up database
  • 还原数据库Restore a database

本教程假设你有一个 SAP HANA 数据库在通过 Azure 备份完成备份的 Azure VM 上运行。This tutorial assumes you have an SAP HANA database running on Azure VM that's backed-up using Azure Backup. 如果你已按照使用 CLI 在 Azure 中备份 SAP HANA 数据库中的说明备份 SAP HANA 数据库,则要使用以下资源:If you've used Back up an SAP HANA database in Azure using CLI to back up your SAP HANA database, then you're using the following resources:

  • 名为 saphanaResourceGroup 的资源组a resource group named saphanaResourceGroup
  • 名为 saphanaVault 的保管库a vault named saphanaVault
  • 名为 VMAppContainer;Compute;saphanaResourceGroup;saphanaVM 的受保护容器protected container named VMAppContainer;Compute;saphanaResourceGroup;saphanaVM
  • 名为 saphanadatabase;hxe;hxe 的已备份数据库/项backed-up database/item named saphanadatabase;hxe;hxe
  • chinanorth2 区域中的资源resources in the chinanorth2 region

查看已备份数据库的还原点View restore points for a backed-up database

要查看数据库的所有恢复点列表,请使用 az backup recoverypoint list cmdlet,如下所示:To view the list of all the recovery points for a database, use the az backup recoverypoint list cmdlet as follows:

az backup recoverypoint list --resource-group saphanaResourceGroup \
    --vault-name saphanaVault \
    --container-name VMAppContainer;Compute;saphanaResourceGroup;saphanaVM \
    --item-name saphanadatabase;hxe;hxe \
   --output table

恢复点列表如下所示:The list of recovery points will look as follows:

Name                      Time                               BackupManagementType   Item Name               RecoveryPointType
-------------------       ---------------------------------  ---------------------  ----------------------  ------------------
7660777527047692711       2019-12-10T04:00:32.346000+00:00   AzureWorkload          SAPHanaDtabase;hxe;hxe  Full
7896624824685666836       2019-12-15T10:33:32.346000+00:00   AzureWorkload          SAPHanaDtabase;hxe;hxe  Differential
DefaultRangeRecoveryPoint                                    AzureWorkload          SAPHanaDtabase;hxe;hxe  Log

如你所见,上面的列表包含三个恢复点:分别用于完整备份、差异备份和日志备份。As you can see, the list above contains three recovery points: one each for full, differential, and log backup.

备注

你还可以使用 az backup recoverypoint show-log-chain cmdlet 查看每个连续日志备份链的起点和终点。You can also view the start and end points of every unbroken log backup chain, using the az backup recoverypoint show-log-chain cmdlet.

还原数据库的先决条件Prerequisites to restore a database

开始还原数据库前,请确保满足以下先决条件:Ensure that the following prerequisites are met before restoring a database:

  • 只能将数据库还原到同一区域中的 SAP HANA 实例You can restore the database only to an SAP HANA instance that's in the same region
  • 目标实例必须注册到与源相同的保管库The target instance must be registered with the same vault as the source
  • Azure 备份不能识别同一 VM 上两个不同的 SAP HANA 实例。Azure Backup can't identify two different SAP HANA instances on the same VM. 因此,无法将数据从同一 VM 上的一个实例还原到另一个实例。Therefore, restoring data from one instance to another on the same VM isn't possible.

还原数据库Restore a database

Azure 备份可以还原在 Azure VM 上运行的 SAP HANA 数据库,如下所示:Azure Backup can restore SAP HANA databases that are running on Azure VMs as follows:

  • 使用日志备份还原到特定的日期或时间(精确到秒)。Restore to a specific date or time (to the second) by using log backups. Azure 备份可自动确定相应的完整备份、差异备份和日志链备份,这些是根据所选时间进行还原所必需的。Azure Backup automatically determines the appropriate full, differential backups and the chain of log backups that are required to restore based on the selected time.
  • 还原特定的完整备份或差异备份,这样就可以还原到特定的恢复点。Restore to a specific full or differential backup to restore to a specific recovery point.

要还原数据库,请使用 az restore restore-azurewl cmdlet,该 cmdlet 需要将恢复配置对象作为其中一个输入。To restore a database, use the az restore restore-azurewl cmdlet, which requires a recovery config object as one of the inputs. 此对象可使用 az backup recoveryconfig show cmdlet 生成。This object can be generated using the az backup recoveryconfig show cmdlet. 恢复配置对象包含执行还原的所有详细信息。The recovery config object contains all the details to perform a restore. 其中一项是还原模式 - OriginalWorkloadRestore 或 AlternateWorkloadRestore 。One of them being the restore mode - OriginalWorkloadRestore or AlternateWorkloadRestore.

备注

OriginalWorkloadRestore - 将数据库还原到与原始源相同的 SAP HANA 实例。OriginalWorkloadRestore - Restore the data to the same SAP HANA instance as the original source. 此选项会覆盖原始数据库。This option overwrites the original database.
AlternateWorkloadRestore - 将数据库还原到备用位置,同时保留原始源数据库。AlternateWorkloadRestore - Restore the database to an alternate location and keep the original source database.

还原到备用位置Restore to alternate location

要将数据库还原到备用位置,请使用 AlternateWorkloadRestore 作为还原模式。To restore a database to an alternate location, use AlternateWorkloadRestore as the restore mode. 然后,必须选择还原点(可以是以前的时间点或以前的任何还原点)。You must then choose the restore point, which could either be a previous point-in-time or any of the previous restore points.

在本教程中,你将还原到以前的还原点。In this tutorial, you'll restore to a previous restore point. 查看数据库的还原点列表并选择要还原到的点。View the list of restore points for the database and choose the point you want to restore to. 本教程将使用名称为 7660777527047692711 的还原点。This tutorial will use the restore point with the name 7660777527047692711.

使用上述还原点名称和还原模式,让我们通过 az backup recoveryconfig show cmdlet 创建恢复配置对象。Using the above restore point name and the restore mode, let's create the recovery config object using the az backup recoveryconfig show cmdlet. 我们来看看此 cmdlet 中其余每个参数的含义:Let's look at what each of the remaining parameters in this cmdlet mean:

  • --target-item-name:这是已还原数据库要使用的名称。--target-item-name This is the name that the restored database will be using. 在本例中,我们使用名称 restored_database。In this case, we used the name restored_database.
  • --target-server-name:这是成功注册到恢复服务保管库并且与要还原的数据库位于同一区域中的 SAP HANA 服务器的名称。--target-server-name This is the name of an SAP HANA server that's successfully registered to a Recovery Services vault and lies in the same region as the database to be restored. 在本教程中,我们会将数据库还原到受保护的同一 SAP HANA 服务器,名为 hxehost。For this tutorial, we'll restore the database to the same SAP HANA server that we've protected, named hxehost.
  • --target-server-type:若要还原 SAP HANA 数据库,必须使用 HANAInstance。--target-server-type For the restore of SAP HANA databases, HANAInstance must be used.

az backup recoveryconfig show --resource-group saphanaResourceGroup \
    --vault-name saphanaVault \
    --container-name VMAppContainer;Compute;saphanaResourceGroup;saphanaVM \
    --item-name saphanadatabase;hxe;hxe \
    --restore-mode AlternateWorkloadRestore \
    --rp-name 7660777527047692711 \
    --target-item-name restored_database \
    --target-server-name hxehost \
    --target-server-type HANAInstance \
    --workload-type SAPHANA \
    --output json

上一个查询的响应将是一个类似如下的恢复配置对象:The response to the above query will be a recovery config object that looks something like this:

{"restore_mode": "AlternateLocation", "container_uri": " VMAppContainer;Compute;saphanaResourceGroup;saphanaVM ", "item_uri": "SAPHanaDatabase;hxe;hxe", "recovery_point_id": "7660777527047692711", "item_type": "SAPHana", "source_resource_id": "/subscriptions/ef4ab5a7-c2c0-4304-af80-af49f48af3d1/resourceGroups/saphanaResourceGroup/providers/Microsoft.Compute/virtualMachines/saphanavm", "database_name": null, "container_id": null, "alternate_directory_paths": null}

现在,要还原数据库,请运行 az restore restore-azurewl cmdlet。Now, to restore the database run the az restore restore-azurewl cmdlet. 要使用此命令,我们需输入上面的 json 输出(该输出保存到名为 recoveryconfig.json 的文件中)。To use this command, we'll enter the above json output that's saved to a file named recoveryconfig.json.

az backup restore restore-azurewl --resource-group saphanaResourceGroup \
    --vault-name saphanaVault \
    --restore-config recoveryconfig.json \
    --output table

输出如下所示:The output will look like this:

Name                                  Resource
------------------------------------  -------
5b198508-9712-43df-844b-977e5dfc30ea  SAPHANA

响应将为你提供作业名。The response will give you the job name. 此作业名可用于使用 az backup job show cmdlet 来跟踪作业状态。This job name can be used to track the job status using az backup job show cmdlet.

还原并覆盖Restore and overwrite

为还原到原始位置,我们将使用 OrignialWorkloadRestore 作为还原模式。To restore to the original location, we'll use OrignialWorkloadRestore as the restore mode. 然后,必须选择还原点(可以是以前的时间点或以前的任何还原点)。You must then choose the restore point, which could either be a previous point-in-time or any of the previous restore points.

在本教程中,我们选择还原到以前的时间点 28-11-2019-09:53:00。For this tutorial, we'll choose the previous point-in-time “28-11-2019-09:53:00” to restore to. 此还原点可按以下格式提供:dd-mm-yyyy、dd-mm-yyyy-hh:mm:ss。You can provide this restore point in the following formats: dd-mm-yyyy, dd-mm-yyyy-hh:mm:ss. 要选择要还原到的有效时间点,请使用 az backup recoverypoint show-log-chain cmdlet,此 cmdlet 会列出连续日志链备份的间隔。To choose a valid point-in-time to restore to, use the az backup recoverypoint show-log-chain cmdlet, which lists the intervals of unbroken log chain backups.

az backup recoveryconfig show --resource-group saphanaResourceGroup \
    --vault-name saphanaVault \
    --container-name VMAppContainer;Compute;saphanaResourceGroup;saphanaVM \
    --item-name saphanadatabase;hxe;hxe \
    --restore-mode OriginalWorkloadRestore \
    --log-point-in-time 28-11-2019-09:53:00 \
    --output json

上一个查询的响应将是一个如下所示的恢复配置对象:The response to the above query will be a recovery config object that looks as follows:

{"restore_mode": "OriginalLocation", "container_uri": " VMAppContainer;Compute;saphanaResourceGroup;saphanaVM ", "item_uri": "SAPHanaDatabase;hxe;hxe", "recovery_point_id": "DefaultRangeRecoveryPoint", "log_point_in_time": "28-11-2019-09:53:00", "item_type": "SAPHana", "source_resource_id": "/subscriptions/ef4ab5a7-c2c0-4304-af80-af49f48af3d1/resourceGroups/saphanaResourceGroup/providers/Microsoft.Compute/virtualMachines/saphanavm", "database_name": null, "container_id": null, "alternate_directory_paths": null}"

现在,要还原数据库,请运行 az restore restore-azurewl cmdlet。Now, to restore the database run the az restore restore-azurewl cmdlet. 要使用此命令,我们需输入上面的 json 输出(该输出保存到名为 recoveryconfig.json 的文件中)。To use this command, we'll enter the above json output that's saved to a file named recoveryconfig.json.

az backup restore restore-azurewl --resource-group saphanaResourceGroup \
    --vault-name saphanaVault \
    --restore-config recoveryconfig.json \
    --output table

输出如下所示:The output will look like this:

Name                                  Resource
------------------------------------  --------
5b198508-9712-43df-844b-977e5dfc30ea  SAPHANA

响应将为你提供作业名。The response will give you the job name. 此作业名可用于使用 az backup job show cmdlet 来跟踪作业状态。This job name can be used to track the job status using the az backup job show cmdlet.

还原为文件Restore as files

为将备份数据还原为文件而不是数据库,我们将使用“RestoreAsFiles”作为还原模式。To restore the backup data as files instead of a database, we'll use RestoreAsFiles as the restore mode. 然后,选择还原点(可以是以前的时间点或以前的任何还原点)。Then choose the restore point, which can either be a previous point-in-time or any of the previous restore points. 文件转储到指定路径后,可以将这些文件移动到要将其还原为数据库的任何 SAP HANA 计算机上。Once the files are dumped to a specified path, you can take these files to any SAP HANA machine where you want to restore them as a database. 由于可以将这些文件移动到任何计算机,你现在可以跨订阅和区域进行数据还原。Because you can move these files to any machine, you can now restore the data across subscriptions and regions.

在本教程中,我们将选择还原到以前的时间点 28-11-2019-09:53:00,以及在同一 SAP HANA 服务器上将备份文件转储为 /home/saphana/restoreasfiles 的位置。For this tutorial, we'll choose the previous point-in-time 28-11-2019-09:53:00 to restore to, and the location to dump backup files as /home/saphana/restoreasfiles on the same SAP HANA server. 此还原点可按以下格式提供:“dd-mm-yyyy”或“dd-mm-yyyy-hh:mm:ss” 。You can provide this restore point in either of the following formats: dd-mm-yyyy or dd-mm-yyyy-hh:mm:ss. 要选择要还原到的有效时间点,请使用 az backup recoverypoint show-log-chain cmdlet,此 cmdlet 会列出连续日志链备份的间隔。To choose a valid point-in-time to restore to, use the az backup recoverypoint show-log-chain cmdlet, which lists the intervals of unbroken log chain backups.

使用上述还原点名称和还原模式,让我们通过 az backup recoveryconfig show cmdlet 创建恢复配置对象。Using the restore point name above and the restore mode, let's create the recovery config object using the az backup recoveryconfig show cmdlet. 我们来看看此 cmdlet 中其余每个参数的含义:Let's look at what each of the remaining parameters in this cmdlet mean:

  • --target-container-name:这是成功注册到恢复服务保管库并且与要还原的数据库位于同一区域中的 SAP HANA 服务器的名称。--target-container-name This is the name of an SAP HANA server that's successfully registered to a Recovery Services vault and lies in the same region as the database to be restored. 在本教程中,我们会将数据库作为文件还原到受保护的同一 SAP HANA 服务器,名为 hxehost。For this tutorial, we'll restore the database as files to the same SAP HANA server that we've protected, named hxehost.
  • - rp - name 对于时间点还原,还原点名称将为“DefaultRangeRecoveryPoint”--rp-name For a point-in-time restore the restore point name will be DefaultRangeRecoveryPoint
az backup recoveryconfig show --resource-group saphanaResourceGroup \
    --vault-name saphanaVault \
    --container-name VMAppContainer;Compute;saphanaResourceGroup;saphanaVM \
    --item-name saphanadatabase;hxe;hxe \
    --restore-mode RestoreAsFiles \
    --log-point-in-time 28-11-2019-09:53:00 \
    --rp-name DefaultRangeRecoveryPoint \
    --target-container-name VMAppContainer;Compute;saphanaResourceGroup;saphanaVM \
    --filepath /home/saphana/restoreasfiles \
    --output json

上一个查询的响应将是一个如下所示的恢复配置对象:The response to the query above will be a recovery config object that looks as follows:

{
  "alternate_directory_paths": null,
  "container_id": "/Subscriptions/ef4ab5a7-c2c0-4304-af80-af49f48af3d1/resourceGroups/saphanaResourceGroup/providers/Microsoft.RecoveryServices/vaults/SAPHANAVault/backupFabrics/Azure/protectionContainers/VMAppContainer;Compute;SAPHANA;hanamachine",
  "container_uri": "VMAppContainer;compute;saphana;hanamachine",
  "database_name": null,
  "filepath": "/home/",
  "item_type": "SAPHana",
  "item_uri": "SAPHanaDatabase;hxe;hxe",
  "log_point_in_time": "04-07-2020-09:53:00",
  "recovery_mode": "FileRecovery",
  "recovery_point_id": "DefaultRangeRecoveryPoint",
  "restore_mode": "AlternateLocation",
  "source_resource_id": "/subscriptions/ef4ab5a7-c2c0-4304-af80-af49f48af3d1/resourceGroups/saphanaResourceGroup/providers/Microsoft.Compute/virtualMachines/hanamachine"
}

现在,要将数据库还原为文件,请运行 az restore restore-azurewl cmdlet。Now, to restore the database as files run the az restore restore-azurewl cmdlet. 要使用此命令,我们需输入上面的 json 输出(该输出保存到名为“recoveryconfig.json”的文件中)。To use this command, we'll enter the json output above which is saved to a file named recoveryconfig.json.

az backup restore restore-azurewl --resource-group saphanaResourceGroup \
    --vault-name saphanaVault \
    --restore-config recoveryconfig.json \
    --output json

输出如下所示:The output will look like this:

{
  "eTag": null,
  "id": "/Subscriptions/ef4ab5a7-c2c0-4304-af80-af49f48af3d1/resourceGroups/SAPHANARESOURCEGROUP/providers/Microsoft.RecoveryServices/vaults/SAPHANAVault/backupJobs/608e737e-c001-47ca-8c37-57d909c8a704",
  "location": null,
  "name": "608e737e-c001-47ca-8c37-57d909c8a704",
  "properties": {
    "actionsInfo": [
      "Cancellable"
    ],
    "activityId": "7ddd3c3a-c0eb-11ea-a5f8-54ee75ec272a",
    "backupManagementType": "AzureWorkload",
    "duration": "0:00:01.781847",
    "endTime": null,
    "entityFriendlyName": "HXE [hxehost]",
    "errorDetails": null,
    "extendedInfo": {
      "dynamicErrorMessage": null,
      "propertyBag": {
        "Job Type": "Restore as files"
      },
      "tasksList": [
        {
          "status": "InProgress",
          "taskId": "Transfer data from vault"
        }
      ]
    },
    "jobType": "AzureWorkloadJob",
    "operation": "Restore",
    "startTime": "2020-07-08T07:20:29.336434+00:00",
    "status": "InProgress",
    "workloadType": "SAPHanaDatabase"
  },
  "resourceGroup": "saphanaResourceGroup",
  "tags": null,
  "type": "Microsoft.RecoveryServices/vaults/backupJobs"
}

响应将为你提供作业名。The response will give you the job name. 此作业名可用于使用 az backup job show cmdlet 来跟踪作业状态。This job name can be used to track the job status using the az backup job show cmdlet.

转储到目标容器的文件是:The files that are dumped onto the target container are:

  • 数据库备份文件Database backup files
  • 目录文件Catalog files
  • JSON 元数据文件(适用于所涉及的每个备份文件)JSON metadata files (for each backup file that's involved)

通常,如果将网络共享路径或已装载的 Azure 文件共享的路径指定为目标路径,会使同一网络中的其他计算机或其上装载的同一 Azure 文件共享更加轻松地访问这些文件。Typically, a network share path, or path of a mounted Azure file share when specified as the destination path, enables easier access to these files by other machines in the same network or with the same Azure file share mounted on them.

备注

要在装载在目标注册的 VM 上的 Azure 文件共享上还原数据库备份文件,请确保根帐户对 Azure 文件共享具有读/写权限。To restore the database backup files on an Azure file share mounted on the target registered VM, make sure that root account has read/ write permissions on the Azure file share.

根据所选的还原点类型(“时间点”或“完整和差异”),你将看到一个或多个在目标路径中创建的文件夹 。Based on the type of restore point chosen (Point in time or Full & Differential), you'll see one or more folders created in the destination path. 名为 Data_<date and time of restore> 的文件夹之一包含完整备份和差异备份,名为 Log 的其他文件夹包含日志备份。One of the folders named Data_<date and time of restore> contains the full and differential backups, and the other folder named Log contains the log backups.

将这些已还原文件移动到要将其还原为数据库的 SAP HANA 服务器。Move these restored files to the SAP HANA server where you want to restore them as a database. 然后按照这些步骤还原数据库:Then follow these steps to restore the database:

  1. 使用以下命令在存储备份文件的文件夹/目录上设置权限:Set permissions on the folder / directory where the backup files are stored using the following command:

    chown -R <SID>adm:sapsys <directory>
    
  2. 运行下一组命令 <SID>admRun the next set of commands as <SID>adm

    su - <sid>adm
    
  3. 生成用于还原的目录文件。Generate the catalog file for restore. 从用于完整备份的 JSON 元数据文件中提取“BackupId”,稍后将在还原操作中使用它。Extract the BackupId from the JSON metadata file for the full backup, which will be used later in the restore operation. 请确保完整备份和日志备份位于不同的文件夹中,并删除这些文件夹中的目录文件和 JSON 元数据文件。Make sure that the full and log backups are in different folders and delete the catalog files and JSON metadata files in these folders.

    hdbbackupdiag --generate --dataDir <DataFileDir> --logDirs <LogFilesDir> -d <PathToPlaceCatalogFile>
    

    在上面的命令中:In the command above:

    • <DataFileDir> - 包含完整备份的文件夹<DataFileDir> - the folder that contains the full backups
    • <LogFilesDir> - 包含日志备份的文件夹<LogFilesDir> - the folder that contains the log backups
    • <PathToPlaceCatalogFile> - 必须放置已生成的目录文件的文件夹<PathToPlaceCatalogFile> - the folder where the catalog file generated must be placed
  4. 通过 HANA Studio 使用新生成的目录文件进行还原或使用此新生成的目录运行 HDBSQL 还原查询。Restore using the newly generated catalog file through HANA Studio or run the HDBSQL restore query with this newly generated catalog. 下面列出了 HDBSQL 查询:HDBSQL queries are listed below:

    • 要还原到一个时间点:To restore to a point in time:

      如果要创建新的已还原数据库,请运行 HDBSQL 命令,以创建新的数据库 <DatabaseName>,然后停止用于还原的数据库。If you're creating a new restored database, run the HDBSQL command to create a new database <DatabaseName> and then stop the database for restore. 但是,如果只是还原现有数据库,请运行 HDBSQL 命令以停止数据库。However, if you're only restoring an existing database, run the HDBSQL command to stop the database.

      然后运行以下命令以还原数据库:Then run the following command to restore the database:

      RECOVER DATABASE FOR <DatabaseName> UNTIL TIMESTAMP '<TimeStamp>' CLEAR LOG USING SOURCE '<DatabaseName@HostName>'  USING CATALOG PATH ('<PathToGeneratedCatalogInStep3>') USING LOG PATH (' <LogFileDir>') USING DATA PATH ('<DataFileDir>') USING BACKUP_ID <BackupIdFromJsonFile> CHECK ACCESS USING FILE
      
      • <DatabaseName> - 新数据库或要还原的现有数据库的名称<DatabaseName> - Name of the new database or existing database that you want to restore
      • <Timestamp> - 时间点还原的确切时间戳<Timestamp> - Exact timestamp of the Point in time restore
      • <DatabaseName@HostName> - 备份用于还原的数据库的名称,以及此数据库所在位置的“主机”/SAP HANA 服务器的名称。<DatabaseName@HostName> - Name of the database whose backup is used for restore and the host / SAP HANA server name on which this database resides. USING SOURCE <DatabaseName@HostName> 选项指定数据备份(用于还原)是一个具有与目标 SAP HANA 计算机不同的 SID 或名称的数据库。The USING SOURCE <DatabaseName@HostName> option specifies that the data backup (used for restore) is of a database with a different SID or name than the target SAP HANA machine. 因此,不需要为采用备份的同一 HANA 服务器上的还原指定它。So it doesn't need to be specified for restores done on the same HANA server from where the backup is taken.
      • <PathToGeneratedCatalogInStep3> - 在“步骤 3”中生成的指向目录文件的路径<PathToGeneratedCatalogInStep3> - Path to the catalog file generated in Step 3
      • <DataFileDir> - 包含完整备份的文件夹<DataFileDir> - the folder that contains the full backups
      • <LogFilesDir> - 包含日志备份的文件夹<LogFilesDir> - the folder that contains the log backups
      • <BackupIdFromJsonFile> - 在“步骤 3”中提取的“BackupId” <BackupIdFromJsonFile> - the BackupId extracted in Step 3
    • 要还原到特定完整备份或差异备份:To restore to a particular full or differential backup:

      如果要创建新的已还原数据库,请运行 HDBSQL 命令,以创建新的数据库 <DatabaseName>,然后停止用于还原的数据库。If you're creating a new restored database, run the HDBSQL command to create a new database <DatabaseName> and then stop the database for restore. 但是,如果只是还原现有数据库,请运行 HDBSQL 命令来停止数据库:However, if you're only restoring an existing database, run the HDBSQL command to stop the database:

      RECOVER DATA FOR <DatabaseName> USING BACKUP_ID <BackupIdFromJsonFile> USING SOURCE '<DatabaseName@HostName>'  USING CATALOG PATH ('<PathToGeneratedCatalogInStep3>') USING DATA PATH ('<DataFileDir>')  CLEAR LOG
      
      • <DatabaseName> - 新数据库或要还原的现有数据库的名称<DatabaseName> - the name of the new database or existing database that you want to restore
      • <Timestamp> - 时间点还原的确切时间戳<Timestamp> - the exact timestamp of the Point in time restore
      • <DatabaseName@HostName> - 备份用于还原的数据库的名称,以及此数据库所在位置的“主机”/SAP HANA 服务器的名称。<DatabaseName@HostName> - the name of the database whose backup is used for restore and the host / SAP HANA server name on which this database resides. USING SOURCE <DatabaseName@HostName> 选项指定数据备份(用于还原)是一个具有与目标 SAP HANA 计算机不同的 SID 或名称的数据库。The USING SOURCE <DatabaseName@HostName> option specifies that the data backup (used for restore) is of a database with a different SID or name than the target SAP HANA machine. 因此,不需要为采用备份的同一 HANA 服务器上的还原指定它。So it need not be specified for restores done on the same HANA server from where the backup is taken.
      • <PathToGeneratedCatalogInStep3> - 在“步骤 3”中生成的指向目录文件的路径<PathToGeneratedCatalogInStep3> - the path to the catalog file generated in Step 3
      • <DataFileDir> - 包含完整备份的文件夹<DataFileDir> - the folder that contains the full backups
      • <LogFilesDir> - 包含日志备份的文件夹<LogFilesDir> - the folder that contains the log backups
      • <BackupIdFromJsonFile> - 在“步骤 3”中提取的“BackupId” <BackupIdFromJsonFile> - the BackupId extracted in Step 3

后续步骤Next steps