开发者

Oracle OCI - failing with ORA-12705 when running as another user

开发者 https://www.devze.com 2023-04-09 01:10 出处:网络
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 applica

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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号