我有一个 db.zip
存档(包含 .cpm、.pcl、.irs、.sbt、.wal、... 文件),我喜欢恢复
create database plocal:mydb admin admin
restore database /path/to/db.zip
Restoring database database /path/to/db.zip...
- Uncompressing file $FILE1_IN_ARCHIVE [...snip...]
- [...snip...]
Database restored in 0.19 seconds
对我来说,恢复似乎成功了。但是,无论我使用什么下一个命令(例如 select * from V
),我都会收到以下错误:
Error: com.orientechnologies.orient.core.exception.ODatabaseException: Database 'mydb' is closed
我做错了什么吗?为什么数据库关闭了?我怎样才能打开它?
最佳答案
我按照以下步骤使用 OrientDB 版本 2.1.11 尝试了您的案例(之前我使用新名称 mydb.zip
创建了数据库的备份副本)。
创建新数据库:
create database plocal:/path/to/db/newDB admin admin Creating database [plocal:/path/to/db/newDB] using the storage type [plocal]... Database created successfully.
恢复
mydb.zip
:restore database C:/path/to/db/mydb.zip Restoring database database C:/path/to/db/mydb.zip... ... Database restored in 0,29 seconds
从
V
中选择所有顶点(我得到了同样的异常(exception)):orientdb {db=newDB}> select * from V Error: com.orientechnologies.orient.core.exception.ODatabaseException: Database 'newDB' is closed
这个(你的)问题似乎与此 issue 有关。其中解释了在 plocal
模式下与另一个正在运行的 OrientDB 实例访问数据库会产生冲突。
如果您关闭打开的 OrientDB 实例并尝试以 plocal
模式连接到数据库,您将能够访问该数据库。
关闭正在运行的 OrientDB 实例并以
plocal
模式重新连接:orientdb> connect plocal:/path/to/db/newDB admin admin Connecting to database [plocal:/path/to/db/newDB] with user 'admin'...OK
再次选择
V
中的所有顶点:orientdb {db=newDB}> select * from V ----+-----+-------+------+-------- # |@RID |@CLASS |name |category ----+-----+-------+------+-------- 0 |#12:0|Station|First |#13:0 1 |#12:1|Station|Second|#13:1 2 |#12:2|Station|Third |#13:2 ----+-----+-------+------+--------
无论如何,我也尝试了新的OrientDB 2.2.0 beta,并且在这个版本中,这种行为不会发生:
Restoring database 'database C:/path/to/db/mydb.zip' from full backup...
...
Database restored in 0,75 seconds
orientdb {db=newDB}> select * from V
----+-----+-------+------+--------
# |@RID |@CLASS |name |category
----+-----+-------+------+--------
0 |#12:0|Station|First |#13:0
1 |#12:1|Station|Second|#13:1
2 |#12:2|Station|Third |#13:2
----+-----+-------+------+--------
希望对你有帮助
关于OrientDB 恢复 -> 数据库关闭,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35902886/