Managing the Database. How to backup, restore, etc.

This blog contains instructions on how to clean, rebuild, backup, restore and update the database.

Clean:

The ant target for this operation is “clean-database”. This operation only cleans the current database. It does not clean a backup of a previous version of the database that may have been created.

Rebuild:

The ant target for this operation is “schema-export”. All data that exists in the database is lost when the database is rebuilt.

Backup:

The ant target for this operation is “backup-database”. This will create a backup copy of the database. Only one backup copy is maintained at any given time. i.e. each time a backup is created, the new backup copy wipes out an earlier backup if one existed. It is a good practice to make frequent backups.

Restore:

The ant target for this operation is “restore-database”. The database is restored to the last backup version, if one exists.

Update:

The model on which JTS is built closely resembles JSIDL. As the JAUS standard and JTS evolve, it is highly likely that both JSIDL and the model behind JTS may change. Each time this happens, existing databases and its data may get out of synch with the new model and schema and may need to be updated.

The easy way to perform an update is to use the “schema-update” ant target. This can be used if the change is a typical backwards compatible change that involves the addition of new attributes to types.

For more complex changes, follow the procedure below (courtesy the jMatter user guide).

1. Dump your data out of the database
2. ant schema-export (wipes out the data)
3. restore the data

The restoration of data usually needs to be broken down into at least these steps:

1. drop constraints on your schema
2. restore the data
3. add the constraints back in

Posted in:
About the Author

davem

David Martin is a Senior Robotics Software Engineer with Neya Systems, having joined in 2011. He’s been involved with the SAE JAUS community for seven years, and has sponsored or co-authored several of the published service sets. He currently serves as Vice Chair of the AS-4 Steering Committee, having worked himself out of a job in the AS-4A Architecture Framework Committee Chair. When he’s not working on the standard, Dave’s day job has focused lately on embedded systems for streaming digital video. Past projects include motion control for mobile platforms as well as industrial manipulators. He holds Bachelors and Masters of Science in Systems Engineering from Oakland University in Rochester, Michigan.