OrientDB 恢复 -> 数据库关闭

标签 orientdb

我有一个 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 创建了数据库的备份副本)。

  1. 创建新数据库:

    create database plocal:/path/to/db/newDB admin admin
    
    Creating database [plocal:/path/to/db/newDB] using the storage type [plocal]...
    
    Database created successfully.
    
  2. 恢复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
    
  3. V中选择所有顶点(我得到了同样的异常(exception)):

    orientdb {db=newDB}> select * from V
    
    Error: com.orientechnologies.orient.core.exception.ODatabaseException: Database 'newDB'
           is closed
    

这个(你的)问题似乎与此 issue 有关。其中解释了在 plocal 模式下与另一个正在运行的 OrientDB 实例访问数据库会产生冲突。 如果您关闭打开的 OrientDB 实例并尝试以 plocal 模式连接到数据库,您将能够访问该数据库。

  1. 关闭正在运行的 OrientDB 实例并以 plocal 模式重新连接:

    orientdb> connect plocal:/path/to/db/newDB admin admin
    
    Connecting to database [plocal:/path/to/db/newDB] with user 'admin'...OK
    
  2. 再次选择 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/

相关文章:

docker - 由于 docker 数据,Ubuntu 14.04 卷磁盘已满

node.js - 如何在 SailsJS/Waterline 适配器方法中获取 DB 对象?

node.js - 避免 oriento 中的查询超时(OrientDB 的 Node.js 驱动程序)

java - orientdb 属性约束(例如 MANDATORY)不会因不正确的 java api 插入而失败

java - Orient DB - 使用密码创建 orient db 并使用 JAVA 检查是否可用

java - 使用文档 api 在 orient db 中更新

java.lang.NoClassDefFoundError : com/googlecode/concurrentlinkedhashmap/ConcurrentLinkedHashMap$Builder 错误

java - orientdb 中的这些 [size=40] 标签是什么

orientdb - 在 orientdb 中对 RID 和集合使用 expand

node.js - 如何使用 orientjs 针对 OrientDB 执行 Gremlin?