OrientDB導(dǎo)出數(shù)據(jù)庫

2018-12-22 09:57 更新

像RDBMS一樣,OrientDB還提供了諸如導(dǎo)出和導(dǎo)入數(shù)據(jù)庫的功能。 OrientDB使用JSON格式導(dǎo)出數(shù)據(jù)。 默認(rèn)情況下,export命令使用GZIP算法壓縮文件。
在導(dǎo)出數(shù)據(jù)庫時(shí),它不會鎖定數(shù)據(jù)庫,這意味著您可以對其執(zhí)行并行讀取和寫入操作。 這也意味著您可以創(chuàng)建該數(shù)據(jù)的精確副本,因?yàn)椴l(fā)讀取和寫入操作。
在本章中,您可以了解如何從OrientDB命令行導(dǎo)出數(shù)據(jù)庫。
以下語句是Export database命令的基本語法。

EXPORT DATABASE <output file>

注意:您只能在連接到特定數(shù)據(jù)庫后使用此命令。

在這個(gè)例子中,我們將使用我們在上一章中創(chuàng)建的名為“demo”的數(shù)據(jù)庫。 您可以使用以下命令將數(shù)據(jù)庫導(dǎo)出到名為“export-demo”的文件。

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

如果成功執(zhí)行,它將基于操作系統(tǒng)創(chuàng)建一個(gè)名為“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 
以上內(nèi)容是否對您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號
微信公眾號

編程獅公眾號