用于创建“测试”的工具类似于开发数据库上的环境
我们有一个正在生产中的 Oracle Enterprise 数据库,以及另一个用作 QA 和开发数据库的实例。 QA 要求在数据库中为他们提供单独的模式,以便他们可以测试与开发人员所做的更改隔离的应用程序。举个例子,假设开发中使用的模式和生产中使用的模式称为 APP_OWNER,并且 APP_OWNER 可以包含对其他模式中的表具有 FK 引用的表,例如在 BASE_OWNER 中。这个想法是创建一个 QA_APP_OWNER 模式,并将生产数据拉入该模式,并将引用的任何 BASE_OWNER 表拉入 QA_APP_OWNER 模式。一个简化的说明是:
Prod Setup:
----------------
BASE_OWNER.users
APP_OWNER.users (synonym to BASE_OWNER.users)
APP_OWNER.audit_users with FK to BASE_OWNER.users
QA Setup:
----------------
QA_APP_OWNER.users (copied data from prod)
QA_APP_OWNER.audit_users (FK to APP_OWNER.users)
这应该是可能的,因为我们不编写包含模式的代码/SQL。 (即,我们为应用程序运行的模式之外的表创建基于模式的同义词)
我的问题是,是否有好的工具可以轻松创建这样的 QA_APP_OWNER 模式?我知道导出的 FROMUSER TOUSER 选项,但如果我没记错的话,这会将整个模式移动到另一个模式,但它不会让我一路到达我想要的位置 b/c 我需要更改FK 的参考资料。我不知道有什么办法可以导出 DDL,手动更改它,然后手动导入数据。这不是一个有吸引力的选项,因为许多引用都引用了其他表,并且 APP_OWNER 模式本身有大量表。我担心的是,手动操作越多,出错的可能性就越大,从而导致正在测试的东西在转移到生产环境时崩溃。一个不错的解决方案是同时拥有 Oracle 的开发实例和质量保证实例的许可证,但我被告知“这不在预算之内”。
We have an Oracle Enterprise database in production and another instance that we use as both a QA and Development database. QA has requested that they be given separate schemas within the database so they can test applications isolated from changes made by developers. For an example, say the schema used in development and the one that will be used in production is called APP_OWNER and APP_OWNER could contain tables that have FK references to tables in other schemas, say in BASE_OWNER. The idea would be to create a QA_APP_OWNER schema and to pull over the production data into that schema as well as pulling any BASE_OWNER tables referenced into the QA_APP_OWNER schema as well. A simplified illustration would be:
Prod Setup:
----------------
BASE_OWNER.users
APP_OWNER.users (synonym to BASE_OWNER.users)
APP_OWNER.audit_users with FK to BASE_OWNER.users
QA Setup:
----------------
QA_APP_OWNER.users (copied data from prod)
QA_APP_OWNER.audit_users (FK to APP_OWNER.users)
This should be possible as we do not write code/SQL including schemas. (i.e we create schema based synonyms for tables outside the schema the application is running in)
My question is, are there good tools for easily creating such a QA_APP_OWNER schema? I'm aware of the FROMUSER TOUSER options of export, but If I remember correctly this will move an entire schema to another schema but it won't get me all the way to where I want to be b/c I need to change the references on the FKs. I'm unaware of a way short of exporting the DDL, manually changing it, and then importing the data manually. This is not an attractive option as many references are to tables that also reference other tables and the APP_OWNER schema has a plethora of tables itself. My fear is the more manual this is, the more likely-hood of a mistake that will allow something being tested to break when moved to the production environment. A nice solution would be to have licenses for both a dev and a qa instance of Oracle, but I have been told "it isn't in the budget" to do so.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不要这样做......设置单独的质量保证和开发数据库。你想要的东西不值得这么麻烦。
Don't do it.. Setup separate QA and Development databases. What you are wanting just isn't worth the hassle.
有点遥远,但是
impdp
REMAP_SCHEMA
选项会处理其他架构中的外键吗?我知道有些事情它不会尝试处理,但不记得提到过这种情况 - 可能只是因为它很不寻常。您可能可以对所有模式执行一次
expdp
,然后一次将它们全部重新映射到QA_APP_OWNER
的impdp
。显然这不是我尝试过的事情......Bit of a long shot, but will the
impdp
REMAP_SCHEMA
option handle foreign keys in other schemas? I know there are some things it doesn't attempt to deal with but don't recall this scenario being mentioned - possibly just because it's unusual though.Potentially you could do a single
expdp
of all the schemas, and animpdp
remapping them all toQA_APP_OWNER
in one go. Clearly this isn't something I've ever tried...