您如何在协作的、版本控制的环境中处理 Oracle 包?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/706026/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do you work on Oracle packages in a collaborative, version-controlled environment?
提问by Jordan Parmer
I'm working in a multi-developer environment in Oracle with a large package. We have a DEV => TST => PRD promotion pattern. Currently, all package edits are made directly in TOAD and then compiled into the DEV package.
我正在 Oracle 中的多开发人员环境中使用一个大包。我们有一个 DEV => TST => PRD 推广模式。目前,所有包编辑都是直接在 TOAD 中进行,然后编译到 DEV 包中。
We run into two problems:
我们遇到了两个问题:
Concurrent changes need to be promoted on different schedules. For instance, developer A makes a change that needs to be promoted tomorrow while developer B is concurrently working on a change that won't be promoted for another two weeks. When it comes promotion time, we find ourselves manually commenting out stuff that isn't being promoted yet and then uncommenting it afterwards...yuck!!!
If two developers are making changes at the same exact time and one of them compiles, it wipes out the other developer's changes. There isn't a nice merge; instead the latest compile wins.
需要在不同的时间表上促进并发更改。例如,开发人员 A 进行了明天需要推广的更改,而开发人员 B 正在同时进行一项两周内不会推广的更改。到了促销时间,我们发现自己手动注释掉尚未促销的内容,然后在之后取消注释......哎呀!!!
如果两个开发人员同时进行更改并且其中一个进行编译,则会清除其他开发人员的更改。没有很好的合并;相反,最新的编译获胜。
What strategies would you recommend to get around this? We are using TFS for our source-control but haven't yet utilized this with our Oracle packages.
你会推荐什么策略来解决这个问题?我们正在使用 TFS 进行源代码控制,但尚未将其用于我们的 Oracle 包。
P.S.I've seen thisposting, but it doesn't fully answer my question.
PS我看过这个帖子,但它并没有完全回答我的问题。
采纳答案by Adam Fyles
We use Oracle Developer Tools for Visual Studio.NET...plugs right into TFS
我们使用Oracle Developer Tools for Visual Studio.NET...直接插入 TFS
回答by dpbradley
The key is to adopt a practice of only deploying code from the source control system. I'm not familiar with TSF, but it must implement the concepts of branches, tags, etc. The question of what to deploy then falls out of the build and release tagging in the source control system.
关键是采用仅从源代码控制系统部署代码的做法。我对 TSF 不熟悉,但它必须实现分支、标签等概念。然后部署什么的问题不属于源代码控制系统中的构建和发布标记。
Additional tips (for Oracle):
其他提示(针对 Oracle):
it works best if you split the package spec and body into different files that use a consistent file pattern for each (e.g. ".pks" for package spec, and ".pkb" for package body). If you use an automated build process that can process file patterns then you can build all of the specs and then the bodies. This also minimizes object invalidations if you are only deploying a package body.
put the time in to configure an automated build process that is driven from a release or build state of your source control system. If you have even a moderate number of db code objects it will pay to be able to build the code into a reference system and compare it to your qa or production system.
如果将包规范和正文拆分为不同的文件,每个文件使用一致的文件模式(例如,“.pks”用于包规范,“.pkb”用于包正文),则效果最佳。如果您使用可以处理文件模式的自动构建过程,那么您可以构建所有规范,然后构建主体。如果您仅部署包主体,这也可以最大限度地减少对象失效。
花时间配置一个自动构建过程,该过程由源控制系统的发布或构建状态驱动。如果您甚至有中等数量的 db 代码对象,那么能够将代码构建到参考系统中并将其与您的 qa 或生产系统进行比较是值得的。
回答by Mac
See my answerabout Tools to work with stored procedures in Oracle, in a team(which I have just retagged).
请参阅我关于在团队中使用 Oracle 中的存储过程的工具的回答(我刚刚重新标记了它)。
Bottom line : don't modify procedures directly with TOAD. Store the source as files, that you will store in source control, modify then execute.
底线:不要直接使用 TOAD 修改程序。将源文件存储为文件,您将存储在源代码管理中,修改然后执行。
Plus, I would highly recommend that each developer works on its own copy of the database (use Oracle Express, which is free). You can do that if you store all the scripts to create the database in source control. More insight can be found here.
另外,我强烈建议每个开发人员使用自己的数据库副本(使用免费的 Oracle Express)。如果您将所有脚本存储在源代码管理中以创建数据库,您就可以做到这一点。可以在此处找到更多见解。
回答by Tony Andrews
To avoid 2 developers working on the same package at the same time:
为了避免 2 个开发人员同时处理同一个包:
1) Use your version control system as the source of the package code. To work on a package, the developer must first check out the package from version control; nobody else can check the package out until this developer checks it back in.
1) 使用您的版本控制系统作为包代码的来源。要处理包,开发人员必须首先从版本控制中检出包;在此开发人员将其重新签入之前,没有其他人可以签出该包。
2) Don't work directly on the package code in Toad or any other IDE. You have no cluewhether the code you are working on there is correct or has been modified by one or more other developers. Work on the code in the script you have checked out from version control, and run that into the database to compile the package. My preference is to use a nice text editor (TextPad) and SQL Plus, but you can do this in Toad too.
2) 不要直接在 Toad 或任何其他 IDE 中处理包代码。您不知道您在那里处理的代码是否正确或是否已被一个或多个其他开发人员修改。处理您从版本控制中检出的脚本中的代码,并将其运行到数据库中以编译包。我更喜欢使用漂亮的文本编辑器 (TextPad) 和 SQL Plus,但您也可以在 Toad 中执行此操作。
3) When you have finished, check the script back into version control. Do notcopy and paste code out of the database into your script (see point 2 again).
3) 完成后,将脚本检查回版本控制。 不要将数据库中的代码复制并粘贴到您的脚本中(再次参见第 2 点)。
The downside (if it is one) of this controlled approach is that only one developer at a time can work on a package. This shouldn't be a major problem as long as:
这种受控方法的缺点(如果有的话)是一次只有一个开发人员可以处理一个包。只要满足以下条件,这应该不是主要问题:
- You keep packages down to a reasonable size (in terms of WHAT they do, not how many lines of code or number of procedures in them). Don't have one big package that holds all the code.
- Developers are encouraged to check out code only when ready to work on it, and to check it back in as soon as they have finished making and testing their changes.
- 您将包保持在合理的大小(就它们做什么而言,而不是其中的代码行数或过程数)。不要有一个包含所有代码的大包。
- 鼓励开发人员仅在准备好处理代码时才签出代码,并在完成更改和测试后立即重新签入。
回答by tuinstoel
You can use the Oracle developer tools for VS or you can use sql developer. SQL developer integrates with Subversion and CVS and you can download it for free. See here: http://www.oracle.com/technology/products/database/sql_developer/files/what_is_sqldev.html
您可以使用 VS 的 Oracle 开发人员工具,也可以使用 sql developer。SQL developer 与 Subversion 和 CVS 集成,您可以免费下载。请参见此处:http: //www.oracle.com/technology/products/database/sql_developer/files/what_is_sqldev.html
回答by Colin Pickard
we do it with a Dev database for every stream, and labels for the different streams.
我们使用每个流的 Dev 数据库和不同流的标签来实现。
Our Oracle licensing gives us unlimited dev/test instances, but we are an ISV, you may have a different licensing option
我们的 Oracle 许可为我们提供了无限的开发/测试实例,但我们是 ISV,您可能有不同的许可选项
回答by Geoffrey Hudik
We use Toad for Oracle with the TFS MSSCCI provider against TFS 2008. We use a Custom Toolthat pulls database checkins from source control and packages them for release.
针对 TFS 2008,我们使用 Toad for Oracle 和 TFS MSSCCI 提供程序。我们使用自定义工具从源代码管理中提取数据库签入并将它们打包以供发布。
To my knowledge Oracle Developer Tools for Visual Studio.Net doesn't have any real source control integration with TFS or otherwise.
据我所知,用于 Visual Studio.Net 的 Oracle 开发人员工具没有与 TFS 或其他方式的任何真正的源代码控制集成。
You might consider Toad Extensions for Visual Studiothough it's not cheap, maybe $4k I think.
您可能会考虑适用于 Visual Studio 的 Toad 扩展,尽管它并不便宜,我认为可能是 4000 美元。
Another option is the Oracle Change Management Packbut believe it requires the Enterprise edition of Oracle which is much more pricey.
另一种选择是Oracle Change Management Pack,但相信它需要 Oracle 的企业版,但价格要贵得多。