【问题标题】:OrientDB restore -> database is closedOrientDB 恢复 -> 数据库已关闭
【发布时间】:2016-03-09 21:22:59
【问题描述】:

我有一个 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

我做错了吗?为什么数据库关闭?怎么打开?

【问题讨论】:

  • 嗨,您是否执行了原始数据库的 EXPORTBACKUP

标签: orientdb


【解决方案1】:

我按照这些步骤使用 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 中选择所有顶点(我得到了同样的例外):

    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
    ----+-----+-------+------+--------

希望对你有帮助

【讨论】:

  • 'close' 然后重新连接有效。但是,恢复后图表为空。出于测试原因,我对 Grateful Dead 数据库进行了备份和恢复,效果相同。所以,我做了一些完全错误的事情:) 对我有用的是将解压缩的文件夹复制到磁盘上的物理文件夹中。
  • 嗨,感谢投票。无论如何,您使用的是哪个版本?你试过新的 2.2.0 beta 吗?有了这个最后我没有遇到这个问题。
猜你喜欢
  • 1970-01-01
  • 2014-02-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多