OrientDB - 資料庫匯出



與關係型資料庫管理系統 (RDBMS) 一樣,OrientDB 也提供資料庫匯出和匯入功能。OrientDB 使用 JSON 格式匯出資料。預設情況下,匯出命令使用 GZIP 演算法壓縮檔案。

匯出資料庫時不會鎖定資料庫,這意味著您可以對其執行併發讀寫操作。這也意味著您可以建立該資料的精確副本,因為存在併發讀寫操作。

本章將介紹如何從 OrientDB 命令列匯出資料庫。

以下是匯出資料庫命令的基本語法。

EXPORT DATABASE <output file>

注意 - 只有連線到特定資料庫後才能使用此命令。

示例

在此示例中,我們將使用上一章中建立的名為“demo”的相同資料庫。您可以使用以下命令將資料庫匯出到名為“export-demo”的檔案。

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

如果成功執行,它將根據作業系統建立一個名為“export-demo.zip”或“exportdemo.gz”的檔案,並且您將獲得以下輸出。

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 
廣告