OrientDB 恢复 -> 数据库已关闭
OrientDB restore -> database is closed
我有一个 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
Select 来自 V
的所有顶点(我得到同样的异常):
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
Select 再次来自 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
----+-----+-------+------+--------
希望对您有所帮助
我有一个 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
Select 来自
V
的所有顶点(我得到同样的异常):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
Select 再次来自
的所有顶点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
----+-----+-------+------+--------
希望对您有所帮助