简体   繁体   中英

Backup/Restore to/from XML using NHibernate

I am using Nhibernate for my project. I was wondering, is there any tool/lib that I can use to backup/restore entire database in xml format using Nhibernate.

nDBUnit does sort of what I want. But, it is a database testing library and thus the purpose is different. Besides, it uses xxd to do that. What I am looking for is something which uses hbm files to do that.

For hibernate, this is a link I found: Backup/Restore to/from XML using Hibernate http://www.jroller.com/ara_e/entry/backup_restore_to_from_xml

Another “side” question: For a “sufficiently large“ database, is it a good idea to backup in a xml file?

Any help will be greatly appreciated.

If you had a large database, I would say 'no'. I have used XML for import/export operations before (for instance, I implemented a feature where you could export an entity as a "template", and them import it at some other site, along with all the dependencies).

The problem is that XML naturally blows up to many times the size of the original data, and you also have to worry about consistency. Are you going to be able to get a real snapshot of the database at a single point in time? How much time will this take? If you manage to get a read lock on everything, that will start to block other concurrent operations at the same time. That's something that the native backup feature of your database will already take into account.

Summary: XML's good for moving data around between disparate systems, but backups are best done natively by your data store.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM