Search code examples
orientdb

OrientDB restore -> database is closed


I have a db.zip archive (with .cpm, .pcl, .irs,.sbt, .wal, ... files) I like to restore

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

To me, it seems as the restore was successful. However, whatever next command I use (e.g. select * from V) I get the following error:

Error: com.orientechnologies.orient.core.exception.ODatabaseException: Database 'mydb' is closed

Am I doing something wrong? Why is the DB closed? How could I open it?


Solution

  • I tried your case with OrientDB version 2.1.11 following these steps (previously I created a backup copy of a DB with the new name mydb.zip).

    1. Create the new DB:

      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. Restore 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. Select all vertices from V (I get your same exception):

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

    This (your) problem seems to be related to this issue where it's explained that the access to a DB in plocal mode with another running OrientDB instance generates a conflict. If you shutdown the opened OrientDB instance and try to connect to the DB in plocal mode, you'll be able to access to the DB.

    1. Shutdown the running OrientDB instance and re-connect in plocal mode:

      orientdb> connect plocal:/path/to/db/newDB admin admin
      
      Connecting to database [plocal:/path/to/db/newDB] with user 'admin'...OK
      
    2. Select again all vertices from 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
      ----+-----+-------+------+--------
      

    Anyway, I tried also with the new OrientDB 2.2.0 beta and, with this version, this behaviour doesn't happen:

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

    Hope it helps