Orientdb 简明教程

OrientDB - Export Database

像 RDBMS 一样,OrientDB 也提供导出和导入数据库等功能。OrientDB 使用 JSON 格式导出数据。默认情况下,导出命令使用 GZIP 算法压缩文件。

Like RDBMS, OrientDB also provides features like Export and Import the database. OrientDB uses the JSON format to export the data. By default export command is using the GZIP algorithm to compress the files.

在导出数据库期间,它不会锁定数据库,这意味着您可以对其执行并发读写操作。这也意味着您可以创建该数据的精确副本,因为并发读写操作。

While exporting a database it is not locking the database, which means you can perform concurrent read and write operations on it. It also means that you can create an exact copy of that data because of concurrent read and write operations.

在本章中,您可以了解如何从 OrientDB 命令行导出数据库。

In this chapter, you can learn how to export the database from the OrientDB command line.

以下语句是导出数据库命令的基本语法。

The following statement is the basic syntax of the Export database command.

EXPORT DATABASE <output file>

Note − 您只能在连接到特定数据库后才能使用此命令。

Note − You can use this command only after connecting to a particular database.

Example

在本例中,我们将使用之前章节中创建的同名数据库“demo”。您可以使用以下命令将数据库导出到名为“export-demo”的文件中。

In this example, we will use the same database named ‘demo’ that we created in the previous chapter. You can use the following command to export the database to a file named ‘export-demo’.

orientdb {db = demo}> EXPORT DATABASE ./export-demo.export

如果执行成功,它将基于操作系统创建一个名为“export-demo.zip”或“exportdemo.gz”的文件,您会看到以下输出。

If it is successfully executed, it will create a file named ‘export-demo.zip’ or ‘exportdemo.gz’ based on the operating system and you will get the following output.

Exporting current database to: DATABASE /home/linuxtp/Desktop/demo.export in
GZipped JSON format ...

Started export of database 'demo' to /home/linuxtp/Desktop/demo.export.gz...
Exporting database info...OK
Exporting clusters...OK (12 clusters)
Exporting schema...OK (11 classes)
Exporting records...
- Cluster 'internal' (id = 0)...OK (records = 3/3)
- Cluster 'index' (id = 1)...OK (records = 0/0)
- Cluster 'manindex' (id = 2)...OK (records = 0/0)
- Cluster 'default' (id = 3)...OK (records = 0/0)
- Cluster 'orole' (id = 4)...OK (records = 3/3)
- Cluster 'ouser' (id = 5)...OK (records = 3/3)
- Cluster 'ofunction' (id = 6)...OK (records = 0/0)
- Cluster 'oschedule' (id = 7)...OK (records = 0/0)
- Cluster 'orids' (id = 8)...OK (records = 0/0)
- Cluster 'v' (id = 9)...OK (records = 0/0)
- Cluster 'e' (id = 10)...OK (records = 0/0)
- Cluster '_studio' (id = 11)...OK (records = 1/1)

Done. Exported 10 of total 10 records

Exporting index info...
- Index dictionary...OK
- Index OUser.name...OK
- Index ORole.name...OK
OK (3 indexes)
Exporting manual indexes content...
- Exporting index dictionary ...OK (entries = 0)
OK (1 manual indexes)

Database export completed in 377ms