OrientDB匯出資料庫


與RDBMS類似,OrientDB還提供了匯出和匯入資料庫等功能。 OrientDB使用JSON格式匯出資料。 預設情況下,export命令使用GZIP演算法來壓縮檔案。

匯出資料庫時不會鎖定資料庫,這意味著您可以對其執行並行讀取和寫入操作。可以建立該資料的完全副本,因為並行的讀取和寫入操作。

在本章中,學習如何從OrientDB命令列匯出資料庫。

以下語句是Export database命令的基本語法。

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 127ms