Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X
Hi,
I am confused what stuff should I need to export / backup from one instance if the Thingworx, so in the newly installed fresh instance I could get exact replica of the instance where backup was done from.
It looks more-less clear with Extensions - I need to import all of them in the new installation before restoring entities/data I guess.
I can see that Export to ThingWorx storage would create folder under c:/ThingworxStorage/Exports with name composed of current date/time. I tried to export with Including data checkbox turned On, and import with data to another instance. It did import "entities" (for example, Things), but properties of those things were no imported. This is the first confusion - why properties are not imported? Are these properties of my things considered as "Data"? If yes, why properties are not imported? Is this a bug?
I found also some discussions in this forum that backup of Data can be created using DataManagementServices resource. I did not try to use it yet. Would be interesting to know, if I create backup with that service, and restore it, would it restore properties of Things? Another question in this regard - if I backup with DataManagementServices, will that also include "Data" the same as "Data" on export to ThingWorx storage would include, so I don't need to check the box "Include Data" anymore? Or maybe backup with DataManagementServices includes even all "Entities" so I don't need to export them at all.
I see that the Export can be run programmaticaly, and looks like I understand how to call DataManagementServices from Java code (in extension).
What is not clear - how to import from thingworx storage programmatically?
I would really appreciate if you could provide hints for these my questions,
Thank you, Ravil
Ravil, yes, the Extensions have to be imported first before importing the Entities/ Data (because for example, a Thing or Mashup might rely upon an Extension contents, and won't import if those contents do not exist).
Are the properties remote properties by any chance? Generally, if you import a Thing, the properties and services associated with that Thing should export too. Data, for example, would contain values for those properties, or stream entries etc.
When you do Export to ThingworxStorage, it will be saved under the ThingworxStorage\exports folder. You can check the Application log for the export status as that will print out Export Start and Completed messages. If you want to do the same process through a service, you can use the ContentLoaderFunctions for something like:
var params = {
url: "http://your_ip/Thingworx/ExportDatabase?WithData=true",
username: "Administrator",
password: "admin"
};
result = Resources["ContentLoaderFunctions"].GetText(params);
Please do note that the above call would immediately start an export process. If you want to use a Scheduler Thing to export, here is a link to one of the knowledge articles available in the PTC Support site.
Hi Aanjan,
Thank you for the response,
I verified that the export by using the way you shown (call result = Resources["ContentLoaderFunctions"].GetText(params);) works now. The reason why properties were not exported/imported was because they were not marked as Persistent in the ThingTemplate.
But still I have question about : how to import that exported data back to another Thingworx instance programmatically? Is there ImportDatabase counterpart of this service call?
I also concerned about when Things are updated after import, in case when you import existing Thing, i.e. updating it. In my experience, the Thing would keep old value for the property, until I restart Tomcat (perhaps restart of Thinworx only is enough too, but still restart). I think would be much better if after import the Thing is updated immediately for all users viewing its properties. I tried to logoff/login, did not help either, only restart allows to see updated values for Thing properties.
And additionally would be nice to know what does DataManagementServices offer. Can it provide the same functionality to backup-restore? Maybe it can provide information about backup-restore process progress (like 10% complete)? Can anyone provide some hints / links / introduction on it?
Thank you, Ravil