用于创建“测试”的工具类似于开发数据库上的环境

发布于 2024-09-26 04:35:22 字数 959 浏览 3 评论 0原文

我们有一个正在生产中的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

三生池水覆流年 2024-10-03 04:35:22

不要这样做......设置单独的质量保证和开发数据库。你想要的东西不值得这么麻烦。

Don't do it.. Setup separate QA and Development databases. What you are wanting just isn't worth the hassle.

淡淡離愁欲言轉身 2024-10-03 04:35:22

有点遥远,但是 impdp REMAP_SCHEMA 选项会处理其他架构中的外键吗?我知道有些事情它不会尝试处理,但不记得提到过这种情况 - 可能只是因为它很不寻常。

您可能可以对所有模式执行一次 expdp,然后一次将它们全部重新映射到 QA_APP_OWNERimpdp。显然这不是我尝试过的事情......

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 an impdp remapping them all to QA_APP_OWNER in one go. Clearly this isn't something I've ever tried...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文