Hi Chris, Does *restore* command works in console?
Best regards, Artem Orobets * Orient Technologiesthe Company behind OrientDB* 2014-07-01 13:12 GMT+03:00 Chris Klinger <[email protected]>: > Hey guys, > > i'm trying to implement a basic backup/restore mechanism in my > application. the use case basicly is to load a previous snapshot of data. > so i do a backup and later i want to restore this to a second "working copy > database" to view the old data. > The db service in the following code is a simple spring bean starting an > embedded orientdb server and retuns the graph database instance. > > try { > File backupFile = new File("testbackup.zip"); > OutputStream oS = new FileOutputStream(backupFile); > > dbService.getGraphDatabaseInstanceNoTx().getRawGraph().backup(oS, > null, null, null, 1, 1024); > > oS.close(); // close the stream > dbService.destroy(); // shutdown embedded server > > dbService.setGraphDatabase("restoreSnapshot" + > System.currentTimeMillis()); > > dbService.afterPropertiesSet(); // start embedded server > > FileInputStream iS = new FileInputStream(backupFile); > dbService.getGraphDatabaseInstanceNoTx().getRawGraph().restore(iS, > null, null, null); > iS.close(); // close input stream > > } catch (FileNotFoundException e) { > // TODO Auto-generated catch block > e.printStackTrace(); > } catch (IOException e) { > // TODO Auto-generated catch block > e.printStackTrace(); > } catch (Exception e) { > // TODO Auto-generated catch block > e.printStackTrace(); > } > > Running this code i get the following exception: > > java.io.IOException: The process cannot access the file because another > process has locked a portion of the file > at java.io.FileOutputStream.writeBytes(Native Method) > at java.io.FileOutputStream.write(FileOutputStream.java:345) > at java.io.BufferedOutputStream.write(BufferedOutputStream.java:122) > at com.orientechnologies.common.io.OIOUtils.copyStream(OIOUtils.java:153) > at > com.orientechnologies.orient.core.compression.impl.OZIPCompressionUtil.extractFile(OZIPCompressionUtil.java:90) > at > com.orientechnologies.orient.core.compression.impl.OZIPCompressionUtil.uncompressDirectory(OZIPCompressionUtil.java:76) > at > com.orientechnologies.orient.core.storage.impl.local.OStorageLocalAbstract.restore(OStorageLocalAbstract.java:119) > at > com.orientechnologies.orient.core.db.raw.ODatabaseRaw.restore(ODatabaseRaw.java:182) > at > com.orientechnologies.orient.core.db.ODatabaseWrapperAbstract.restore(ODatabaseWrapperAbstract.java:77) > at > com.orientechnologies.orient.core.db.ODatabaseWrapperAbstract.restore(ODatabaseWrapperAbstract.java:77) > at > com.encoway.conceptor.base.document.orient.OrientDbBasicTest.testDbSnapshot(OrientDbBasicTest.java:126) > > I'm sure, none of the used files is accessed by another process. i'm doing > something wrong? or could this be a bug in orientdb? i'm using version 1.7.3 > > any ideas? > > thanks > > -- > > --- > You received this message because you are subscribed to the Google Groups > "OrientDB" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- --- You received this message because you are subscribed to the Google Groups "OrientDB" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
