如何通过命令行或GUI重新创建(导出/导入)Hana DB结构/数据?

时间:2021-04-22 16:50:38

We are new to Hana DB and starting to build a Hana DB connector for our existing application for an existing customer adopting SAP B1 with a Hana DB. Our application just needs to make connections to the Hana DB and perform some basic SQL SELECT queries. We want to reconstruct the Hana DB data structure schema (i.e. tables, fields, etc) in our devtest environment based on a customer's new setup so we can build and tune those queries on our side.

我们是Hana DB的新手,并开始为我们现有的应用程序构建一个Hana DB连接器,用于采用带有Hana DB的SAP B1的现有客户。我们的应用程序只需要连接到Hana DB并执行一些基本的SQL SELECT查询。我们希望在我们的devtest环境中根据客户的新设置重建Hana DB数据结构模式(即表,字段等),以便我们可以在我们这边构建和调整这些查询。

Is there a recommended way to quickly export or dump the Hana DB, either just the structure only or the structure plus their current test data set in the database and then recreate on our side?

是否有推荐的方法来快速导出或转储Hana DB,或者只是结构,还是结构加上数据库中的当前测试数据集,然后在我们这边重新创建?

As an example in MySQL, it would be something as simple as:

作为MySQL中的一个例子,它将是一个简单的事情:

  1. Test Customer's side: mysqldump -h host -uuser -p database_name > database_name.sql
  2. 测试客户方:mysqldump -h host -uuser -p database_name> database_name.sql

  3. Our DevTest side: mysqladmin -h host -uuser -p create database_name
  4. 我们的DevTest方面:mysqladmin -h host -uuser -p create database_name

  5. Our DevTest side: mysql -h host -uuser -p database_name < database_name.sql
  6. 我们的DevTest方面:mysql -h host -uuser -p database_name

Is there an equivalent to the above steps for a Hana DB?

是否有与Hana DB相同的上述步骤?

Are there both GUI tool and command line tool equivalents of the above that would already be installed on the Windows machine where they have it installed?

是否有已安装在Windows机器上的GUI工具和命令行工具等效物?

If our test customer is running on Windows and we intend to setup our DevTest Hana DB on Linux, are the tools and syntax to export/import the same?

如果我们的测试客户在Windows上运行并且我们打算在Linux上设置我们的DevTest Hana数据库,那么导出/导入它们的工具和语法是什么?

Will there be any differences if we intend to use SAP Hana Express Edition from the Docker Store for our DevTest environment and our customer is likely using a full blown SAP Hana edition. Are the DB structure and commands/tools and syntax going to be all the same?

如果我们打算在Docker Store中使用SAP Hana Express Edition用于我们的DevTest环境,并且我们的客户可能正在使用完整的SAP Hana版本,那么会有任何差异吗? DB结构和命令/工具和语法是否完全相同?

1 个解决方案

#1


0  

Here's answers to a few of your questions, based on my experience with HANA.

根据我在HANA方面的经验,以下是您的一些问题的答案。

  • GUI side, we used to use Eclipse to export and import HANA schemas. You can choose to export the DB structure only or structure + data. This view was available by installing the SAP Cloud Platform tools (see https://tools.hana.ondemand.com/#cloud); a perspective which allowed database browsing was then installed into Eclipse, called SAP HANA administration console. By right clicking your schema, you had import/export options available. Eclipse is cross-platform so I imagine this would be an option on both Windows and Linux.
  • 在GUI方面,我们曾经使用Eclipse来导出和导入HANA架构。您可以选择仅导出DB结构或结构+数据。通过安装SAP Cloud Platform工具可以获得此视图(请参阅https://tools.hana.ondemand.com/#cloud);然后,允许数据库浏览的透视图安装到Eclipse中,称为SAP HANA管理控制台。通过右键单击您的架构,您可以使用导入/导出选项。 Eclipse是跨平台的,所以我想这将是Windows和Linux上的一个选项。

This approach is described in this article.

本文介绍了此方法。

Surprisingly, this is the only option we had. Our different environments had to have their HANA schemas synced in structure and test data, and we never found any way of automating these steps. Will future enhancement on SCP allow an integration between Jenkins and HANA DBs? Time will tell.

令人惊讶的是,这是我们唯一的选择。我们的不同环境必须让他们的HANA架构在结构和测试数据中同步,我们从未找到任何自动执行这些步骤的方法。 SCP的未来增强是否允许Jenkins和HANA DB之间的集成?时间会证明。

SAP also provides a SAP HANA Studio, which is desktop software you can download from the SAP store, but it's just a revamped version of Eclipse and offers no extra functionality over it.

SAP还提供SAP HANA Studio,这是可以从SAP商店下载的桌面软件,但它只是Eclipse的改进版本,并没有提供额外的功能。

Note: in our case, our HANA DB was hosted on SAP Cloud Platform. Would the Eclipse method using the SCP SDK plugin work if the DB isn't hosted on SCP? I imagine it would, but cannot confirm.

注意:在我们的案例中,我们的HANA数据库托管在SAP Cloud Platform上。如果数据库没有托管在SCP上,Eclipse方法是否可以使用SCP SDK插件?我想它会,但不能确认。

  • Command-line side, although I've never done it this way, I found this link which says you can use a tool called HDBSQL and then simply call IMPORT/EXPORT/IMPORT FROM commands to export catalog objects; seemingly, quite a few options on that side. The HANA documentation is quite good on these commands.

    命令行方面,虽然我从未这样做过,但是我发现这个链接说你可以使用一个名为HDBSQL的工具,然后只需调用IMPORT / EXPORT / IMPORT FROM命令来导出目录对象;看似这方面有很多选择。 HANA文档非常适合这些命令。

  • Concerning the differences between Express and Developer editions of HANA, it seems a lot are related to memory and storage, and there is some functionality which is only available in the Developer edition, such as smart data streaming. So yes, it seems the schema structure, commands and tools are going to be the same. I wouldn't worry about compatability problems between both editions; they seem to differ only in the range of options available.

    关于HANA的Express和Developer版本之间的差异,似乎很多与内存和存储有关,并且有一些功能仅在开发人员版本中可用,例如智能数据流。所以,是的,似乎架构结构,命令和工具将是相同的。我不担心两个版本之间的兼容性问题;它们似乎只在可供选择的范围上有所不同。

#1


0  

Here's answers to a few of your questions, based on my experience with HANA.

根据我在HANA方面的经验,以下是您的一些问题的答案。

  • GUI side, we used to use Eclipse to export and import HANA schemas. You can choose to export the DB structure only or structure + data. This view was available by installing the SAP Cloud Platform tools (see https://tools.hana.ondemand.com/#cloud); a perspective which allowed database browsing was then installed into Eclipse, called SAP HANA administration console. By right clicking your schema, you had import/export options available. Eclipse is cross-platform so I imagine this would be an option on both Windows and Linux.
  • 在GUI方面,我们曾经使用Eclipse来导出和导入HANA架构。您可以选择仅导出DB结构或结构+数据。通过安装SAP Cloud Platform工具可以获得此视图(请参阅https://tools.hana.ondemand.com/#cloud);然后,允许数据库浏览的透视图安装到Eclipse中,称为SAP HANA管理控制台。通过右键单击您的架构,您可以使用导入/导出选项。 Eclipse是跨平台的,所以我想这将是Windows和Linux上的一个选项。

This approach is described in this article.

本文介绍了此方法。

Surprisingly, this is the only option we had. Our different environments had to have their HANA schemas synced in structure and test data, and we never found any way of automating these steps. Will future enhancement on SCP allow an integration between Jenkins and HANA DBs? Time will tell.

令人惊讶的是,这是我们唯一的选择。我们的不同环境必须让他们的HANA架构在结构和测试数据中同步,我们从未找到任何自动执行这些步骤的方法。 SCP的未来增强是否允许Jenkins和HANA DB之间的集成?时间会证明。

SAP also provides a SAP HANA Studio, which is desktop software you can download from the SAP store, but it's just a revamped version of Eclipse and offers no extra functionality over it.

SAP还提供SAP HANA Studio,这是可以从SAP商店下载的桌面软件,但它只是Eclipse的改进版本,并没有提供额外的功能。

Note: in our case, our HANA DB was hosted on SAP Cloud Platform. Would the Eclipse method using the SCP SDK plugin work if the DB isn't hosted on SCP? I imagine it would, but cannot confirm.

注意:在我们的案例中,我们的HANA数据库托管在SAP Cloud Platform上。如果数据库没有托管在SCP上,Eclipse方法是否可以使用SCP SDK插件?我想它会,但不能确认。

  • Command-line side, although I've never done it this way, I found this link which says you can use a tool called HDBSQL and then simply call IMPORT/EXPORT/IMPORT FROM commands to export catalog objects; seemingly, quite a few options on that side. The HANA documentation is quite good on these commands.

    命令行方面,虽然我从未这样做过,但是我发现这个链接说你可以使用一个名为HDBSQL的工具,然后只需调用IMPORT / EXPORT / IMPORT FROM命令来导出目录对象;看似这方面有很多选择。 HANA文档非常适合这些命令。

  • Concerning the differences between Express and Developer editions of HANA, it seems a lot are related to memory and storage, and there is some functionality which is only available in the Developer edition, such as smart data streaming. So yes, it seems the schema structure, commands and tools are going to be the same. I wouldn't worry about compatability problems between both editions; they seem to differ only in the range of options available.

    关于HANA的Express和Developer版本之间的差异,似乎很多与内存和存储有关,并且有一些功能仅在开发人员版本中可用,例如智能数据流。所以,是的,似乎架构结构,命令和工具将是相同的。我不担心两个版本之间的兼容性问题;它们似乎只在可供选择的范围上有所不同。