oracle 设置 global_names 参数
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/315919/
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
Setting global_names parameter
提问by user40445
Greetings,
你好,
My company uses Peoplesoft for its financials and HR. Our implementation is on Oracle databases. Setting global_names = TRUE forces you to name your database link the same as the target. My question is does anyone know the ramification of setting global_names to false in the init.ora parameter file?
我的公司在财务和人力资源方面使用 Peoplesoft。我们的实现是在 Oracle 数据库上进行的。设置 global_names = TRUE 会强制您将数据库链接命名为与目标相同的名称。我的问题是有人知道在 init.ora 参数文件中将 global_names 设置为 false 的后果吗?
More specifically, I want one of our environments (global_names = true) to have a database link called PRODLINK and it will point to a production HR database. Another environment (where global_names = false) will also have a link called PRODLINK but it will point to a non-production database. To further complicate it, one database environment is at Oracle 9.2 while the other is at Oracle 10.2
更具体地说,我希望我们的一个环境 (global_names = true) 有一个名为 PRODLINK 的数据库链接,它将指向一个生产 HR 数据库。另一个环境(其中 global_names = false)也有一个名为 PRODLINK 的链接,但它将指向一个非生产数据库。更复杂的是,一个数据库环境是 Oracle 9.2 而另一个是 Oracle 10.2
I have searched for an answer for this but can't find one. Thanks in advance for your any help/advice you can offer up.
我已经为此寻找了答案,但找不到。预先感谢您提供的任何帮助/建议。
J.C.
JC
回答by Dave Costa
The upside of having global_names=TRUE is simply that it forces you to use names for database links that indicate clearly what database they connect to. Setting it to FALSE simply removes this restriction; the downside is that it will allow you to make links with names that could be confusing. In the perverse case, if you had databases A, B, and C, you could create a link in A called "B" but pointing to C.
global_names=TRUE 的好处只是它强制您使用数据库链接的名称,这些名称清楚地表明它们连接到哪个数据库。将其设置为 FALSE 只会删除此限制;缺点是它会允许您使用可能令人困惑的名称进行链接。在相反的情况下,如果您有数据库 A、B 和 C,您可以在 A 中创建一个名为“B”但指向 C 的链接。
You could also consider it a security issue, in that setting global_names=FALSE makes it slightly possible that someone could maliciously change the definition of a link, causing either inappropriate access or data damage. I can't think of a specific scenario for this though.
您也可以将其视为安全问题,因为设置 global_names=FALSE 使得有人可能会恶意更改链接的定义,从而导致不当访问或数据损坏。不过,我想不出具体的场景。
Overall, there isn't a big downside to setting it FALSE. However, there are a couple of other options you could consider.
总体而言,将其设置为 FALSE 没有太大的缺点。但是,您可以考虑其他几个选项。
One is to keep the global setting TRUE but reset it to FALSE at a session level in the code that needs it. We do this at my site because there is only one application that requires the use of "incorrectly" named links. This method ensures that anyone using the link interactively or writing code that uses it will be reminded that the name does not match the destination.
一种是在需要它的代码中在会话级别将全局设置保持为 TRUE,但将其重置为 FALSE。我们在我的网站上这样做是因为只有一个应用程序需要使用“不正确”命名的链接。此方法可确保任何以交互方式使用链接或编写使用链接的代码的人都会被提醒名称与目的地不匹配。
Another is to keep global_names=TRUE, so the environments use different link names, but make the link name a parameter or configuration option in your code. For instance, if you have scripts that build PL/SQL packages, you could make the link name a parameter of the script.
另一个是保持 global_names=TRUE,因此环境使用不同的链接名称,但将链接名称作为代码中的参数或配置选项。例如,如果您有构建 PL/SQL 包的脚本,您可以将链接名称作为脚本的参数。