Oracle OCI - 以其他用户身份运行时失败并出现 ORA-12705
我有一个使用 OCI 与数据库对话的 C 应用程序。我使用即时客户端方法,因此服务器上没有独立的 Oracle 安装 - 只是应用程序链接的几个库。
通常,应用程序以用户 dai 身份运行,一切正常。但是,如果应用程序作为另一个用户(在 dai 组中)运行,它将无法运行,并报告:
Error while trying to retrieve text for error ORA-12705
所以我可以想象这是一个权限错误,但我不确定它试图访问哪些文件。 Oracle 库的权限是
dai:/dai/oracle/lib> ls -l
total 201872
-rwxrwxrwx 1 dai dai 24719097 16 Feb 2009 libclntsh.a
-rwxrwxrwx 1 dai dai 5972457 16 Feb 2009 libocci.a
-rwxrwxrwx 1 dai dai 72651344 04 Jun 2010 libociei.so
正如您可以猜到的那样,主要的 OCI 库是静态链接的,但有一个动态链接库(不知道为什么,但 AIX instantclient 包附带了这些文件...)。我的 LIBPATH 从两个用户看来都正常:
LIBPATH=/dai/oracle/lib
我还需要检查哪些其他权限?
编辑:我刚刚尝试运行 truss
(AIX 相当于 Linux strace
)来看看发生了什么。以 dai 用户身份运行时,我看不到它读取任何意外文件。 Truss 似乎在跟踪 set-uid 程序时遇到问题 - C 应用程序的权限设置如下:
dai:/dai/bin> ls -l stats_backup
-rwsrwsr-x 1 dai dai 6173358 Aug 12 10:08 stats_backup
所以我执行了 chmod as 并再次尝试,现在它可以工作了!
所以程序在没有 s 位的情况下运行正常,但是当我把它放回去时,它又崩溃了。我无法使用 s 位设置运行 truss,这使得很难找出原因。如果没有设置 s 位,该程序将无法在其他情况下工作,因此这不是一个可行的解决方案,但希望能够指出问题所在。
I've got a C application using OCI to talk to a database. I'm using the instant client method so there is no standalone Oracle installation on the server - just a couple of libraries that the application is linked against.
Normally, the application runs as user dai, and everything works just fine. But if the application is run as another user (in group dai), it fails to run, reporting:
Error while trying to retrieve text for error ORA-12705
So I can imagine that this is a permissions error, but I'm not sure what files it is trying to access. The permissions of the Oracle libraries are
dai:/dai/oracle/lib> ls -l
total 201872
-rwxrwxrwx 1 dai dai 24719097 16 Feb 2009 libclntsh.a
-rwxrwxrwx 1 dai dai 5972457 16 Feb 2009 libocci.a
-rwxrwxrwx 1 dai dai 72651344 04 Jun 2010 libociei.so
As you can guess the main OCI libraries are statically linked, but there is one dynamically linked library (not sure why, but the AIX instantclient package came with these files...). My LIBPATH looks OK from both users:
LIBPATH=/dai/oracle/lib
Which other permissions do I need to check?
EDIT: I have just tried running truss
(AIX equivalent of Linux strace
) to see what is happening. I couldn't see it reading any unexpected files when running as the dai user. Truss seemed to have problems tracing a set-uid program - permissions on the C application were set like this:
dai:/dai/bin> ls -l stats_backup
-rwsrwsr-x 1 dai dai 6173358 Aug 12 10:08 stats_backup
So I did chmod a-s
and tried again, and it now works!
So the program runs OK without the s-bit, but as soon as I put it back, it breaks again. I can't run truss with the s-bit set, which makes it difficult to find out why this should be. The program doesn't work in other circumstances without the s-bit set, so this isn't a viable solution, but hopefully a pointer to where the problem may be.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
可能有一些 Oracle 数据文件位于其他用户无权访问的位置。 根据对于 Google 来说,发生 ORA-12705 是因为无法访问 NLS 数据文件(无论它们在哪里),或者可能存在某些环境变量问题。
There are presumably some Oracle data files located somewhere that your other users don't have access to. According to Google, ORA-12705 happens because the NLS data files (wherever they are) can't be accessed, or perhaps there is some environment variable issue.