如何将选择性数据从一个数据库复制到另一个数据库(ORACLE)

Hir*_*rak 7 java oracle

我们需要找到一种方法将生产中的某些数据复制到我们的开发区域,以便我们可以调试/修复任何问题.有时单个用户相关数据会受到影响.我们必须在dev中复制相同的场景并找到解决方案.目前我们遵循两种方法: -

 1. Check the audit history and try to recreate the similar scenario
    in  dev. <50% sucess rate in recreating the exact same scenario.
 2. Restore+Encrypt the "whole" production into dev and then continue
    on  the work. It is an overkill if issue impacts only a single user.
Run Code Online (Sandbox Code Playgroud)

所以我试图找到一种方法来从生产中选择单个用户数据并将其插入到dev区域.

我们只有Java和Oracle.不能使用任何外部工具.因为我们没有许可证,因安全问题无法下载免费软件.

我尝试了以下内容: -

  1. 编写一个java代码,它将查询信息模式表以查找表之间的关系并创建如下所示的select语句: -

select 'insert into TABLE1(C1,C2,C3,C4) values ('||''''||C1||''''||','||coalesce(to_char(C2),'null')||','||''''||C3||''''||','||coalesce(to_char(C4),'null'));'
from TABLE1 where ID='1006' union all 
select 'insert into TABLE2(C1,C2,C3,C4) values ('||''''||C1||''''||','||coalesce(to_char(C2),'null')||','||''''||C3||''''||','||coalesce(to_char(C4),'null'));'
from TABLE2 WHERE TABLE1ID in ( select ID FROM TABLE1 where ID='1006') union all 
select 'insert into TABLE3(C1,C2,C3,C4) values ('||''''||C1||''''||','||coalesce(to_char(C2),'null')||','||''''||C3||''''||','||coalesce(to_char(C4),'null'));'
from TABLE3 WHERE TABLE2ID in ( select ID FROM TABLE2 WHERE TABLE1ID in ( select ID FROM TABLE1 where ID='1006'));
2.在生产中使用这组选择,以便获得一组插入语句作为输出.3.在dev中使用insert语句.

问题: - 选择查询变得越来越大.总共约25 MB :(我们甚至无法在生产中执行那个大问题.

你能为这个用例建议更好的方法吗?oracle本身是否允许选择性数据导出?或者我应该编写我的java代码的任何其他方式?