英文:
Backup a derby database with excluding a table
问题
我需要备份一个Derby数据库(包括数据和模式),以便以后使用Java进行恢复,
但我需要排除其中一个非常大的表,在这种情况下不重要,不需要备份
是否有任何方法可以将表导出为创建语句和插入语句列表?
我找到了以下备份方法,但它们在我的情况下都不起作用:
SYSCS_UTIL.SYSCS_BACKUP_DATABASE
这个方法会包括我不想在备份中包含的那个表
如果我能排除掉那个表就好了。
SYSCS_UTIL.SYSCS_EXPORT_TABLE
对每个表调用此方法是可以的,但我不知道如何在这一点上备份/恢复表模式!
它生成一个以逗号分隔的文件,其中包含该时间点的数据。
英文:
I need to backup a derby database (both data and schema) to be restored later using Java
but I need exclude one of the tables that is very big in size, and it's not important in this case to be backed up
Is there is any way to export a table as a create statement and list of inset statements?
I found the following ways to backup, but non of them work in my case:
SYSCS_UTIL.SYSCS_BACKUP_DATABASE
This one will include the table that I don't want in include in the backup
If I can exclude that table, that will be good.
SYSCS_UTIL.SYSCS_EXPORT_TABLE
Calling it for each table is fine, but I don't know how to backup/restore the table schema on that point to restore!
It generates a comma separated file with the data on that point of time.
答案1
得分: 0
The opposite of the SYSCS_EXPORT_TABLE
system procedure is the SYSCS_IMPORT_TABLE
procedure: http://db.apache.org/derby/docs/10.15/ref/rrefimportproc.html
To make a full backup and restore solution out of this, I'd suggest:
- Collecting all your export commands into a script and treat that script like a real program (put it under source control, test it, get it reviewed by your colleague, etc.)
- Initially, don't try to restore right back into the same database. Create a new database, and restore the data into the new database. In particular, this will help with your testing because you can write commands to fetch the data out of both the old and the new databases and compare them.
英文:
The opposite of the SYSCS_EXPORT_TABLE
system procedure is the SYSCS_IMPORT_TABLE
procedure: http://db.apache.org/derby/docs/10.15/ref/rrefimportproc.html
To make a full backup and restore solution out of this, I'd suggest:
- Collecting all your export commands into a script and treat that script like a real program (put it under source control, test it, get it reviewed by your colleague, etc.)
- Initially, don't try to restore right back into the same database. Create a new database, and restore the data into the new database. In particular, this will help with your testing because you can write commands to fetch the data out of both the old and the new databases and compare them.
专注分享java语言的经验与见解,让所有开发者获益!
评论